def test_new_istio(aggregator, new_mesh_mixture_fixture): check = Istio('istio', {}, {}, [NEW_MOCK_INSTANCE]) check.check(NEW_MOCK_INSTANCE) for metric in MESH_METRICS + NEW_MIXER_METRICS + GALLEY_METRICS + PILOT_METRICS: aggregator.assert_metric(metric) aggregator.assert_all_metrics_covered()
def test_pilot_only_istio(aggregator, new_pilot_fixture): check = Istio(common.CHECK_NAME, {}, [common.NEW_MOCK_PILOT_ONLY_INSTANCE]) check.check(common.NEW_MOCK_PILOT_ONLY_INSTANCE) for metric in common.PILOT_METRICS: aggregator.assert_metric(metric) aggregator.assert_all_metrics_covered()
def test_pilot_only_istio(aggregator, new_pilot_fixture): check = Istio('istio', {}, {}, [NEW_MOCK_PILOT_ONLY_INSTANCE]) check.check(NEW_MOCK_PILOT_ONLY_INSTANCE) for metric in PILOT_METRICS: aggregator.assert_metric(metric) aggregator.assert_all_metrics_covered()
def test_galley_only_istio(aggregator, new_galley_fixture): check = Istio('istio', {}, {}, [NEW_MOCK_GALLEY_ONLY_INSTANCE]) check.check(NEW_MOCK_GALLEY_ONLY_INSTANCE) for metric in GALLEY_METRICS: aggregator.assert_metric(metric) aggregator.assert_all_metrics_covered()
def test_galley_only_istio(aggregator, new_galley_fixture): check = Istio(common.CHECK_NAME, {}, [common.NEW_MOCK_GALLEY_ONLY_INSTANCE]) check.check(common.NEW_MOCK_GALLEY_ONLY_INSTANCE) for metric in common.GALLEY_METRICS: aggregator.assert_metric(metric) _assert_tags_excluded(aggregator, []) aggregator.assert_all_metrics_covered()
def test_new_istio(aggregator, new_mesh_mixture_fixture): check = Istio(common.CHECK_NAME, {}, [common.NEW_MOCK_INSTANCE]) check.check(common.NEW_MOCK_INSTANCE) for metric in (common.MESH_METRICS + common.NEW_MIXER_METRICS + common.GALLEY_METRICS + common.PILOT_METRICS + common.CITADEL_METRICS): aggregator.assert_metric(metric) aggregator.assert_all_metrics_covered()
def test_legacy_pilot_only(aggregator, new_pilot_fixture): check = Istio(common.CHECK_NAME, {}, [common.NEW_MOCK_PILOT_ONLY_INSTANCE]) check.check(common.NEW_MOCK_PILOT_ONLY_INSTANCE) for metric in common.PILOT_METRICS: _assert_metric(aggregator, metric) _assert_tags_excluded(aggregator, []) aggregator.assert_all_metrics_covered()
def test_istio(aggregator, mesh_mixture_fixture): """ Test the full check """ check = Istio(common.CHECK_NAME, {}, [common.MOCK_INSTANCE]) check.check(common.MOCK_INSTANCE) for metric in common.MESH_METRICS + common.MIXER_METRICS: aggregator.assert_metric(metric) aggregator.assert_all_metrics_covered()
def test_istio(aggregator, mesh_mixture_fixture): """ Test the full check """ check = Istio('istio', {}, {}, [MOCK_INSTANCE]) check.check(MOCK_INSTANCE) for metric in MESH_METRICS + MIXER_METRICS: aggregator.assert_metric(metric) aggregator.assert_all_metrics_covered()
def test_istiod(aggregator, istiod_mixture_fixture): """ Test the istiod deployment endpoint for v1.5+ check """ check = Istio('istio', {}, [common.MOCK_ISTIOD_INSTANCE]) check.check(common.MOCK_ISTIOD_INSTANCE) for metric in common.ISTIOD_METRICS: aggregator.assert_metric(metric) aggregator.assert_all_metrics_covered()
def test_istio(aggregator, mesh_mixture_fixture): """ Test the full check """ c = Istio('istio', None, {}, [MOCK_INSTANCE]) c.check(MOCK_INSTANCE) metrics = MESH_METRICS + MIXER_METRICS for metric in metrics: aggregator.assert_metric(metric) assert aggregator.metrics_asserted_pct == 100.0
def test_legacy_mesh(aggregator, mesh_fixture): """ Test the mesh endpoint """ check = Istio(common.CHECK_NAME, {}, [common.MOCK_MESH_INSTANCE]) check.check(common.MOCK_MESH_INSTANCE) for metric in common.MESH_METRICS + common.MESH_METRICS_1_4: _assert_metric(aggregator, metric) _assert_tags_excluded(aggregator, []) aggregator.assert_all_metrics_covered()
def test_legacy_mixer(aggregator, mixture_fixture): """ Test the mixer check """ check = Istio(common.CHECK_NAME, {}, [common.MOCK_MIXTURE_INSTANCE]) check.check(common.MOCK_MIXTURE_INSTANCE) for metric in common.MIXER_METRICS: _assert_metric(aggregator, metric) _assert_tags_excluded(aggregator, []) aggregator.assert_all_metrics_covered()
def test_istio_proxy_mesh(aggregator, istio_proxy_mesh_fixture): """ Test proxy mesh check """ check = Istio(common.CHECK_NAME, {}, [common.MOCK_ISTIO_PROXY_MESH_INSTANCE]) check.check(common.MOCK_ISTIO_PROXY_MESH_INSTANCE) for metric in common.MESH_METRICS + common.MESH_MERICS_1_5: aggregator.assert_metric(metric) _assert_tags_excluded(aggregator, []) aggregator.assert_all_metrics_covered()
def test_legacy_all_endpoints(aggregator, new_mesh_mixture_fixture): # Enabling `send_monotonic_with_gauge` exceeds the default 2000 metric limit # Overriding to collect all expected metrics check = Istio(common.CHECK_NAME, {}, [common.NEW_MOCK_INSTANCE]) check.check(common.NEW_MOCK_INSTANCE) for metric in (common.MESH_METRICS + common.MESH_METRICS_1_4 + common.NEW_MIXER_METRICS + common.GALLEY_METRICS + common.PILOT_METRICS + common.CITADEL_METRICS): _assert_metric(aggregator, metric) _assert_tags_excluded(aggregator, []) aggregator.assert_all_metrics_covered()
def test_istio_proxy_mesh_exclude(aggregator, istio_proxy_mesh_fixture): """ Test proxy mesh check """ exclude_tags = ['destination_app', 'destination_principal'] instance = common.MOCK_ISTIO_PROXY_MESH_INSTANCE instance['exclude_labels'] = exclude_tags check = Istio(common.CHECK_NAME, {}, [instance]) check.check(instance) for metric in common.MESH_METRICS + common.MESH_MERICS_1_5: aggregator.assert_metric(metric) _assert_tags_excluded(aggregator, exclude_tags) aggregator.assert_all_metrics_covered()
def test_version_metadata(datadog_agent, istiod_mixture_fixture): check = Istio(common.CHECK_NAME, {}, [common.MOCK_ISTIOD_INSTANCE]) check.check_id = 'test:123' check.check(common.MOCK_ISTIOD_INSTANCE) # Use version mocked from istiod 1.5 fixture MOCK_VERSION = '1.5.0' major, minor, patch = MOCK_VERSION.split('.') version_metadata = { 'version.scheme': 'semver', 'version.major': major, 'version.minor': minor, 'version.patch': patch, 'version.raw': MOCK_VERSION, } datadog_agent.assert_metadata('test:123', version_metadata)