def marathon_restart_gets_new_task_ids(context, job_id): (service, instance, _, __) = decompose_job_id(job_id) app_id = marathon_tools.create_complete_config( service, instance, soa_dir=context.soa_dir)['id'] normal_instance_count = 1 cluster = context.system_paasta_config['cluster'] old_tasks = context.marathon_client.get_app(app_id).tasks with mock.patch('paasta_tools.marathon_serviceinit._log', autospec=True): marathon_serviceinit.restart_marathon_job( service, instance, app_id, normal_instance_count, context.marathon_client, cluster, ) paasta_print("Sleeping 5 seconds to wait for %s to be restarted." % service) time.sleep(5) new_tasks = context.marathon_client.get_app(app_id).tasks paasta_print("Tasks before the restart: %s" % old_tasks) paasta_print("Tasks after the restart: %s" % new_tasks) paasta_print() # sacrificial line for behave to eat instead of our output assert old_tasks != new_tasks
def marathon_restart_gets_new_task_ids(context, job_id): (service, instance, _, __) = decompose_job_id(job_id) app_id = marathon_tools.create_complete_config(service, instance, None, soa_dir=context.soa_dir)["id"] normal_instance_count = 1 cluster = context.system_paasta_config["cluster"] old_tasks = context.marathon_client.get_app(app_id).tasks marathon_serviceinit.restart_marathon_job( service, instance, app_id, normal_instance_count, context.marathon_client, cluster ) print "Sleeping 5 seconds to wait for %s to be restarted." % service time.sleep(5) new_tasks = context.marathon_client.get_app(app_id).tasks print "Tasks before the restart: %s" % old_tasks print "Tasks after the restart: %s" % new_tasks print # sacrificial line for behave to eat instead of our output assert old_tasks != new_tasks
def marathon_restart_gets_new_task_ids(context, job_id): (service, instance, _, __) = decompose_job_id(job_id) app_id = marathon_tools.create_complete_config(service, instance, soa_dir=context.soa_dir)['id'] normal_instance_count = 1 cluster = context.system_paasta_config['cluster'] old_tasks = context.marathon_client.get_app(app_id).tasks with mock.patch('paasta_tools.marathon_serviceinit._log', autospec=True): marathon_serviceinit.restart_marathon_job( service, instance, app_id, normal_instance_count, context.marathon_client, cluster ) paasta_print("Sleeping 5 seconds to wait for %s to be restarted." % service) time.sleep(5) new_tasks = context.marathon_client.get_app(app_id).tasks paasta_print("Tasks before the restart: %s" % old_tasks) paasta_print("Tasks after the restart: %s" % new_tasks) paasta_print() # sacrificial line for behave to eat instead of our output assert old_tasks != new_tasks