예제 #1
0
 def remove_stage_configs():
     configs = stage_configs + session_stage_configs + udi_stage_configs
     for config in configs:
         workflow = {}
         workflow["Name"] = "_teststage" + config["Name"]
         api.delete_stage_workflow_request(workflow, stack_resources)
         stage = {}
         stage["Name"] = config["Name"]
         api.delete_stage_request(stage, stack_resources)
예제 #2
0
def stages(operations, session_stage_configs, stack_resources, api_schema):

    urllib3.disable_warnings(urllib3.exceptions.InsecureRequestWarning)

    print("Creating test stages")
    for config in session_stage_configs:

        print("\nSTAGE CONFIGURATION: {}".format(config))

        # Create the stage
        create_stage_response = api.create_stage_request(
            config, stack_resources)
        stage = create_stage_response.json()

        assert create_stage_response.status_code == 200
        validation.schema(stage, api_schema["create_stage_response"])

    yield session_stage_configs

    for config in session_stage_configs:
        #Delete the stage
        stage = {}
        stage["Name"] = config["Name"]

        delete_stage_response = api.delete_stage_request(
            stage, stack_resources)
        assert delete_stage_response.status_code == 200
예제 #3
0
def test_workflow_execution_api(operations, stages, workflow_configs,
                                stack_resources, api_schema):

    urllib3.disable_warnings(urllib3.exceptions.InsecureRequestWarning)

    print("Running /workflow/execution API tests")
    for config in workflow_configs:

        print("----------------------------------------")
        print("\nTEST WORKFLOW EXECUTION CONFIGURATION: {}".format(config))

        # Create the workflow
        create_workflow_response = api.create_workflow_request(
            config, stack_resources)
        workflow = create_workflow_response.json()

        assert create_workflow_response.status_code == 200
        validation.schema(workflow, api_schema["create_workflow_response"])

        get_workflow_response = api.get_workflow_request(
            workflow, stack_resources)
        workflow = get_workflow_response.json()
        assert get_workflow_response.status_code == 200
        validation.schema(workflow, api_schema["create_workflow_response"])

        # Execute the workflow and wait for it to complete
        create_workflow_execution_response = api.create_workflow_execution_request(
            workflow, config, stack_resources)
        workflow_execution = create_workflow_execution_response.json()
        assert create_workflow_execution_response.status_code == 200
        assert workflow_execution['Status'] == 'Queued'

        #FIXME - validate create_workflow_response
        #validation.schema(workflow_execution, api_schema["create_workflow_execution_response"])
        workflow_execution = api.wait_for_workflow_execution(
            workflow_execution, stack_resources, 120)
        if config["Status"] == "OK":
            assert workflow_execution["Status"] == "Complete"

            # Check output media for expected types
            for outputType in config["Outputs"]:
                if outputType != "None":
                    assert outputType in workflow_execution["Globals"]["Media"]

        else:
            assert workflow_execution["Status"] == "Error"

        # validation.stage_execution(workflow_execution, config, stack_resources, api_schema)

        # Delete the workflow
        delete_workflow_response = api.delete_stage_workflow_request(
            workflow, stack_resources)
        assert delete_workflow_response.status_code == 200

        #Delete the workflow
        delete_stage_response = api.delete_stage_request(
            workflow, stack_resources)
        assert delete_stage_response.status_code == 200


#TODO: dynamoDB remove asset
예제 #4
0
def test_stage_api(operations, stage_configs, stack_resources, api_schema):

    urllib3.disable_warnings(urllib3.exceptions.InsecureRequestWarning)

    print("Running /workflow/stage API tests")
    for config in stage_configs:

        print("----------------------------------------")
        print("\nTEST STAGE CONFIGURATION: {}".format(config))

        # Create the stage
        create_stage_response = api.create_stage_request(
            config, stack_resources)
        stage = create_stage_response.json()

        assert create_stage_response.status_code == 200
        validation.schema(stage, api_schema["create_stage_response"])

        get_stage_response = api.get_stage_request(stage, stack_resources)
        stage = get_stage_response.json()
        assert get_stage_response.status_code == 200
        validation.schema(stage, api_schema["create_stage_response"])

        # Create a singleton workflow to test executing this stage
        create_workflow_response = api.create_stage_workflow_request(
            stage, stack_resources)
        workflow = create_workflow_response.json()
        assert create_workflow_response.status_code == 200
        #FIXME - validate create_workflow_response
        # validation.schema(workflow, api_schema["create_workflow_response"])

        # Execute the stage and wait for it to complete
        create_workflow_execution_response = api.create_workflow_execution_request(
            workflow, config, stack_resources)
        workflow_execution = create_workflow_execution_response.json()
        assert create_workflow_execution_response.status_code == 200
        assert workflow_execution['Status'] == 'Queued'

        #FIXME - validate create_workflow_response
        #validation.schema(workflow_execution, api_schema["create_workflow_execution_response"])
        workflow_execution = api.wait_for_workflow_execution(
            workflow_execution, stack_resources, 120)
        if config["Status"] == "OK":
            assert workflow_execution["Status"] == "Complete"

            # Check output media for expected types
            for outputType in config["Outputs"]:
                if outputType != "None":
                    assert outputType in workflow_execution["Globals"]["Media"]

        else:
            assert workflow_execution["Status"] == "Error"

        # Check output metadata for expected keys - each test operation writes a key with its operation name
        for metadataKey in config["ExecutedOperations"]:
            assert metadataKey in workflow_execution["Globals"]["MetaData"]
            if "TestCustomConfig" in config:
                assert "TestCustomConfig" in workflow_execution["Globals"][
                    "MetaData"][metadataKey]
                assert workflow_execution["Globals"]["MetaData"][metadataKey][
                    "TestCustomConfig"] == config["TestCustomConfig"]

        #validation.stage_execution(workflow_execution, config, stack_resources, api_schema)

        # Delete the workflow
        delete_workflow_response = api.delete_stage_workflow_request(
            workflow, stack_resources)
        assert delete_workflow_response.status_code == 200

        #Delete the stage
        delete_stage_response = api.delete_stage_request(
            stage, stack_resources)
        assert delete_stage_response.status_code == 200


#TODO: dynamoDB remove asset