def test_config_with_ports(): hwc = HELLO_WORLD(task=HELLO_WORLD.task()(processes=[ Process( name='hello_world', cmdline='echo {{thermos.ports[http]}} {{thermos.ports[admin]}}') ])) config = AuroraConfig(hwc) job = config.job() assert job.taskConfig.requestedPorts == set(['http', 'admin'])
def test_config_with_ports(): hwc = HELLO_WORLD( task = HELLO_WORLD.task()( processes = [ Process(name = 'hello_world', cmdline = 'echo {{thermos.ports[http]}} {{thermos.ports[admin]}}') ] ) ) config = AuroraConfig(hwc) job = config.job() assert job.taskConfig.requestedPorts == set(['http', 'admin'])
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()
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()