Esempio n. 1
0
def test_shell_command_solid():
    solid = create_shell_command_solid('echo "this is a test message: $MY_ENV_VAR"', name='foobar')

    result = execute_solid(
        solid, run_config={'solids': {'foobar': {'config': {'env': {'MY_ENV_VAR': 'foobar'}}}}},
    )
    assert result.output_values == {'result': 'this is a test message: foobar\n'}
Esempio n. 2
0
def test_shell_command_stream_logs():
    solid = create_shell_command_solid(
        'for i in 1 2 3 4 5; do echo "hello ${i}"; done', name='foobar'
    )

    result = execute_solid(
        solid,
        run_config={
            'solids': {
                'foobar': {'config': {'output_logging': 'STREAM', 'env': {'MY_ENV_VAR': 'foobar'}}}
            }
        },
    )
    assert result.output_values == {'result': 'hello 1\nhello 2\nhello 3\nhello 4\nhello 5\n'}
Esempio n. 3
0
def test_shell_command_solid():
    solid = create_shell_command_solid(
        'echo "this is a test message: $MY_ENV_VAR"', name="foobar")

    result = execute_solid(
        solid,
        run_config={
            "solids": {
                "foobar": {
                    "config": {
                        "env": {
                            "MY_ENV_VAR": "foobar"
                        }
                    }
                }
            }
        },
    )
    assert result.output_values == {
        "result": "this is a test message: foobar\n"
    }
Esempio n. 4
0
def test_shell_command_stream_logs():
    solid = create_shell_command_solid(
        'for i in 1 2 3 4 5; do echo "hello ${i}"; done', name="foobar")

    result = execute_solid(
        solid,
        run_config={
            "solids": {
                "foobar": {
                    "config": {
                        "output_logging": "STREAM",
                        "env": {
                            "MY_ENV_VAR": "foobar"
                        }
                    }
                }
            }
        },
    )
    assert result.output_values == {
        "result": "hello 1\nhello 2\nhello 3\nhello 4\nhello 5\n"
    }
def pipe():
    a = create_shell_command_solid('echo "hello, world!"', name='a')
    a()
Esempio n. 6
0
def test_shell_command_retcode():
    with pytest.raises(Failure, match="Shell command execution failed"):
        execute_solid(create_shell_command_solid("exit 1", name="exit_solid"))
Esempio n. 7
0
def test_shell_command_retcode():
    with pytest.raises(Failure, match='Shell command execution failed'):
        execute_solid(create_shell_command_solid('exit 1', name='exit_solid'))