def test_service_overlay_health(): """Installs SDK based Kafka on with virtual networks set to True. Tests that the deployment completes and the service is healthy, then checks that all of the service tasks (brokers) are on the overlay network """ tasks = sdk_tasks.check_task_count(config.SERVICE_NAME, config.DEFAULT_BROKER_COUNT) for task in tasks: sdk_networks.check_task_network(task.name)
def test_tasks_on_overlay() -> None: tasks = sdk_tasks.check_task_count(config.SERVICE_NAME, config.DEFAULT_TASK_COUNT) for task in tasks: # TODO: After applying port labels using SDK check network for exporter task. if task.name != "exporter-0-node": sdk_networks.check_task_network(task.name)
def test_service_overlay_health(): """Installs SDK based Kafka on with virtual networks set to True. Tests that the deployment completes and the service is healthy, then checks that all of the service tasks (brokers) are on the overlay network """ shakedown.service_healthy(PACKAGE_NAME) broker_tasks = ("kafka-0-broker", "kafka-1-broker", "kafka-2-broker") for task in broker_tasks: networks.check_task_network(task)
def test_service_overlay_health(): shakedown.service_healthy(config.SERVICE_NAME) node_tasks = ( "node-0-server", "node-1-server", "node-2-server", ) for task in node_tasks: sdk_networks.check_task_network(task)
def test_service_overlay_health(): shakedown.service_healthy(PACKAGE_NAME) node_tasks = ( "node-0-server", "node-1-server", "node-2-server", ) for task in node_tasks: networks.check_task_network(task)
def test_service_overlay_health(): """Installs SDK based Kafka on with virtual networks set to True. Tests that the deployment completes and the service is healthy, then checks that all of the service tasks (brokers) are on the overlay network """ shakedown.service_healthy(config.SERVICE_NAME) broker_tasks = ( "kafka-0-broker", "kafka-1-broker", "kafka-2-broker" ) for task in broker_tasks: sdk_networks.check_task_network(task)
def test_install(): sdk_networks.check_task_network("template-0-node")
def test_tasks_on_overlay(): elastic_tasks = shakedown.get_service_task_ids(config.SERVICE_NAME) assert len(elastic_tasks) == config.NO_INGEST_TASK_COUNT, \ "Incorrect number of tasks should be {} got {}".format(config.NO_INGEST_TASK_COUNT, len(elastic_tasks)) for task in elastic_tasks: sdk_networks.check_task_network(task)
def test_install(): sdk_networks.check_task_network("nifi-0-node")
def test_install(): sdk_networks.check_task_network("hivemq-0-node")
def test_tasks_on_overlay(): tasks = sdk_tasks.check_task_count(config.SERVICE_NAME, config.DEFAULT_TASK_COUNT) for task in tasks: sdk_networks.check_task_network(task.name)
def test_overlay_network(): """Verify that the current deploy plan matches the expected plan from the spec.""" deployment_plan = sdk_plan.wait_for_completed_deployment(config.SERVICE_NAME) log.info(sdk_plan.plan_string("deploy", deployment_plan)) # test that the tasks are all up, which tests the overlay DNS framework_tasks = sdk_tasks.get_service_tasks(config.SERVICE_NAME) expected_running_tasks = [ "overlay-vip-0-server", "overlay-0-server", "host-vip-0-server", "host-0-server" ] assert set(expected_running_tasks) == set([t.name for t in framework_tasks]) for task in framework_tasks: name = task.name if name.startswith("host-"): assert "ports" in task.resources.keys(), "Task {} should have port resources".format( name ) sdk_networks.check_task_network(name, expected_network_name=None) elif name.startswith("overlay-"): assert ( "ports" not in task.resources.keys() ), "Task {} should NOT have port resources".format( name ) sdk_networks.check_task_network(name) else: assert False, "Unknown task {}".format(name) endpoints_result = sdk_networks.get_endpoint_names(config.PACKAGE_NAME, config.SERVICE_NAME) assert len(endpoints_result) == 2, "Expected 2 endpoints, got: {}".format(endpoints_result) overlay_endpoints_result = sdk_networks.get_endpoint( config.PACKAGE_NAME, config.SERVICE_NAME, "overlay-vip" ) assert "address" in overlay_endpoints_result.keys(), ( "overlay endpoints missing 'address': {}".format(overlay_endpoints_result) ) assert len(overlay_endpoints_result["address"]) == 1 assert overlay_endpoints_result["address"][0].startswith("9") overlay_port = overlay_endpoints_result["address"][0].split(":")[-1] assert overlay_port == "4044" assert "dns" in overlay_endpoints_result.keys() assert len(overlay_endpoints_result["dns"]) == 1 assert overlay_endpoints_result["dns"][0] == sdk_hosts.autoip_host( config.SERVICE_NAME, "overlay-vip-0-server", 4044 ) host_endpoints_result = sdk_networks.get_endpoint( config.PACKAGE_NAME, config.SERVICE_NAME, "host-vip" ) assert "address" in host_endpoints_result.keys(), ( "overlay endpoints missing 'address'" "{}".format(host_endpoints_result) ) assert len(host_endpoints_result["address"]) == 1 assert host_endpoints_result["address"][0].startswith("10") host_port = host_endpoints_result["address"][0].split(":")[-1] assert host_port == "4044" assert "dns" in host_endpoints_result.keys() assert len(host_endpoints_result["dns"]) == 1 assert host_endpoints_result["dns"][0] == sdk_hosts.autoip_host( config.SERVICE_NAME, "host-vip-0-server", 4044 )
def test_overlay_network(): """Verify that the current deploy plan matches the expected plan from the spec.""" deployment_plan = sdk_plan.wait_for_completed_deployment(config.SERVICE_NAME) log.info("deployment_plan: " + str(deployment_plan)) # test that the deployment plan is correct assert(len(deployment_plan['phases']) == 5) assert(deployment_plan['phases'][0]['name'] == 'hello-overlay-deploy') assert(deployment_plan['phases'][1]['name'] == 'hello-overlay-vip-deploy') assert(deployment_plan['phases'][2]['name'] == 'hello-host-vip-deploy') assert(deployment_plan['phases'][3]['name'] == 'hello-host-deploy') assert(deployment_plan["phases"][4]["name"] == "getter-deploy") assert(len(deployment_plan['phases'][0]['steps']) == 1) assert(len(deployment_plan["phases"][1]["steps"]) == 1) assert(len(deployment_plan["phases"][2]["steps"]) == 1) assert(len(deployment_plan["phases"][3]["steps"]) == 1) assert(len(deployment_plan["phases"][4]["steps"]) == 1) # Due to DNS resolution flakiness, some of the deployed tasks can fail. If so, # we wait for them to redeploy, but if they don't fail we still want to proceed. try: sdk_plan.wait_for_in_progress_recovery(config.SERVICE_NAME, timeout_seconds=60) sdk_plan.wait_for_completed_recovery(config.SERVICE_NAME, timeout_seconds=60) except TimeoutExpired: pass # test that the tasks are all up, which tests the overlay DNS framework_tasks = [task for task in shakedown.get_service_tasks(config.SERVICE_NAME, completed=False)] framework_task_names = [t["name"] for t in framework_tasks] for expected_task in EXPECTED_TASKS: assert(expected_task in framework_task_names), "Missing {expected}".format(expected=expected_task) for task in framework_tasks: name = task["name"] if "getter" in name: # don't check the "getter" tasks because they don't use ports continue resources = task["resources"] if "host" in name: assert "ports" in resources.keys(), "Task {} should have port resources".format(name) if "overlay" in name: assert "ports" not in resources.keys(), "Task {} should NOT have port resources".format(name) sdk_networks.check_task_network("hello-overlay-0-server") sdk_networks.check_task_network("hello-overlay-vip-0-server") sdk_networks.check_task_network("hello-host-0-server", expected_network_name=None) sdk_networks.check_task_network("hello-host-vip-0-server", expected_network_name=None) endpoints_result = sdk_cmd.svc_cli(config.PACKAGE_NAME, config.SERVICE_NAME, 'endpoints', json=True) assert len(endpoints_result) == 2, "Wrong number of endpoints got {} should be 2".format(len(endpoints_result)) overlay_endpoints_result = sdk_cmd.svc_cli(config.PACKAGE_NAME, config.SERVICE_NAME, 'endpoints overlay-vip', json=True) assert "address" in overlay_endpoints_result.keys(), "overlay endpoints missing 'address'"\ "{}".format(overlay_endpoints_result) assert len(overlay_endpoints_result["address"]) == 1 assert overlay_endpoints_result["address"][0].startswith("9") overlay_port = overlay_endpoints_result["address"][0].split(":")[-1] assert overlay_port == "4044" assert "dns" in overlay_endpoints_result.keys() assert len(overlay_endpoints_result["dns"]) == 1 assert overlay_endpoints_result["dns"][0] == sdk_hosts.autoip_host(config.SERVICE_NAME, "hello-overlay-vip-0-server", 4044) host_endpoints_result = sdk_cmd.svc_cli(config.PACKAGE_NAME, config.SERVICE_NAME, 'endpoints host-vip', json=True) assert "address" in host_endpoints_result.keys(), "overlay endpoints missing 'address'"\ "{}".format(host_endpoints_result) assert len(host_endpoints_result["address"]) == 1 assert host_endpoints_result["address"][0].startswith("10") host_port = host_endpoints_result["address"][0].split(":")[-1] assert host_port == "4044" assert "dns" in host_endpoints_result.keys() assert len(host_endpoints_result["dns"]) == 1 assert host_endpoints_result["dns"][0] == sdk_hosts.autoip_host(config.SERVICE_NAME, "hello-host-vip-0-server", 4044)
def test_tasks_on_overlay(): hdfs_tasks = shakedown.shakedown.get_service_task_ids(config.SERVICE_NAME) assert len(hdfs_tasks) == config.DEFAULT_TASK_COUNT, "Not enough tasks got launched,"\ "should be {} got {}".format(len(hdfs_tasks), config.DEFAULT_TASK_COUNT) for task in hdfs_tasks: sdk_networks.check_task_network(task)
def test_service_overlay_health() -> None: tasks = sdk_tasks.check_task_count(config.SERVICE_NAME, config.DEFAULT_TASK_COUNT) for task in tasks: sdk_networks.check_task_network(task.name)
def test_service_overlay_health(): tasks = sdk_tasks.check_task_count(config.SERVICE_NAME, config.DEFAULT_TASK_COUNT) for task in tasks: sdk_networks.check_task_network(task.name)
def test_install(): networks.check_task_network("rabbitmq-0-node")
def test_overlay_network(): """Verify that the current deploy plan matches the expected plan from the spec.""" deployment_plan = sdk_plan.wait_for_completed_deployment( config.SERVICE_NAME) log.info(sdk_plan.plan_string("deploy", deployment_plan)) # test that the tasks are all up, which tests the overlay DNS framework_tasks = sdk_tasks.get_service_tasks(config.SERVICE_NAME) expected_running_tasks = [ "overlay-vip-0-server", "overlay-0-server", "host-vip-0-server", "host-0-server", ] assert set(expected_running_tasks) == set( [t.name for t in framework_tasks]) for task in framework_tasks: name = task.name if name.startswith("host-"): assert "ports" in task.resources.keys( ), "Task {} should have port resources".format(name) sdk_networks.check_task_network(name, expected_network_name=None) elif name.startswith("overlay-"): assert ("ports" not in task.resources.keys() ), "Task {} should NOT have port resources".format(name) sdk_networks.check_task_network(name) else: assert False, "Unknown task {}".format(name) endpoints_result = sdk_networks.get_endpoint_names(config.PACKAGE_NAME, config.SERVICE_NAME) assert len(endpoints_result) == 2, "Expected 2 endpoints, got: {}".format( endpoints_result) overlay_endpoints_result = sdk_networks.get_endpoint( config.PACKAGE_NAME, config.SERVICE_NAME, "overlay-vip") assert ("address" in overlay_endpoints_result.keys() ), "overlay endpoints missing 'address': {}".format( overlay_endpoints_result) assert len(overlay_endpoints_result["address"]) == 1 assert overlay_endpoints_result["address"][0].startswith("9") overlay_port = overlay_endpoints_result["address"][0].split(":")[-1] assert overlay_port == "4044" assert "dns" in overlay_endpoints_result.keys() assert len(overlay_endpoints_result["dns"]) == 1 assert overlay_endpoints_result["dns"][0] == sdk_hosts.autoip_host( config.SERVICE_NAME, "overlay-vip-0-server", 4044) host_endpoints_result = sdk_networks.get_endpoint(config.PACKAGE_NAME, config.SERVICE_NAME, "host-vip") assert ( "address" in host_endpoints_result.keys() ), "overlay endpoints missing 'address'" "{}".format(host_endpoints_result) assert len(host_endpoints_result["address"]) == 1 assert host_endpoints_result["address"][0].startswith("10") host_port = host_endpoints_result["address"][0].split(":")[-1] assert host_port == "4044" assert "dns" in host_endpoints_result.keys() assert len(host_endpoints_result["dns"]) == 1 assert host_endpoints_result["dns"][0] == sdk_hosts.autoip_host( config.SERVICE_NAME, "host-vip-0-server", 4044)
def test_install(): sdk_networks.check_task_network("consul-0-node")
def test_install(): sdk_networks.check_task_network("scale-0-node")
def test_tasks_on_overlay(): hdfs_tasks = shakedown.shakedown.get_service_task_ids(PACKAGE_NAME) assert len(hdfs_tasks) == DEFAULT_TASK_COUNT, "Not enough tasks got launched,"\ "should be {} got {}".format(len(hdfs_tasks), DEFAULT_TASK_COUNT) for task in hdfs_tasks: sdk_networks.check_task_network(task)
def test_overlay_network(): """Verify that the current deploy plan matches the expected plan from the spec.""" deployment_plan = sdk_plan.wait_for_completed_deployment( config.SERVICE_NAME) log.info("deployment_plan: " + str(deployment_plan)) # test that the deployment plan is correct assert (len(deployment_plan['phases']) == 5) assert (deployment_plan['phases'][0]['name'] == 'hello-overlay-deploy') assert (deployment_plan['phases'][1]['name'] == 'hello-overlay-vip-deploy') assert (deployment_plan['phases'][2]['name'] == 'hello-host-vip-deploy') assert (deployment_plan['phases'][3]['name'] == 'hello-host-deploy') assert (deployment_plan["phases"][4]["name"] == "getter-deploy") assert (len(deployment_plan['phases'][0]['steps']) == 1) assert (len(deployment_plan["phases"][1]["steps"]) == 1) assert (len(deployment_plan["phases"][2]["steps"]) == 1) assert (len(deployment_plan["phases"][3]["steps"]) == 1) assert (len(deployment_plan["phases"][4]["steps"]) == 1) # Due to DNS resolution flakiness, some of the deployed tasks can fail. If so, # we wait for them to redeploy, but if they don't fail we still want to proceed. try: sdk_plan.wait_for_in_progress_recovery(config.SERVICE_NAME, timeout_seconds=60) sdk_plan.wait_for_completed_recovery(config.SERVICE_NAME, timeout_seconds=60) except retrying.RetryError: pass # test that the tasks are all up, which tests the overlay DNS framework_tasks = [ task for task in shakedown.get_service_tasks(config.SERVICE_NAME, completed=False) ] framework_task_names = [t["name"] for t in framework_tasks] for expected_task in EXPECTED_TASKS: assert (expected_task in framework_task_names), "Missing {expected}".format( expected=expected_task) for task in framework_tasks: name = task["name"] if "getter" in name: # don't check the "getter" tasks because they don't use ports continue resources = task["resources"] if "host" in name: assert "ports" in resources.keys( ), "Task {} should have port resources".format(name) if "overlay" in name: assert "ports" not in resources.keys( ), "Task {} should NOT have port resources".format(name) sdk_networks.check_task_network("hello-overlay-0-server") sdk_networks.check_task_network("hello-overlay-vip-0-server") sdk_networks.check_task_network("hello-host-0-server", expected_network_name=None) sdk_networks.check_task_network("hello-host-vip-0-server", expected_network_name=None) endpoints_result = sdk_cmd.svc_cli(config.PACKAGE_NAME, config.SERVICE_NAME, 'endpoints', json=True) assert len(endpoints_result ) == 2, "Wrong number of endpoints got {} should be 2".format( len(endpoints_result)) overlay_endpoints_result = sdk_cmd.svc_cli(config.PACKAGE_NAME, config.SERVICE_NAME, 'endpoints overlay-vip', json=True) assert "address" in overlay_endpoints_result.keys(), "overlay endpoints missing 'address'"\ "{}".format(overlay_endpoints_result) assert len(overlay_endpoints_result["address"]) == 1 assert overlay_endpoints_result["address"][0].startswith("9") overlay_port = overlay_endpoints_result["address"][0].split(":")[-1] assert overlay_port == "4044" assert "dns" in overlay_endpoints_result.keys() assert len(overlay_endpoints_result["dns"]) == 1 assert overlay_endpoints_result["dns"][0] == sdk_hosts.autoip_host( config.SERVICE_NAME, "hello-overlay-vip-0-server", 4044) host_endpoints_result = sdk_cmd.svc_cli(config.PACKAGE_NAME, config.SERVICE_NAME, 'endpoints host-vip', json=True) assert "address" in host_endpoints_result.keys(), "overlay endpoints missing 'address'"\ "{}".format(host_endpoints_result) assert len(host_endpoints_result["address"]) == 1 assert host_endpoints_result["address"][0].startswith("10") host_port = host_endpoints_result["address"][0].split(":")[-1] assert host_port == "4044" assert "dns" in host_endpoints_result.keys() assert len(host_endpoints_result["dns"]) == 1 assert host_endpoints_result["dns"][0] == sdk_hosts.autoip_host( config.SERVICE_NAME, "hello-host-vip-0-server", 4044)
def test_install(): networks.check_task_network("template-0-node")
def test_tasks_on_overlay(): elastic_tasks = shakedown.get_service_task_ids(PACKAGE_NAME) assert len(elastic_tasks) == DEFAULT_TASK_COUNT, \ "Incorrect number of tasks should be {} got {}".format(DEFAULT_TASK_COUNT, len(elastic_tasks)) for task in elastic_tasks: networks.check_task_network(task)
def test_overlay_network(): """Verify that the current deploy plan matches the expected plan from the spec.""" deployment_plan = plan.wait_for_completed_deployment(PACKAGE_NAME) utils.out("deployment_plan: " + str(deployment_plan)) # test that the deployment plan is correct assert (len(deployment_plan['phases']) == 5) assert (deployment_plan['phases'][0]['name'] == 'hello-overlay-vip-deploy') assert (deployment_plan['phases'][1]['name'] == 'hello-overlay-deploy') assert (deployment_plan['phases'][2]['name'] == 'hello-host-vip-deploy') assert (deployment_plan['phases'][3]['name'] == 'hello-host-deploy') assert (deployment_plan["phases"][4]["name"] == "getter-deploy") assert (len(deployment_plan['phases'][0]['steps']) == 1) assert (len(deployment_plan["phases"][1]["steps"]) == 1) assert (len(deployment_plan["phases"][2]["steps"]) == 1) assert (len(deployment_plan["phases"][3]["steps"]) == 1) assert (len(deployment_plan["phases"][4]["steps"]) == 4) # test that the tasks are all up, which tests the overlay DNS framework_tasks = [ task for task in shakedown.get_service_tasks(PACKAGE_NAME, completed=False) ] framework_task_names = [t["name"] for t in framework_tasks] expected_tasks = [ 'getter-0-get-host', 'getter-0-get-overlay', 'getter-0-get-overlay-vip', 'getter-0-get-host-vip', 'hello-host-vip-0-server', 'hello-overlay-vip-0-server', 'hello-host-0-server', 'hello-overlay-0-server' ] for expected_task in expected_tasks: assert (expected_task in framework_task_names), "Missing {expected}".format( expected=expected_task) for task in framework_tasks: name = task["name"] if "getter" in name: # don't check the "getter" tasks because they don't use ports continue resources = task["resources"] if "host" in name: assert "ports" in resources.keys( ), "Task {} should have port resources".format(name) if "overlay" in name: assert "ports" not in resources.keys( ), "Task {} should NOT have port resources".format(name) networks.check_task_network("hello-overlay-0-server") networks.check_task_network("hello-overlay-vip-0-server") networks.check_task_network("hello-host-0-server", expected_network_name=None) networks.check_task_network("hello-host-vip-0-server", expected_network_name=None) endpoints_result, _, rc = shakedown.run_dcos_command( "{pkg} endpoints".format(pkg=PACKAGE_NAME)) endpoints_result = json.loads(endpoints_result) assert rc == 0, "Getting endpoints failed" assert len(endpoints_result ) == 2, "Wrong number of endpoints got {} should be 2".format( len(endpoints_result)) overlay_endpoints_result, _, rc = shakedown.run_dcos_command( "{pkg} endpoints overlay-vip".format(pkg=PACKAGE_NAME)) assert rc == 0, "Getting overlay endpoints failed" overlay_endpoints_result = json.loads(overlay_endpoints_result) assert "address" in overlay_endpoints_result.keys(), "overlay endpoints missing 'address'"\ "{}".format(overlay_endpoints_result) assert len(overlay_endpoints_result["address"]) == 1 assert overlay_endpoints_result["address"][0].startswith("9") overlay_port = overlay_endpoints_result["address"][0].split(":")[-1] assert overlay_port == "4044" assert "dns" in overlay_endpoints_result.keys() assert len(overlay_endpoints_result["dns"]) == 1 assert overlay_endpoints_result["dns"][0] == hosts.autoip_host( PACKAGE_NAME, "hello-overlay-vip-0-server", 4044) host_endpoints_result, _, rc = shakedown.run_dcos_command( "{pkg} endpoints host-vip".format(pkg=PACKAGE_NAME)) assert rc == 0, "Getting host endpoints failed" host_endpoints_result = json.loads(host_endpoints_result) assert "address" in host_endpoints_result.keys(), "overlay endpoints missing 'address'"\ "{}".format(host_endpoints_result) assert len(host_endpoints_result["address"]) == 1 assert host_endpoints_result["address"][0].startswith("10") host_port = host_endpoints_result["address"][0].split(":")[-1] assert host_port == "4044" assert "dns" in host_endpoints_result.keys() assert len(host_endpoints_result["dns"]) == 1 assert host_endpoints_result["dns"][0] == hosts.autoip_host( PACKAGE_NAME, "hello-host-vip-0-server", 4044)
def test_tasks_on_overlay() -> None: tasks = sdk_tasks.check_task_count(config.SERVICE_NAME, config.DEFAULT_TASK_COUNT) for task in tasks: sdk_networks.check_task_network(task.name)