def test_consumes(self):
     consumes = [
         'glideclient_manifests', 'Factory_Entries_Grid',
         'Factory_Entries_AWS', 'Factory_Entries_GCE', 'Factory_Entries_LCF'
     ]
     p = fe_group_classads.GlideinWMSManifests(config)
     assert (p.consumes() == consumes)
示例#2
0
 def test_consumes(self):
     consumes = [
         'glideclient_manifests', 'Factory_Entries_Grid',
         'Factory_Entries_AWS', 'Factory_Entries_GCE', 'Factory_Entries_LCF'
     ]
     p = fe_group_classads.GlideinWMSManifests(config)
     assert p._consumes == dict.fromkeys(consumes, pandas.DataFrame)
 def test_publish(self):
     p = fe_group_classads.GlideinWMSManifests(config)
     with mock.patch.object(fe_group_classads.GlideinWMSManifests,
                            'publish_to_htcondor') as publish_to_htcondor:
         publish_to_htcondor.return_value = None
         # TODO: Complete this test when we have detailed contents of the
         #       dataframe and the logic engine facts
         assert (True == True)
示例#4
0
def test_consumes():
    consumes = [
        "glideclient_manifests",
        "Factory_Entries_Grid",
        "Factory_Entries_AWS",
        "Factory_Entries_GCE",
        "Factory_Entries_LCF",
    ]
    p = fe_group_classads.GlideinWMSManifests(_CONFIG)
    assert p._consumes == dict.fromkeys(consumes, pd.DataFrame)
示例#5
0
def test_create_invalidate_constraint():
    p = fe_group_classads.GlideinWMSManifests(_CONFIG)
    p.create_invalidate_constraint(_REQUEST_DF)
    expected_constraint = {
        "col1.com":
        '(glideinmytype == "glideclient") && (stringlistmember(ClientName, "e1,e2,e3"))',
        "col2.com":
        '(glideinmytype == "glideclient") && (stringlistmember(ClientName, "e1,e2"))',
        "col3.com":
        '(glideinmytype == "glideclient") && (stringlistmember(ClientName, "e3"))',
    }
    assert p.invalidate_ads_constraint == expected_constraint
示例#6
0
def test_publish():
    with mock.patch.object(fe_group_classads.GlideinWMSManifests,
                           "publish_to_htcondor",
                           return_value=None) as publish_to_condor:
        p = fe_group_classads.GlideinWMSManifests(_CONFIG)
        datablock = {
            "glideclient_manifests":
            _REQUEST_DF,
            "Factory_Entries_Grid":
            pd.DataFrame({
                "Name": ["u", "v", "w"],
                "Other": [1, 2, 3]
            }),
            "Factory_Entries_AWS":
            pd.DataFrame({
                "Name": ["x"],
                "Other": 5
            }),
            "Factory_Entries_GCE":
            pd.DataFrame({
                "Name": ["y", "z"],
                "Other": 7
            }),
            "Factory_Entries_LCF":
            pd.DataFrame({
                "Name": [],
                "Other": 9
            }),
            "de_logicengine_facts":
            pd.DataFrame({
                "fact_name": [
                    "allow_grid_requests",
                    "allow_aws_requests",
                    "allow_gce_requests",
                    "allow_lcf_requests",
                ],
                "fact_value": [True, False, True, False],
            }),
        }
        p.publish(datablock)

        expected_dict = copy.deepcopy(_REQUEST_DICT)
        expected_dict["ReqIdleGlideins"] = [0, 0, 1, 0, 0, 1]
        actual_classad_type, actual_df = publish_to_condor.call_args[0]
        expected_df = pd.DataFrame(expected_dict).reindex_like(actual_df)
        assert actual_classad_type == "glideclient"
        assert actual_df.compare(expected_df).empty
 def test_create_invalidate_constraint(self):
     p = fe_group_classads.GlideinWMSManifests(config)
     p.create_invalidate_constraint(request_df)
     assert(p.invalidate_ads_constraint == expected_constraint)
 def test_publish(self):
     p = fe_group_classads.GlideinWMSManifests(config)
     with mock.patch.object(fe_group_classads.GlideinWMSManifests, 'publish_to_htcondor') as publish_to_htcondor:
         publish_to_htcondor.return_value = None