Exemple #1
0
def test_log_in_component_configure_is_put_out(output, sample_service):
    e = Environment("test-with-provide-require")
    e.load()
    e.configure()
    log = "\n".join(c[0][0].strip() for c in output.call_args_list)
    # Provide is *always* logged first, due to provide/require ordering.
    assert (
        """\
Provide
Pre sub
Sub!
Post sub"""
        == log
    )

    output.reset_mock()
    for root in e.root_dependencies():
        root.component.deploy(True)

    log = "\n".join(c[0][0].strip() for c in output.call_args_list)
    assert (
        """\
localhost > Hello
localhost: <Hello (localhost) "Hello"> verify: asdf=None\
"""
        == log
    )
Exemple #2
0
def test_multiple_components(sample_service):
    e = Environment('test-multiple-components')
    e.load()
    components = dict(
        (host, list(sorted(c.name for c in e.root_dependencies(host=host))))
        for host in sorted(e.hosts.keys()))
    assert components == dict(localhost=['hello1', 'hello2'],
                              otherhost=['hello3', 'hello4'],
                              thishost=['hello5', 'hello6'])
Exemple #3
0
def test_multiple_components(sample_service):
    e = Environment("test-multiple-components")
    e.load()
    components = dict(
        (host, list(sorted(c.name for c in e.root_dependencies(host=host))))
        for host in sorted(e.hosts.keys()))
    assert components == dict(
        localhost=["hello1", "hello2"],
        otherhost=["hello3", "hello4"],
        thishost=["hello5", "hello6"],
    )