def test_bump_journal_cpus(): journal_ids = tasks.get_task_ids(PACKAGE_NAME, 'journal') sdk_utils.out('journal ids: ' + str(journal_ids)) marathon.bump_cpu_count_config(PACKAGE_NAME, 'JOURNAL_CPUS') tasks.check_tasks_updated(PACKAGE_NAME, 'journal', journal_ids) check_healthy()
def test_bump_journal_cpus(): journal_ids = sdk_tasks.get_task_ids(FOLDERED_SERVICE_NAME, 'journal') log.info('journal ids: ' + str(journal_ids)) sdk_marathon.bump_cpu_count_config(FOLDERED_SERVICE_NAME, 'JOURNAL_CPUS') sdk_tasks.check_tasks_updated(FOLDERED_SERVICE_NAME, 'journal', journal_ids) check_healthy()
def test_port_dynamic_to_dynamic_port(): sdk_tasks.check_running(SERVICE_NAME, DEFAULT_BROKER_COUNT) broker_ids = sdk_tasks.get_task_ids(SERVICE_NAME, '{}-'.format(DEFAULT_POD_TYPE)) sdk_marathon.bump_cpu_count_config(SERVICE_NAME, 'BROKER_CPUS') sdk_tasks.check_tasks_updated(SERVICE_NAME, '{}-'.format(DEFAULT_POD_TYPE), broker_ids) # all tasks are running sdk_tasks.check_running(SERVICE_NAME, DEFAULT_BROKER_COUNT)
def test_port_dynamic_to_dynamic_port(): sdk_tasks.check_running(config.SERVICE_NAME, config.DEFAULT_BROKER_COUNT) broker_ids = sdk_tasks.get_task_ids(config.SERVICE_NAME, '{}-'.format(config.DEFAULT_POD_TYPE)) sdk_marathon.bump_cpu_count_config(config.SERVICE_NAME, 'BROKER_CPUS') sdk_tasks.check_tasks_updated(config.SERVICE_NAME, '{}-'.format(config.DEFAULT_POD_TYPE), broker_ids) # all tasks are running sdk_tasks.check_running(config.SERVICE_NAME, config.DEFAULT_BROKER_COUNT)
def test_bump_journal_cpus(): journal_ids = sdk_tasks.get_task_ids(FOLDERED_SERVICE_NAME, 'journal') name_ids = sdk_tasks.get_task_ids(FOLDERED_SERVICE_NAME, 'name') log.info('journal ids: ' + str(journal_ids)) sdk_marathon.bump_cpu_count_config(FOLDERED_SERVICE_NAME, 'JOURNAL_CPUS') sdk_tasks.check_tasks_updated(FOLDERED_SERVICE_NAME, 'journal', journal_ids) # journal node update should not cause any of the name nodes to crash sdk_tasks.check_tasks_not_updated(FOLDERED_SERVICE_NAME, 'name', name_ids) config.check_healthy(service_name=FOLDERED_SERVICE_NAME)
def test_bump_journal_cpus(): journal_ids = sdk_tasks.get_task_ids(config.FOLDERED_SERVICE_NAME, 'journal') name_ids = sdk_tasks.get_task_ids(config.FOLDERED_SERVICE_NAME, 'name') log.info('journal ids: ' + str(journal_ids)) sdk_marathon.bump_cpu_count_config(config.FOLDERED_SERVICE_NAME, 'JOURNAL_CPUS') sdk_tasks.check_tasks_updated(config.FOLDERED_SERVICE_NAME, 'journal', journal_ids) # journal node update should not cause any of the name nodes to crash sdk_tasks.check_tasks_not_updated(config.FOLDERED_SERVICE_NAME, 'name', name_ids) config.check_healthy(service_name=config.FOLDERED_SERVICE_NAME)
def test_bump_journal_cpus(): journal_ids = sdk_tasks.get_task_ids(foldered_name, "journal") name_ids = sdk_tasks.get_task_ids(foldered_name, "name") log.info("journal ids: " + str(journal_ids)) sdk_marathon.bump_cpu_count_config(foldered_name, "JOURNAL_CPUS") sdk_tasks.check_tasks_updated(foldered_name, "journal", journal_ids) # journal node update should not cause any of the name nodes to crash # if the name nodes crashed, then it implies the journal nodes were updated in parallel, when they should've been updated serially # for journal nodes, the deploy plan is parallel, while the update plan is serial. maybe the deploy plan was mistakenly used? sdk_tasks.check_tasks_not_updated(foldered_name, "name", name_ids) config.check_healthy(service_name=foldered_name)
def bump_hello_cpus(): return marathon.bump_cpu_count_config(PACKAGE_NAME, 'HELLO_CPUS')
def bump_world_cpus(service_name=PACKAGE_NAME): return marathon.bump_cpu_count_config(service_name, 'WORLD_CPUS')
def bump_hello_cpus(service_name=PACKAGE_NAME): return marathon.bump_cpu_count_config(service_name, 'HELLO_CPUS')
def bump_world_cpus(): return marathon.bump_cpu_count_config(PACKAGE_NAME, 'WORLD_CPUS')
def test_increase_cpu(): hello_0_ids = sdk_tasks.get_task_ids(config.SERVICE_NAME, 'hello-0-server') sdk_marathon.bump_cpu_count_config(config.SERVICE_NAME, 'HELLO_CPUS') 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'] == 'WAITING' assert steps[1]['status'] == 'WAITING' assert steps[2]['status'] == 'PENDING' assert steps[3]['status'] == 'PENDING' assert steps[4]['status'] == 'PENDING' 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' # check that all prior tasks are still running, no changes yet 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 assert hello_0_ids == sdk_tasks.get_task_ids(config.SERVICE_NAME, 'hello-0-server') sdk_cmd.svc_cli(config.PACKAGE_NAME, config.SERVICE_NAME, 'plan continue deploy hello-deploy') sdk_tasks.check_tasks_updated(config.SERVICE_NAME, 'hello-0-server', hello_0_ids) sdk_tasks.check_running(config.SERVICE_NAME, len(expected_tasks)) pl = sdk_plan.wait_for_step_status(config.SERVICE_NAME, 'deploy', 'hello-deploy', 'hello-0:[server]', 'COMPLETE') 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'] == 'WAITING' assert steps[2]['status'] == 'PENDING' assert steps[3]['status'] == 'PENDING' assert steps[4]['status'] == 'PENDING' 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' hello_1_ids = sdk_tasks.get_task_ids(config.SERVICE_NAME, 'hello-1-server') sdk_cmd.svc_cli(config.PACKAGE_NAME, config.SERVICE_NAME, 'plan continue deploy hello-deploy') sdk_tasks.check_tasks_updated(config.SERVICE_NAME, 'hello-1-server', hello_1_ids) pl = sdk_plan.wait_for_completed_deployment(config.SERVICE_NAME) 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 bump_world_cpus(service_name=SERVICE_NAME): return sdk_marathon.bump_cpu_count_config(service_name, "WORLD_CPUS")
def test_increase_cpu(): def plan_waiting(): try: pl = service_cli('plan show {}'.format(DEFAULT_PLAN_NAME)) if pl['status'] == 'WAITING': return True except: pass return False def plan_complete(): try: pl = service_cli('plan show {}'.format(DEFAULT_PLAN_NAME)) if pl['status'] == 'COMPLETE': return True except: pass return False marathon.bump_cpu_count_config(SERVICE_NAME, 'BROKER_CPUS') spin.time_wait_return(plan_waiting) pl = service_cli('plan show {}'.format(DEFAULT_PLAN_NAME)) assert pl['status'] == 'WAITING' assert pl['phases'][0]['status'] == 'WAITING' assert pl['phases'][0]['steps'][0]['status'] == 'WAITING' assert pl['phases'][0]['steps'][1]['status'] == 'WAITING' for step in range(2, DEFAULT_BROKER_COUNT + 1): assert pl['phases'][0]['steps'][step]['status'] == 'PENDING' # all tasks are still running tasks.check_running(SERVICE_NAME, DEFAULT_BROKER_COUNT + 1) broker_ids = tasks.get_task_ids( SERVICE_NAME, '{}-0-{}'.format(DEFAULT_POD_TYPE, DEFAULT_TASK_NAME)) service_cli('plan continue {} {}'.format(DEFAULT_PLAN_NAME, DEFAULT_PHASE_NAME)) tasks.check_tasks_updated( SERVICE_NAME, '{}-0-{}'.format(DEFAULT_POD_TYPE, DEFAULT_TASK_NAME), broker_ids) tasks.check_running(SERVICE_NAME, DEFAULT_BROKER_COUNT + 1) pl = service_cli('plan show {}'.format(DEFAULT_PLAN_NAME)) assert pl['status'] == 'WAITING' assert pl['phases'][0]['status'] == 'WAITING' assert pl['phases'][0]['steps'][0]['status'] == 'COMPLETE' assert pl['phases'][0]['steps'][1]['status'] == 'WAITING' for step in range(2, DEFAULT_BROKER_COUNT + 1): assert pl['phases'][0]['steps'][step]['status'] == 'PENDING' broker_ids = tasks.get_task_ids( SERVICE_NAME, '{}-1-{}'.format(DEFAULT_POD_TYPE, DEFAULT_TASK_NAME)) service_cli('plan continue {} {}'.format(DEFAULT_PLAN_NAME, DEFAULT_PHASE_NAME)) tasks.check_tasks_updated( SERVICE_NAME, '{}-1-{}'.format(DEFAULT_POD_TYPE, DEFAULT_TASK_NAME), broker_ids) spin.time_wait_return(plan_complete) 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' broker_count_check(DEFAULT_BROKER_COUNT + 1)
def bump_hello_cpus(service_name=SERVICE_NAME): return sdk_marathon.bump_cpu_count_config(service_name, 'HELLO_CPUS')
def test_increase_cpu(): hello_0_ids = sdk_tasks.get_task_ids(config.SERVICE_NAME, 'hello-0-server') sdk_marathon.bump_cpu_count_config(config.SERVICE_NAME, 'HELLO_CPUS') 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'] == 'WAITING' assert steps[1]['status'] == 'WAITING' assert steps[2]['status'] == 'PENDING' assert steps[3]['status'] == 'PENDING' assert steps[4]['status'] == 'PENDING' 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' # check that all prior tasks are still running, no changes yet 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 assert hello_0_ids == sdk_tasks.get_task_ids(config.SERVICE_NAME, 'hello-0-server') sdk_cmd.svc_cli(config.PACKAGE_NAME, config.SERVICE_NAME, 'plan continue deploy hello-deploy') sdk_tasks.check_tasks_updated(config.SERVICE_NAME, 'hello-0-server', hello_0_ids) sdk_tasks.check_running(config.SERVICE_NAME, len(expected_tasks)) pl = sdk_plan.wait_for_step_status(config.SERVICE_NAME, 'deploy', 'hello-deploy', 'hello-0:[server]', 'COMPLETE') 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'] == 'WAITING' assert steps[2]['status'] == 'PENDING' assert steps[3]['status'] == 'PENDING' assert steps[4]['status'] == 'PENDING' 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' hello_1_ids = sdk_tasks.get_task_ids(config.SERVICE_NAME, 'hello-1-server') sdk_cmd.svc_cli(config.PACKAGE_NAME, config.SERVICE_NAME, 'plan continue deploy hello-deploy') sdk_tasks.check_tasks_updated(config.SERVICE_NAME, 'hello-1-server', hello_1_ids) pl = sdk_plan.wait_for_completed_deployment(config.SERVICE_NAME) 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 bump_world_cpus(service_name=SERVICE_NAME): return sdk_marathon.bump_cpu_count_config(service_name, 'WORLD_CPUS')
def bump_hello_cpus(service_name=SERVICE_NAME): return sdk_marathon.bump_cpu_count_config(service_name, "HELLO_CPUS")