def test_old_tasks_not_relaunched():
    hello_task_id = sdk_tasks.get_task_ids(config.SERVICE_NAME, "hello")
    assert len(hello_task_id) > 0, "Got an empty list of task_ids"
    # Start update plan with options that have list of yaml files to make it launch in multi service mode
    sdk_upgrade.update_or_upgrade_or_downgrade(
        config.PACKAGE_NAME,
        config.SERVICE_NAME,
        to_version=None,
        to_options={
            "service": {
                "yaml": "",
                "yamls": "svc,foobar_service_name"
            }
        },
        expected_running_tasks=4,
        wait_for_deployment=False,
    )
    # Ensure new tasks are launched but the old task does not relaunch
    sdk_plan.wait_for_completed_deployment(config.SERVICE_NAME,
                                           multiservice_name="foobar")
    sdk_tasks.check_task_not_relaunched(
        config.SERVICE_NAME,
        "hello-0-server",
        hello_task_id.pop(),
        multiservice_name=config.SERVICE_NAME,
    )
    assert len(sdk_tasks.get_task_ids(config.SERVICE_NAME, "foo")) == 1
def test_once_task_does_not_restart_on_config_update():
    foldered_name = sdk_utils.get_foldered_name(config.SERVICE_NAME)
    config.check_running(foldered_name)

    sdk_plan.wait_for_completed_deployment(foldered_name)
    task_name = 'hello-0-once'
    hello_once_id = sdk_tasks.get_completed_task_id(task_name)
    assert hello_once_id is not None
    log.info('hello_once_id: ' + str(hello_once_id))

    updated_cpus = config.bump_hello_cpus(foldered_name)

    sdk_tasks.check_task_not_relaunched(foldered_name, task_name, hello_once_id)
    config.check_running(foldered_name)
Esempio n. 3
0
def test_once_task_does_not_restart_on_config_update():
    foldered_name = sdk_utils.get_foldered_name(config.SERVICE_NAME)
    config.check_running(foldered_name)

    sdk_plan.wait_for_completed_deployment(foldered_name)
    task_name = 'hello-0-once'
    hello_once_id = sdk_tasks.get_completed_task_id(task_name)
    assert hello_once_id is not None
    log.info('hello_once_id: ' + str(hello_once_id))

    updated_cpus = config.bump_hello_cpus(foldered_name)

    sdk_tasks.check_task_not_relaunched(foldered_name, task_name,
                                        hello_once_id)
    config.check_running(foldered_name)
def test_old_tasks_not_relaunched():
    hello_task_id = sdk_tasks.get_task_ids(config.SERVICE_NAME, 'hello')
    assert len(hello_task_id) > 0, 'Got an empty list of task_ids'
    # Start update plan with options that have list of yaml files to make it launch in multi service mode
    sdk_upgrade.update_service(config.PACKAGE_NAME,
                               config.SERVICE_NAME,
                               additional_options={
                                   "service": {
                                       "yaml": "",
                                       "yamls": "svc,foobar_service_name"
                                   }
                               })
    # Ensure new tasks are launched but the old task does not relaunch
    sdk_plan.wait_for_completed_deployment(config.SERVICE_NAME, multiservice_name='foobar')
    sdk_tasks.check_task_not_relaunched(config.SERVICE_NAME,
                                        'hello-0-server',
                                        hello_task_id.pop(),
                                        multiservice_name=config.SERVICE_NAME)
    assert len(sdk_tasks.get_task_ids(config.SERVICE_NAME, 'foo')) == 1