def teardown_module(module): services = get_services() for framework in services: if framework['name'] == 'chronos': service_shutdown(framework['id']) teardown_universe_server()
def test_log_multiple_apps(): package_install('marathon', True, ['--options=tests/data/service/marathon-user.json']) package_install('marathon', True, [ '--options=tests/data/service/marathon-user2.json', '--app-id=marathon-user2' ]) wait_for_service('marathon-user', number_of_services=2) try: stderr = (b'Error: multiple marathon apps found for service name ' + b'[marathon-user]: [/marathon-user, /marathon-user2]\n') assert_command(['dcos', 'service', 'log', 'marathon-user'], returncode=1, stderr=stderr) finally: # We can't use `dcos package uninstall`. The services have the same # name. Manually remove the dcos services. remove_app('marathon-user') remove_app('marathon-user2') for service in get_services(): if service['name'] == 'marathon-user': service_shutdown(service['id']) delete_zk_node('universe')
def test_uninstall_multiple_frameworknames(zk_znode): retcode, _, _ = exec_command([ 'dcos', 'package', 'install', 'chronos', '--yes', '--options=tests/data/package/chronos-1.json']) assert retcode == 0 retcode, _, _ = exec_command([ 'dcos', 'package', 'install', 'chronos', '--yes', '--options=tests/data/package/chronos-2.json']) assert retcode == 0 watch_all_deployments() _uninstall_chronos(args=['--app-id=chronos-user-1'], returncode=1) _uninstall_chronos(args=['--app-id=chronos-user-2'], returncode=1) for framework in get_services(args=['--inactive']): if framework['name'] == 'chronos-user': service_shutdown(framework['id'])
def test_service_inactive_and_completed(): package_install('kafka', True, ['--app']) wait_for_service('kafka') # get kafka's framework ID kafka_id = None for service in get_services(): if service['name'] == 'kafka': kafka_id = service['id'] break assert kafka_id is not None # assert kafka is listed services = get_services() assert any(service['name'] == 'kafka' for service in services) # kill scheduler and test for inactive... exec_command(['dcos', 'marathon', 'app', 'stop', '/kafka', '--force']) time.sleep(5) # assert kafka is not listed assert not any(service['name'] == 'kafka' for service in get_services()) # assert kafka is inactive inactive = get_services(args=['--inactive']) assert any(service['name'] == 'kafka' for service in inactive) # teardown framework and test for completed... service_shutdown(kafka_id) delete_zk_node('kafka-mesos') # assert kafka is not listed assert not any(service['name'] == 'kafka' for service in get_services()) # assert kafka is completed services = get_services(args=['--completed']) assert len(services) >= 3 assert any(service['id'] == kafka_id for service in services) exec_command(['dcos', 'package', 'uninstall', 'kafka', '--yes'])
def test_uninstall_multiple_frameworknames(zk_znode): _install_chronos( args=['--yes', '--options=tests/data/package/chronos-1.json']) _install_chronos( args=['--yes', '--options=tests/data/package/chronos-2.json']) watch_all_deployments() expected_output = file_json( 'tests/data/package/json/test_list_chronos_two_users.json') _list(args=['--json'], stdout=expected_output) _list(args=['--json', 'chronos'], stdout=expected_output) _list(args=['--json', '--app-id=/chronos-user-1'], stdout=file_json( 'tests/data/package/json/test_list_chronos_user_1.json')) _list(args=['--json', '--app-id=/chronos-user-2'], stdout=file_json( 'tests/data/package/json/test_list_chronos_user_2.json')) _uninstall_chronos( args=['--app-id=chronos-user-1'], returncode=1, stderr='Uninstalled package [chronos] version [2.5.0-1]\n' 'Unable to shutdown [chronos] service framework with name ' '[chronos-user] because there are multiple framework ids ' 'matching this name: ') _uninstall_chronos( args=['--app-id=chronos-user-2'], returncode=1, stderr='Uninstalled package [chronos] version [2.5.0-1]\n' 'Unable to shutdown [chronos] service framework with name ' '[chronos-user] because there are multiple framework ids ' 'matching this name: ') for framework in get_services(args=['--inactive']): if framework['name'] == 'chronos-user': service_shutdown(framework['id'])