def _chronos_package( args=['--yes'], returncode=0, stdout=b'Installing Marathon app for package [chronos] ' b'version [2.5.0-1]\n', stderr=b'', pre_install_notes=(b'By Deploying, you agree to the Terms ' b'and Conditions https://mesosphere.com/' b'catalog-terms-conditions/#certified-services\n' b'We recommend a minimum of one node with at least ' b'1 CPU and 2GB of RAM available for the ' b'Chronos Service.\n'), post_install_notes=b'Chronos DCOS Service has been successfully ' b'installed!\n\n' b'\tDocumentation: http://mesos.github.io/' b'chronos\n' b'\tIssues: https://github.com/mesos/chronos/' b'issues\n', stdin=None): _install_chronos(args, returncode, stdout, stderr, pre_install_notes, post_install_notes, stdin) try: yield finally: _uninstall_chronos() delete_zk_node('chronos') watch_all_deployments()
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_images_in_metadata(): package_install('cassandra') labels = _get_app_labels('/cassandra') dcos_package_metadata = labels.get("DCOS_PACKAGE_METADATA") images = json.loads( base64.b64decode(dcos_package_metadata).decode('utf-8'))["images"] assert images.get("icon-small") is not None assert images.get("icon-medium") is not None assert images.get("icon-large") is not None package_uninstall('cassandra') delete_zk_node('dcos-service-cassandra') watch_all_deployments()
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_images_in_metadata(): package_install('cassandra') labels = _get_app_labels('/cassandra') dcos_package_metadata = labels.get("DCOS_PACKAGE_METADATA") images = json.loads( base64.b64decode(dcos_package_metadata).decode('utf-8'))["images"] assert images.get("icon-small") is not None assert images.get("icon-medium") is not None assert images.get("icon-large") is not None # uninstall stderr = ( b'Uninstalled package [cassandra] version [2.0.2-3.0.14]\n' b'The DC/OS Apache Cassandra service is being uninstalled.\n\n' b'For DC/OS versions from 1.10 no further action is required. ' b'For older DC/OS versions follow the instructions at https://docs.' b'mesosphere.com/service-docs/cassandra/uninstall to remove any ' b'persistent state if required.\n') package_uninstall('cassandra', stderr=stderr) delete_zk_node('dcos-service-cassandra') watch_all_deployments()