Ejemplo n.º 1
0
def test_missing_primary_id():
    pipeline_definition = read_pipeline_resource('pipeline_invalid.json')
    # Replace pipeline id with non-matching guid so primary is not found
    pipeline_definition['pipelines'][0]['id'] = "deadbeef-dead-beef-dead-beefdeadbeef"

    with pytest.raises(SyntaxError):
        PipelineParser.parse(pipeline_definition)
Ejemplo n.º 2
0
def test_missing_artifact():
    pipeline_definition = read_pipeline_resource('pipeline_invalid.json')

    with pytest.raises(SyntaxError) as e:
        PipelineParser.parse(pipeline_definition)

    assert "Missing field 'artifact'" in str(e.value)
Ejemplo n.º 3
0
def test_missing_operation_image():
    pipeline_definition = _read_pipeline_resource('pipeline_valid.json')
    pipeline_definition['pipelines'][0]['nodes'][0]['app_data']['image'] = ''

    with pytest.raises(ValueError) as e:
        PipelineParser.parse(pipeline_definition)

    assert "Missing field 'operation image'" in str(e.value)
Ejemplo n.º 4
0
def test_missing_pipeline_runtime_configuration():
    pipeline_definition = _read_pipeline_resource('pipeline_valid.json')
    pipeline_definition['pipelines'][0]['app_data']['runtime-config'] = ''

    with pytest.raises(ValueError) as e:
        PipelineParser.parse(pipeline_definition)

    assert "Invalid pipeline: Missing runtime configuration" in str(e.value)
Ejemplo n.º 5
0
def test_missing_pipeline_title():
    pipeline_definition = _read_pipeline_resource('pipeline_valid.json')
    pipeline_definition['pipelines'][0]['app_data']['title'] = ''

    with pytest.raises(ValueError) as e:
        PipelineParser.parse(pipeline_definition)

    assert "Invalid pipeline: Missing title" in str(e.value)
Ejemplo n.º 6
0
def test_missing_operation_filename():
    pipeline_definition = _read_pipeline_resource('pipeline_valid.json')
    pipeline_definition['pipelines'][0]['nodes'][0]['app_data'].pop('filename')

    with pytest.raises(ValueError) as e:
        PipelineParser.parse(pipeline_definition)

    assert "Missing field 'operation filename" in str(e.value)
Ejemplo n.º 7
0
def test_missing_pipeline_runtime():
    pipeline_definition = _read_pipeline_resource('pipeline_valid.json')
    pipeline_definition['pipelines'][0]['app_data'].pop('runtime')

    with pytest.raises(ValueError) as e:
        PipelineParser.parse(pipeline_definition)

    assert "Invalid pipeline: Missing runtime." in str(e.value)
Ejemplo n.º 8
0
def test_missing_pipeline_name_should_default_to_untitled():
    pipeline_definition = _read_pipeline_resource('pipeline_valid.json')
    pipeline_definition['pipelines'][0]['app_data'].pop('name')

    pipeline = PipelineParser.parse(pipeline_definition)

    assert pipeline.name == 'untitled'
Ejemplo n.º 9
0
def test_multinode_pipeline():
    pipeline_definition = _read_pipeline_resource(
        'pipeline_3_node_sample.json')

    pipeline = PipelineParser.parse(pipeline_definition)

    assert len(pipeline.operations) == 3
Ejemplo n.º 10
0
def test_pipeline_global_attributes():
    pipeline_definition = read_pipeline_resource('pipeline_valid.json')

    pipeline = PipelineParser.parse(pipeline_definition)

    assert pipeline.title == '{{title}}'
    assert pipeline.runtime == '{{runtime}}'
    assert pipeline.runtime_config == '{{runtime-config}}'
Ejemplo n.º 11
0
def test_valid_pipeline(valid_operation):
    pipeline_definition = read_pipeline_resource('pipeline_valid.json')

    pipeline = PipelineParser.parse(pipeline_definition)

    assert pipeline.title == '{{title}}'
    assert len(pipeline.operations) == 1
    assert pipeline.operations['{{uuid}}'] == valid_operation
Ejemplo n.º 12
0
def test_pipeline_with_dependencies():
    pipeline_definition = read_pipeline_resource(
        'pipeline_3_node_sample_with_dependencies.json')

    pipeline = PipelineParser.parse(pipeline_definition)

    assert len(pipeline.operations['acc4527d-7cc8-4c16-b520-5aa0f50a2e34'].
               dependencies) == 2
Ejemplo n.º 13
0
def test_pipeline_operations_and_handle_artifact_file_details():
    pipeline_definition = _read_pipeline_resource('pipeline_3_node_sample.json')

    pipeline = PipelineParser.parse(pipeline_definition)

    assert len(pipeline.operations) == 3

    for op in pipeline.operations.values():
        assert '.' not in op.name
Ejemplo n.º 14
0
def test_valid_pipeline(valid_operation):
    pipeline_definition = _read_pipeline_resource('pipeline_valid.json')

    pipeline = PipelineParser.parse(pipeline_definition)

    assert pipeline.name == '{{name}}'
    assert pipeline.runtime == '{{runtime}}'
    assert pipeline.runtime_config == '{{runtime-config}}'
    assert len(pipeline.operations) == 1
    assert pipeline.operations['{{uuid}}'] == valid_operation
Ejemplo n.º 15
0
    def post(self, *args, **kwargs):
        self.log.debug("Pipeline SchedulerHandler now executing post request")

        pipeline_definition = self.get_json_body()

        self.log.debug("JSON payload: %s", pipeline_definition)

        try:
            pipeline = PipelineParser.parse(pipeline_definition)
            run_url = PipelineProcessorManager.process(pipeline)
        except Exception as e:
            self.send_error_message(
                500, "Pipeline submission failed with the following error: {}".
                format(str(e)))
        else:
            self.send_success_message("Pipeline successfully submitted",
                                      run_url)
Ejemplo n.º 16
0
def test_missing_pipelines():
    pipeline_definition = read_pipeline_resource('pipeline_invalid.json')
    pipeline_definition.pop('pipelines')

    with pytest.raises(SyntaxError):
        PipelineParser.parse(pipeline_definition)
Ejemplo n.º 17
0
def test_missing_primary():
    pipeline_definition = _read_pipeline_resource('pipeline_invalid.json')
    pipeline_definition.pop('primary_pipeline')

    with pytest.raises(ValueError):
        PipelineParser.parse(pipeline_definition)
Ejemplo n.º 18
0
def test_multiple_pipeline_definition():
    pipeline_definition = read_pipeline_resource(
        'pipeline_multiple_pipeline_definitions.json')

    with pytest.raises(SyntaxError):
        PipelineParser.parse(pipeline_definition)
Ejemplo n.º 19
0
def test_zero_nodes():
    pipeline_definition = read_pipeline_resource('pipeline_invalid.json')
    pipeline_definition['pipelines'][0]['nodes'] = []

    with pytest.raises(SyntaxError):
        PipelineParser.parse(pipeline_definition)
Ejemplo n.º 20
0
def test_supernode_pipelinen():
    pipeline_definition = read_pipeline_resource(
        'pipeline_with_supernode.json')

    with pytest.raises(SyntaxError):
        PipelineParser.parse(pipeline_definition)