def _one_pipeline_setup(pipelines_config=None, set_source_el=True):
    if pipelines_config is None:
        pipelines_config = _get_pipelines_config()
    # override source op with a mock test class
    if set_source_el:
        log.info("set source=_TestSourceElement")
        interpreter.Pipeline.PIPELINE_OPS['source'] = _TestSourceElement
    return interpreter.get_pipelines(pipelines_config=pipelines_config)
Example #2
0
def _one_pipeline_setup():
    # override source op with a mock test class
    interpreter.Pipeline.PIPELINE_OPS['source'] = _TestSourceElement
    p = interpreter.get_pipelines(
        pipelines_config={'pipeline_one': [{
            'source': {
                'uri': 'test'
            }
        }]})
    return p
Example #3
0
def test_get_pipelines_two():
    # override source op with a mock test class
    interpreter.Pipeline.PIPELINE_OPS["source"] = _TestSourceElement
    p = interpreter.get_pipelines(
        pipelines_config={
            "pipeline_one": [{"source": {"uri": "test"}}],
            "pipeline_two": [{"source": {"uri": "test2"}}],
        }
    )
    assert isinstance(p[0], interpreter.Pipeline)
    assert p[0].name == "pipeline_one"
    assert isinstance(p[0]._pipe_elements[0], _TestSourceElement)
    assert isinstance(p[1], interpreter.Pipeline)
    assert p[0]._pipe_elements[0].config["uri"] == "test"
    assert p[1].name == "pipeline_two"
    assert isinstance(p[1]._pipe_elements[0], _TestSourceElement)
    assert p[1]._pipe_elements[0].config["uri"] == "test2"
def test_get_pipelines_two():
    # override source op with a mock test class
    interpreter.Pipeline.PIPELINE_OPS['source'] = _TestSourceElement
    p = interpreter.get_pipelines(
        pipelines_config={
            'pipeline_one': [
                  {'source': 'some_source'}
                  ],
            'pipeline_two': [
                  {'source': 'another_source'}
                  ]
             },
            )
    assert isinstance(p[0], interpreter.Pipeline)
    assert p[0].name == 'pipeline_one'
    assert isinstance(p[0].pipe_elements[0], _TestSourceElement)
    assert isinstance(p[1], interpreter.Pipeline)
    assert p[0].pipe_elements[0].config == 'some_source'
    assert p[1].name == 'pipeline_two'
    assert isinstance(p[1].pipe_elements[0], _TestSourceElement)
    assert p[1].pipe_elements[0].config == 'another_source'
def test_get_pipelines_two():
    # override source op with a mock test class
    interpreter.Pipeline.PIPELINE_OPS['source'] = _TestSourceElement
    p = interpreter.get_pipelines(
        pipelines_config={
            'pipeline_one': [
                {'source': {'uri': 'test'}}
            ],
            'pipeline_two': [
                {'source': {'uri': 'test2'}}
            ]
        }
    )
    assert isinstance(p[0], interpreter.Pipeline)
    assert p[0].name == 'pipeline_one'
    assert isinstance(p[0]._pipe_elements[0], _TestSourceElement)
    assert isinstance(p[1], interpreter.Pipeline)
    assert p[0]._pipe_elements[0].config['uri'] == 'test'
    assert p[1].name == 'pipeline_two'
    assert isinstance(p[1]._pipe_elements[0], _TestSourceElement)
    assert p[1]._pipe_elements[0].config['uri'] == 'test2'
def test_get_pipelines_none():
    p = interpreter.get_pipelines(pipelines_config=[])
    assert not p