Exemplo n.º 1
0
def test__getInputs(mocker, mockReplyInput, manifestOptions, expected):

    mockReply.return_value = mockReplyInput

    module_str = "DIRAC.WorkloadManagementSystem.Client.JobState.JobState.JobDB.getInputData"
    mocker.patch(module_str, side_effect=mockReply)
    mocker.patch(
        "DIRAC.WorkloadManagementSystem.Client.JobState.JobState.JobDB.__init__",
        side_effect=mockNone)
    mocker.patch(
        "DIRAC.WorkloadManagementSystem.Client.JobState.JobState.JobLoggingDB.__init__",
        side_effect=mockNone)
    mocker.patch(
        "DIRAC.WorkloadManagementSystem.Client.JobState.JobState.TaskQueueDB.__init__",
        side_effect=mockNone)

    inputData = InputData()
    js = CachedJobState(1)
    js.setAttribute('JobType', 'User')

    manifest = JobManifest()
    for varName, varValue in manifestOptions.iteritems():
        manifest.setOption(varName, varValue)

    js.setManifest(manifest)
    res = inputData._getInputs(js)
    assert res['OK'] is True
    assert res['Value'] == expected
Exemplo n.º 2
0
def test__getTagsFromManifest(manifestOptions, expected):
    manifest = JobManifest()
    for varName, varValue in manifestOptions.items():
        manifest.setOption(varName, varValue)

    js = JobScheduling()
    tagList = js._getTagsFromManifest(manifest)
    assert set(tagList) == set(expected)
Exemplo n.º 3
0
def test__getInputSandbox(mocker, manifestOptions, expected):

    mocker.patch("DIRAC.WorkloadManagementSystem.Client.JobState.JobState.JobDB.__init__", side_effect=mockNone)
    mocker.patch("DIRAC.WorkloadManagementSystem.Client.JobState.JobState.JobLoggingDB.__init__", side_effect=mockNone)
    mocker.patch("DIRAC.WorkloadManagementSystem.Client.JobState.JobState.TaskQueueDB.__init__", side_effect=mockNone)

    inputData = InputData()
    js = CachedJobState(1)
    js.setAttribute("JobType", "User")

    manifest = JobManifest()
    for varName, varValue in manifestOptions.items():
        manifest.setOption(varName, varValue)

    js.setManifest(manifest)
    res = inputData._getInputSandbox(js)
    assert res["OK"] is True
    assert res["Value"] == expected