コード例 #1
0
def test_config_update_while_partitioned():
    world_tasks = sdk_tasks.get_service_tasks(config.SERVICE_NAME, "world")
    partition_host = world_tasks[0].host

    sdk_agents.partition_agent(partition_host)

    service_config = sdk_marathon.get_config(config.SERVICE_NAME)
    updated_cpus = float(service_config["env"]["WORLD_CPUS"]) + 0.1
    service_config["env"]["WORLD_CPUS"] = str(updated_cpus)
    sdk_marathon.update_app(service_config,
                            wait_for_completed_deployment=False)

    sdk_agents.reconnect_agent(partition_host)

    # check that ALL the world tasks are updated after the agent reconnects:
    sdk_tasks.check_tasks_updated(config.SERVICE_NAME, "world",
                                  [t.id for t in world_tasks])
    check_healthy()
    all_tasks = sdk_tasks.get_service_tasks(config.SERVICE_NAME)
    running_tasks = [
        t for t in all_tasks
        if t.name.startswith("world") and t.state == "TASK_RUNNING"
    ]
    assert len(running_tasks) == config.world_task_count(config.SERVICE_NAME)
    for t in running_tasks:
        assert config.close_enough(t.resources["cpus"], updated_cpus)
コード例 #2
0
ファイル: test_sanity.py プロジェクト: smush618/dcos-commons
def test_bump_world_cpus():
    original_world_ids = sdk_tasks.get_task_ids(foldered_name, "world")
    log.info("world ids: " + str(original_world_ids))

    updated_cpus = config.bump_world_cpus(foldered_name)

    sdk_tasks.check_tasks_updated(foldered_name, "world", original_world_ids)
    sdk_plan.wait_for_completed_deployment(foldered_name)

    all_tasks = sdk_tasks.get_service_tasks(foldered_name, task_prefix="world")
    running_tasks = [t for t in all_tasks if t.state == "TASK_RUNNING"]
    assert len(running_tasks) == config.world_task_count(foldered_name)
    for t in running_tasks:
        assert config.close_enough(t.resources["cpus"], updated_cpus)
コード例 #3
0
def test_bump_hello_cpus():
    hello_ids = sdk_tasks.get_task_ids(foldered_name, "hello")
    log.info("hello ids: " + str(hello_ids))

    updated_cpus = config.bump_hello_cpus(foldered_name)

    sdk_tasks.check_tasks_updated(foldered_name, "hello", hello_ids)
    sdk_plan.wait_for_completed_deployment(foldered_name)

    all_tasks = sdk_tasks.get_service_tasks(foldered_name, task_prefix="hello")
    running_tasks = [t for t in all_tasks if t.state == "TASK_RUNNING"]
    assert len(running_tasks) == config.hello_task_count(foldered_name)
    for t in running_tasks:
        assert config.close_enough(t.resources["cpus"], updated_cpus)
コード例 #4
0
def test_bump_hello_cpus():
    foldered_name = sdk_utils.get_foldered_name(config.SERVICE_NAME)
    config.check_running(foldered_name)
    hello_ids = sdk_tasks.get_task_ids(foldered_name, "hello")
    log.info("hello ids: " + str(hello_ids))

    updated_cpus = config.bump_hello_cpus(foldered_name)

    sdk_tasks.check_tasks_updated(foldered_name, "hello", hello_ids)
    config.check_running(foldered_name)

    all_tasks = sdk_tasks.get_service_tasks(foldered_name, task_prefix="hello")
    running_tasks = [t for t in all_tasks if t.state == "TASK_RUNNING"]
    assert len(running_tasks) == config.hello_task_count(foldered_name)
    for t in running_tasks:
        assert config.close_enough(t.resources["cpus"], updated_cpus)
コード例 #5
0
def test_bump_hello_cpus():
    foldered_name = sdk_utils.get_foldered_name(config.SERVICE_NAME)
    config.check_running(foldered_name)
    hello_ids = sdk_tasks.get_task_ids(foldered_name, 'hello')
    log.info('hello ids: ' + str(hello_ids))

    updated_cpus = config.bump_hello_cpus(foldered_name)

    sdk_tasks.check_tasks_updated(foldered_name, 'hello', hello_ids)
    config.check_running(foldered_name)

    all_tasks = shakedown.get_service_tasks(foldered_name)
    running_tasks = [t for t in all_tasks if t['name'].startswith('hello') and t['state'] == "TASK_RUNNING"]
    assert len(running_tasks) == config.hello_task_count(foldered_name)
    for t in running_tasks:
        assert config.close_enough(t['resources']['cpus'], updated_cpus)
コード例 #6
0
ファイル: test_sanity.py プロジェクト: thebijuus/dcos-commons
def test_bump_hello_cpus():
    foldered_name = sdk_utils.get_foldered_name(config.SERVICE_NAME)
    config.check_running(foldered_name)
    hello_ids = sdk_tasks.get_task_ids(foldered_name, 'hello')
    log.info('hello ids: ' + str(hello_ids))

    updated_cpus = config.bump_hello_cpus(foldered_name)

    sdk_tasks.check_tasks_updated(foldered_name, 'hello', hello_ids)
    config.check_running(foldered_name)

    all_tasks = shakedown.get_service_tasks(foldered_name)
    running_tasks = [t for t in all_tasks if t['name'].startswith('hello') and t['state'] == "TASK_RUNNING"]
    assert len(running_tasks) == config.hello_task_count(foldered_name)
    for t in running_tasks:
        assert config.close_enough(t['resources']['cpus'], updated_cpus)
コード例 #7
0
def test_config_update_while_partitioned():
    world_ids = sdk_tasks.get_task_ids(config.SERVICE_NAME, 'world')
    host = sdk_hosts.system_host(config.SERVICE_NAME, "world-0-server")
    shakedown.partition_agent(host)

    service_config = sdk_marathon.get_config(config.SERVICE_NAME)
    updated_cpus = float(service_config['env']['WORLD_CPUS']) + 0.1
    service_config['env']['WORLD_CPUS'] = str(updated_cpus)
    sdk_marathon.update_app(config.SERVICE_NAME, service_config, wait_for_completed_deployment=False)

    shakedown.reconnect_agent(host)
    sdk_tasks.check_tasks_updated(config.SERVICE_NAME, 'world', world_ids)
    config.check_running()
    all_tasks = shakedown.get_service_tasks(config.SERVICE_NAME)
    running_tasks = [t for t in all_tasks if t['name'].startswith('world') and t['state'] == "TASK_RUNNING"]
    assert len(running_tasks) == config.world_task_count(config.SERVICE_NAME)
    for t in running_tasks:
        assert config.close_enough(t['resources']['cpus'], updated_cpus)
コード例 #8
0
def test_config_update_while_partitioned():
    world_ids = sdk_tasks.get_task_ids(config.SERVICE_NAME, 'world')
    host = sdk_hosts.system_host(config.SERVICE_NAME, "world-0-server")
    shakedown.partition_agent(host)

    service_config = sdk_marathon.get_config(config.SERVICE_NAME)
    updated_cpus = float(service_config['env']['WORLD_CPUS']) + 0.1
    service_config['env']['WORLD_CPUS'] = str(updated_cpus)
    sdk_marathon.update_app(config.SERVICE_NAME, service_config, wait_for_completed_deployment=False)

    shakedown.reconnect_agent(host)
    sdk_tasks.check_tasks_updated(config.SERVICE_NAME, 'world', world_ids)
    config.check_running()
    all_tasks = shakedown.get_service_tasks(config.SERVICE_NAME)
    running_tasks = [t for t in all_tasks if t['name'].startswith('world') and t['state'] == "TASK_RUNNING"]
    assert len(running_tasks) == config.world_task_count(config.SERVICE_NAME)
    for t in running_tasks:
        assert config.close_enough(t['resources']['cpus'], updated_cpus)
コード例 #9
0
def test_config_update_while_partitioned():
    world_tasks = sdk_tasks.get_service_tasks(config.SERVICE_NAME, "world")
    partition_host = world_tasks[0].host

    sdk_agents.partition_agent(partition_host)

    service_config = sdk_marathon.get_config(config.SERVICE_NAME)
    updated_cpus = float(service_config["env"]["WORLD_CPUS"]) + 0.1
    service_config["env"]["WORLD_CPUS"] = str(updated_cpus)
    sdk_marathon.update_app(service_config, wait_for_completed_deployment=False)

    sdk_agents.reconnect_agent(partition_host)

    # check that ALL the world tasks are updated after the agent reconnects:
    sdk_tasks.check_tasks_updated(config.SERVICE_NAME, "world", [t.id for t in world_tasks])
    check_healthy()
    all_tasks = sdk_tasks.get_service_tasks(config.SERVICE_NAME)
    running_tasks = [
        t for t in all_tasks if t.name.startswith("world") and t.state == "TASK_RUNNING"
    ]
    assert len(running_tasks) == config.world_task_count(config.SERVICE_NAME)
    for t in running_tasks:
        assert config.close_enough(t.resources["cpus"], updated_cpus)