def test_increase_decrease_world_nodes(): foldered_name = sdk_utils.get_foldered_name(config.SERVICE_NAME) config.check_running(foldered_name) original_hello_ids = sdk_tasks.get_task_ids(foldered_name, 'hello') original_world_ids = sdk_tasks.get_task_ids(foldered_name, 'world') log.info('world ids: ' + str(original_world_ids)) # add 2 world nodes sdk_marathon.bump_task_count_config(foldered_name, 'WORLD_COUNT', 2) config.check_running(foldered_name) sdk_tasks.check_tasks_not_updated(foldered_name, 'world', original_world_ids) # check 2 world tasks added: assert 2 + len(original_world_ids) == len(sdk_tasks.get_task_ids(foldered_name, 'world')) # subtract 2 world nodes sdk_marathon.bump_task_count_config(foldered_name, 'WORLD_COUNT', -2) config.check_running(foldered_name) # wait for the decommission plan for this subtraction to be complete sdk_plan.wait_for_completed_plan(foldered_name, 'decommission') # check that the total task count is back to original sdk_tasks.check_running( foldered_name, len(original_hello_ids) + len(original_world_ids), allow_more=False) # check that original tasks weren't affected/relaunched in the process sdk_tasks.check_tasks_not_updated(foldered_name, 'hello', original_hello_ids) sdk_tasks.check_tasks_not_updated(foldered_name, 'world', original_world_ids) # check that the world tasks are back to their prior state (also without changing task ids) assert original_world_ids == sdk_tasks.get_task_ids(foldered_name, 'world')
def test_bump_data_nodes(): data_ids = sdk_tasks.get_task_ids(foldered_name, "data") log.info("data ids: " + str(data_ids)) sdk_marathon.bump_task_count_config(foldered_name, "DATA_COUNT") config.check_healthy(service_name=foldered_name, count=config.DEFAULT_TASK_COUNT + 1) sdk_tasks.check_tasks_not_updated(foldered_name, "data", data_ids)
def test_bump_data_nodes(): data_ids = sdk_tasks.get_task_ids(FOLDERED_SERVICE_NAME, 'data') log.info('data ids: ' + str(data_ids)) sdk_marathon.bump_task_count_config(FOLDERED_SERVICE_NAME, 'DATA_COUNT') check_healthy(count=DEFAULT_TASK_COUNT + 1) sdk_tasks.check_tasks_not_updated(FOLDERED_SERVICE_NAME, 'data', data_ids)
def test_bump_data_nodes(): data_ids = tasks.get_task_ids(PACKAGE_NAME, 'data') sdk_utils.out('data ids: ' + str(data_ids)) marathon.bump_task_count_config(PACKAGE_NAME, 'DATA_COUNT') check_healthy(DEFAULT_TASK_COUNT + 1) tasks.check_tasks_not_updated(PACKAGE_NAME, 'data', data_ids)
def test_bump_data_nodes(): foldered_name = sdk_utils.get_foldered_name(config.SERVICE_NAME) data_ids = sdk_tasks.get_task_ids(foldered_name, 'data') log.info('data ids: ' + str(data_ids)) sdk_marathon.bump_task_count_config(foldered_name, 'DATA_COUNT') config.check_healthy(service_name=foldered_name, count=config.DEFAULT_TASK_COUNT + 1) sdk_tasks.check_tasks_not_updated(foldered_name, 'data', data_ids)
def test_bump_hello_nodes(): config.check_running(FOLDERED_SERVICE_NAME) hello_ids = sdk_tasks.get_task_ids(FOLDERED_SERVICE_NAME, 'hello') log.info('hello ids: ' + str(hello_ids)) sdk_marathon.bump_task_count_config(FOLDERED_SERVICE_NAME, 'HELLO_COUNT') config.check_running(FOLDERED_SERVICE_NAME) sdk_tasks.check_tasks_not_updated(FOLDERED_SERVICE_NAME, 'hello', hello_ids)
def test_bump_hello_nodes(): 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)) sdk_marathon.bump_task_count_config(foldered_name, 'HELLO_COUNT') config.check_running(foldered_name) sdk_tasks.check_tasks_not_updated(foldered_name, 'hello', hello_ids)
def test_bump_data_nodes(): data_ids = sdk_tasks.get_task_ids(FOLDERED_SERVICE_NAME, 'data') log.info('data ids: ' + str(data_ids)) sdk_marathon.bump_task_count_config(FOLDERED_SERVICE_NAME, 'DATA_COUNT') config.check_healthy( service_name=FOLDERED_SERVICE_NAME, count=config.DEFAULT_TASK_COUNT + 1 ) sdk_tasks.check_tasks_not_updated(FOLDERED_SERVICE_NAME, 'data', data_ids)
def test_increase_decrease_world_nodes(): original_hello_ids = sdk_tasks.get_task_ids(foldered_name, "hello") original_world_ids = sdk_tasks.get_task_ids(foldered_name, "world") log.info("world ids: " + str(original_world_ids)) # add 2 world nodes sdk_marathon.bump_task_count_config(foldered_name, "WORLD_COUNT", 2) # autodetects the correct number of nodes and waits for them to deploy: config.check_running(foldered_name) sdk_plan.wait_for_completed_deployment(foldered_name) sdk_tasks.check_tasks_not_updated(foldered_name, "world", original_world_ids) # check 2 world tasks added: assert 2 + len(original_world_ids) == len( sdk_tasks.get_task_ids(foldered_name, "world")) # subtract 2 world nodes sdk_marathon.bump_task_count_config(foldered_name, "WORLD_COUNT", -2) # autodetects the correct number of nodes and waits for them to deploy: config.check_running(foldered_name) sdk_plan.wait_for_completed_deployment(foldered_name) # wait for the decommission plan for this subtraction to be complete sdk_plan.wait_for_completed_plan(foldered_name, "decommission") # check that the total task count is back to original sdk_tasks.check_running(foldered_name, len(original_hello_ids) + len(original_world_ids), allow_more=False) # check that original tasks weren't affected/relaunched in the process sdk_tasks.check_tasks_not_updated(foldered_name, "hello", original_hello_ids) sdk_tasks.check_tasks_not_updated(foldered_name, "world", original_world_ids) # check that the world tasks are back to their prior state (also without changing task ids) assert original_world_ids == sdk_tasks.get_task_ids(foldered_name, "world")
def test_increase_count(): marathon.bump_task_count_config(SERVICE_NAME, 'BROKER_COUNT') try: tasks.check_running(PACKAGE_NAME, DEFAULT_BROKER_COUNT + 1, timeout_seconds=60) assert False, "Should not start task now" except AssertionError as arg: raise arg except: pass # expected to fail tasks.check_running(SERVICE_NAME, DEFAULT_BROKER_COUNT) pl = service_cli('plan show {}'.format(DEFAULT_PLAN_NAME)) assert pl['status'] == 'WAITING' assert pl['phases'][0]['status'] == 'WAITING' for step in range(DEFAULT_BROKER_COUNT): assert pl['phases'][0]['steps'][step]['status'] == 'COMPLETE' assert pl['phases'][0]['steps'][DEFAULT_BROKER_COUNT][ 'status'] == 'WAITING' service_cli('plan continue {} {}'.format(DEFAULT_PLAN_NAME, DEFAULT_PHASE_NAME)) tasks.check_running(SERVICE_NAME, DEFAULT_BROKER_COUNT + 1) broker_count_check(DEFAULT_BROKER_COUNT + 1) pl = service_cli('plan show {}'.format(DEFAULT_PLAN_NAME)) assert pl['status'] == 'COMPLETE' assert pl['phases'][0]['status'] == 'COMPLETE' for step in range(DEFAULT_BROKER_COUNT + 1): assert pl['phases'][0]['steps'][step]['status'] == 'COMPLETE'
def test_increase_decrease_world_nodes(): original_hello_ids = sdk_tasks.get_task_ids(foldered_name, "hello") original_world_ids = sdk_tasks.get_task_ids(foldered_name, "world") log.info("world ids: " + str(original_world_ids)) # add 2 world nodes sdk_marathon.bump_task_count_config(foldered_name, "WORLD_COUNT", 2) # autodetects the correct number of nodes and waits for them to deploy: config.check_running(foldered_name) sdk_plan.wait_for_completed_deployment(foldered_name) sdk_tasks.check_tasks_not_updated(foldered_name, "world", original_world_ids) # check 2 world tasks added: assert 2 + len(original_world_ids) == len(sdk_tasks.get_task_ids(foldered_name, "world")) # subtract 2 world nodes sdk_marathon.bump_task_count_config(foldered_name, "WORLD_COUNT", -2) # autodetects the correct number of nodes and waits for them to deploy: config.check_running(foldered_name) sdk_plan.wait_for_completed_deployment(foldered_name) # wait for the decommission plan for this subtraction to be complete sdk_plan.wait_for_completed_plan(foldered_name, "decommission") # check that the total task count is back to original sdk_tasks.check_running( foldered_name, len(original_hello_ids) + len(original_world_ids), allow_more=False ) # check that original tasks weren't affected/relaunched in the process sdk_tasks.check_tasks_not_updated(foldered_name, "hello", original_hello_ids) sdk_tasks.check_tasks_not_updated(foldered_name, "world", original_world_ids) # check that the world tasks are back to their prior state (also without changing task ids) assert original_world_ids == sdk_tasks.get_task_ids(foldered_name, "world")
def test_increase_count(): sdk_marathon.bump_task_count_config(config.SERVICE_NAME, 'HELLO_COUNT') expected_tasks = [ 'hello-0', 'hello-1', 'hello-2', 'hello-3', 'world-0', 'world-1', 'world-2', 'world-3' ] try: sdk_tasks.check_running(config.SERVICE_NAME, len(expected_tasks) + 1, timeout_seconds=60) assert False, "Should not start task now" except AssertionError as arg: raise arg except: pass # expected to fail sdk_tasks.check_running(config.SERVICE_NAME, len(expected_tasks)) assert sdk_cmd.svc_cli(config.PACKAGE_NAME, config.SERVICE_NAME, 'pod list', json=True) == expected_tasks pl = sdk_plan.wait_for_plan_status(config.SERVICE_NAME, 'deploy', 'WAITING') log.info(pl) assert pl['status'] == 'WAITING' assert len(pl['phases']) == 2 phase = pl['phases'][0] assert phase['status'] == 'WAITING' steps = phase['steps'] assert len(steps) == 5 assert steps[0]['status'] == 'COMPLETE' assert steps[1]['status'] == 'COMPLETE' assert steps[2]['status'] == 'COMPLETE' assert steps[3]['status'] == 'COMPLETE' assert steps[4]['status'] == 'WAITING' phase = pl['phases'][1] assert phase['status'] == 'COMPLETE' steps = phase['steps'] assert len(steps) == 4 assert steps[0]['status'] == 'COMPLETE' assert steps[1]['status'] == 'COMPLETE' assert steps[2]['status'] == 'COMPLETE' assert steps[3]['status'] == 'COMPLETE' sdk_cmd.svc_cli(config.PACKAGE_NAME, config.SERVICE_NAME, 'plan continue deploy hello-deploy') expected_tasks = [ 'hello-0', 'hello-1', 'hello-2', 'hello-3', 'hello-4', 'world-0', 'world-1', 'world-2', 'world-3' ] sdk_tasks.check_running(config.SERVICE_NAME, len(expected_tasks)) assert sdk_cmd.svc_cli(config.PACKAGE_NAME, config.SERVICE_NAME, 'pod list', json=True) == expected_tasks pl = sdk_plan.wait_for_plan_status(config.SERVICE_NAME, 'deploy', 'COMPLETE') log.info(pl) assert pl['status'] == 'COMPLETE' assert len(pl['phases']) == 2 phase = pl['phases'][0] assert phase['status'] == 'COMPLETE' steps = phase['steps'] assert len(steps) == 5 assert steps[0]['status'] == 'COMPLETE' assert steps[1]['status'] == 'COMPLETE' assert steps[2]['status'] == 'COMPLETE' assert steps[3]['status'] == 'COMPLETE' assert steps[4]['status'] == 'COMPLETE' phase = pl['phases'][1] assert phase['status'] == 'COMPLETE' steps = phase['steps'] assert len(steps) == 4 assert steps[0]['status'] == 'COMPLETE' assert steps[1]['status'] == 'COMPLETE' assert steps[2]['status'] == 'COMPLETE' assert steps[3]['status'] == 'COMPLETE'
def test_increase_count(): sdk_marathon.bump_task_count_config(config.SERVICE_NAME, "HELLO_COUNT") expected_tasks = [ "hello-0", "hello-1", "hello-2", "hello-3", "world-0", "world-1", "world-2", "world-3", ] try: sdk_tasks.check_running(config.SERVICE_NAME, len(expected_tasks) + 1, timeout_seconds=60) assert False, "Should not start task now" except AssertionError as arg: raise arg except Exception: pass # expected to fail sdk_tasks.check_running(config.SERVICE_NAME, len(expected_tasks)) rc, stdout, _ = sdk_cmd.svc_cli(config.PACKAGE_NAME, config.SERVICE_NAME, "pod list") assert rc == 0, "Pod list failed" assert json.loads(stdout) == expected_tasks pl = sdk_plan.wait_for_plan_status(config.SERVICE_NAME, "deploy", "WAITING") log.info(pl) assert pl["status"] == "WAITING" assert len(pl["phases"]) == 2 phase = pl["phases"][0] assert phase["status"] == "WAITING" steps = phase["steps"] assert len(steps) == 5 assert steps[0]["status"] == "COMPLETE" assert steps[1]["status"] == "COMPLETE" assert steps[2]["status"] == "COMPLETE" assert steps[3]["status"] == "COMPLETE" assert steps[4]["status"] == "WAITING" phase = pl["phases"][1] assert phase["status"] == "COMPLETE" steps = phase["steps"] assert len(steps) == 4 assert steps[0]["status"] == "COMPLETE" assert steps[1]["status"] == "COMPLETE" assert steps[2]["status"] == "COMPLETE" assert steps[3]["status"] == "COMPLETE" sdk_cmd.svc_cli(config.PACKAGE_NAME, config.SERVICE_NAME, "plan continue deploy hello-deploy") expected_tasks = [ "hello-0", "hello-1", "hello-2", "hello-3", "hello-4", "world-0", "world-1", "world-2", "world-3", ] sdk_tasks.check_running(config.SERVICE_NAME, len(expected_tasks)) rc, stdout, _ = sdk_cmd.svc_cli(config.PACKAGE_NAME, config.SERVICE_NAME, "pod list") assert rc == 0, "Pod list failed" assert json.loads(stdout) == expected_tasks pl = sdk_plan.wait_for_plan_status(config.SERVICE_NAME, "deploy", "COMPLETE") log.info(pl) assert pl["status"] == "COMPLETE" assert len(pl["phases"]) == 2 phase = pl["phases"][0] assert phase["status"] == "COMPLETE" steps = phase["steps"] assert len(steps) == 5 assert steps[0]["status"] == "COMPLETE" assert steps[1]["status"] == "COMPLETE" assert steps[2]["status"] == "COMPLETE" assert steps[3]["status"] == "COMPLETE" assert steps[4]["status"] == "COMPLETE" phase = pl["phases"][1] assert phase["status"] == "COMPLETE" steps = phase["steps"] assert len(steps) == 4 assert steps[0]["status"] == "COMPLETE" assert steps[1]["status"] == "COMPLETE" assert steps[2]["status"] == "COMPLETE" assert steps[3]["status"] == "COMPLETE"
def test_increase_count(): sdk_marathon.bump_task_count_config(config.SERVICE_NAME, 'HELLO_COUNT') expected_tasks = [ 'hello-0', 'hello-1', 'hello-2', 'hello-3', 'world-0', 'world-1', 'world-2', 'world-3'] try: sdk_tasks.check_running(config.SERVICE_NAME, len(expected_tasks) + 1, timeout_seconds=60) assert False, "Should not start task now" except AssertionError as arg: raise arg except: pass # expected to fail sdk_tasks.check_running(config.SERVICE_NAME, len(expected_tasks)) assert sdk_cmd.svc_cli(config.PACKAGE_NAME, config.SERVICE_NAME, 'pod list', json=True) == expected_tasks pl = sdk_plan.wait_for_plan_status(config.SERVICE_NAME, 'deploy', 'WAITING') log.info(pl) assert pl['status'] == 'WAITING' assert len(pl['phases']) == 2 phase = pl['phases'][0] assert phase['status'] == 'WAITING' steps = phase['steps'] assert len(steps) == 5 assert steps[0]['status'] == 'COMPLETE' assert steps[1]['status'] == 'COMPLETE' assert steps[2]['status'] == 'COMPLETE' assert steps[3]['status'] == 'COMPLETE' assert steps[4]['status'] == 'WAITING' phase = pl['phases'][1] assert phase['status'] == 'COMPLETE' steps = phase['steps'] assert len(steps) == 4 assert steps[0]['status'] == 'COMPLETE' assert steps[1]['status'] == 'COMPLETE' assert steps[2]['status'] == 'COMPLETE' assert steps[3]['status'] == 'COMPLETE' sdk_cmd.svc_cli(config.PACKAGE_NAME, config.SERVICE_NAME, 'plan continue deploy hello-deploy') expected_tasks = [ 'hello-0', 'hello-1', 'hello-2', 'hello-3', 'hello-4', 'world-0', 'world-1', 'world-2', 'world-3'] sdk_tasks.check_running(config.SERVICE_NAME, len(expected_tasks)) assert sdk_cmd.svc_cli(config.PACKAGE_NAME, config.SERVICE_NAME, 'pod list', json=True) == expected_tasks pl = sdk_plan.wait_for_plan_status(config.SERVICE_NAME, 'deploy', 'COMPLETE') log.info(pl) assert pl['status'] == 'COMPLETE' assert len(pl['phases']) == 2 phase = pl['phases'][0] assert phase['status'] == 'COMPLETE' steps = phase['steps'] assert len(steps) == 5 assert steps[0]['status'] == 'COMPLETE' assert steps[1]['status'] == 'COMPLETE' assert steps[2]['status'] == 'COMPLETE' assert steps[3]['status'] == 'COMPLETE' assert steps[4]['status'] == 'COMPLETE' phase = pl['phases'][1] assert phase['status'] == 'COMPLETE' steps = phase['steps'] assert len(steps) == 4 assert steps[0]['status'] == 'COMPLETE' assert steps[1]['status'] == 'COMPLETE' assert steps[2]['status'] == 'COMPLETE' assert steps[3]['status'] == 'COMPLETE'