Skip to content

Commit

Permalink
Update e2e tests
Browse files Browse the repository at this point in the history
  • Loading branch information
mgarabed committed Feb 5, 2021
1 parent 8010bec commit 90797cc
Show file tree
Hide file tree
Showing 3 changed files with 45 additions and 5 deletions.
27 changes: 27 additions & 0 deletions activemq/tests/common.py
Original file line number Diff line number Diff line change
@@ -1,10 +1,20 @@
# (C) Datadog, Inc. 2019-present
# All rights reserved
# Licensed under a 3-clause BSD style license (see LICENSE)
import os

import pytest

from datadog_checks.dev import get_docker_hostname, get_here

CHECK_NAME = 'activemq'

COMPOSE_FILE = os.getenv('COMPOSE_FILE')
IS_ARTEMIS = COMPOSE_FILE == 'artemis.yaml'

artemis = pytest.mark.skipif(not IS_ARTEMIS, reason='Test only valid for ActiveMQ Artemis versions')
not_artemis = pytest.mark.skipif(IS_ARTEMIS, reason='Test only valid for non-Artemis versions')

HERE = get_here()
HOST = get_docker_hostname()

Expand Down Expand Up @@ -39,3 +49,20 @@
"activemq.broker.temp_pct",
"activemq.broker.memory_pct",
]

ARTEMIS_E2E_METRICS = [
"activemq.artemis.connection_count",
"activemq.artemis.max_disk_usage",
"activemq.artemis.queue.consumer_count",
"activemq.artemis.queue.max_consumers",
"activemq.artemis.queue.message_count",
"activemq.artemis.queue.messages_acknowledged",
"activemq.artemis.queue.messages_added",
"activemq.artemis.queue.messages_expired",
"activemq.artemis.queue.messages_killed",
"activemq.artemis.total_connection_count",
"activemq.artemis.total_consumer_count",
"activemq.artemis.total_message_count",
"activemq.artemis.total_messages_acknowledged",
"activemq.artemis.total_messages_added",
]
5 changes: 2 additions & 3 deletions activemq/tests/conftest.py
Original file line number Diff line number Diff line change
Expand Up @@ -16,8 +16,10 @@
ACTIVEMQ_URL,
ARTEMIS_URL,
BASE_URL,
COMPOSE_FILE,
HERE,
HOST,
IS_ARTEMIS,
JMX_PORT,
TEST_AUTH,
TEST_MESSAGE,
Expand All @@ -26,9 +28,6 @@
TEST_TOPICS,
)

COMPOSE_FILE = os.getenv('COMPOSE_FILE')
IS_ARTEMIS = COMPOSE_FILE == 'artemis.yaml'


def populate_server():
"""Add some queues and topics to ensure more metrics are available."""
Expand Down
18 changes: 16 additions & 2 deletions activemq/tests/test_check.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,11 +7,12 @@
from datadog_checks.dev.jmx import JVM_E2E_METRICS
from datadog_checks.dev.utils import get_metadata_metrics

from .common import ACTIVEMQ_E2E_METRICS
from .common import ACTIVEMQ_E2E_METRICS, ARTEMIS_E2E_METRICS, artemis, not_artemis


@not_artemis
@pytest.mark.e2e
def test(dd_agent_check):
def test_activemq_metrics(dd_agent_check):
instance = {}
aggregator = dd_agent_check(instance)

Expand All @@ -20,3 +21,16 @@ def test(dd_agent_check):

aggregator.assert_all_metrics_covered()
aggregator.assert_metrics_using_metadata(get_metadata_metrics(), exclude=JVM_E2E_METRICS)


@artemis
@pytest.mark.e2e
def test_artemis_metrics(dd_agent_check):
instance = {}
aggregator = dd_agent_check(instance)

for metric in ARTEMIS_E2E_METRICS + JVM_E2E_METRICS:
aggregator.assert_metric(metric)

aggregator.assert_all_metrics_covered()
aggregator.assert_metrics_using_metadata(get_metadata_metrics(), exclude=JVM_E2E_METRICS)

0 comments on commit 90797cc

Please sign in to comment.