Пример #1
0
class ThermosContext(Struct):
    # TODO(wickman) Move the underlying replacement mechanism to %port% replacements
    ports = Map(String, Integer)

    # TODO(wickman) Move the underlying replacement mechanism to %task_id%
    task_id = String

    # TODO(wickman) Move underlying mechanism to %user%
    user = String
Пример #2
0
def test_config_with_task_links():
    tl = Map(String, String)
    unresolved_tl = {
        'foo': 'http://%host%:{{thermos.ports[foo]}}',
        'bar': 'http://%host%:{{thermos.ports[bar]}}/{{mesos.instance}}',
    }
    resolved_tl = {
        'foo': 'http://%host%:%port:foo%',
        'bar': 'http://%host%:%port:bar%/%shard_id%'
    }
    aurora_config = AuroraConfig(HELLO_WORLD(task_links=tl(unresolved_tl)))
    assert aurora_config.task_links() == tl(resolved_tl)
    assert aurora_config.job().taskConfig.taskLinks == frozendict(resolved_tl)

    bad_tl = {'foo': '{{thermos.ports.bad}}'}
    with pytest.raises(AuroraConfig.InvalidConfig):
        AuroraConfig(HELLO_WORLD(task_links=tl(bad_tl))).job()