Skip to content

Commit

Permalink
Refactor jmx port
Browse files Browse the repository at this point in the history
  • Loading branch information
AlexandreYang committed Feb 23, 2020
1 parent 665dc11 commit 14d8dfc
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 5 deletions.
2 changes: 2 additions & 0 deletions activemq/tests/common.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,8 @@
HERE = get_here()
HOST = get_docker_hostname()

JMX_PORT = 1616

TEST_QUEUES = ('FOO_QUEUE', 'TEST_QUEUE')
TEST_TOPICS = ('FOO_TOPIC', 'TEST_TOPIC')
TEST_MESSAGE = {'body': 'test_message'}
Expand Down
7 changes: 3 additions & 4 deletions activemq/tests/compose/docker-compose.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -6,12 +6,11 @@ services:
container_name: dd-test-activemq-server
environment:
ACTIVEMQ_SUNJMX_START: >-
-Dcom.sun.management.jmxremote.port=1616
-Dcom.sun.management.jmxremote.rmi.port=1616
-Dcom.sun.management.jmxremote.port=${JMX_PORT}
-Dcom.sun.management.jmxremote.rmi.port=${JMX_PORT}
-Dcom.sun.management.jmxremote.ssl=false
-Dcom.sun.management.jmxremote.authenticate=false
-Djava.rmi.server.hostname=localhost
ports:
- "61616:61616"
- "8161:8161"
- "1616:1616"
- "${JMX_PORT}:${JMX_PORT}"
4 changes: 3 additions & 1 deletion activemq/tests/conftest.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@
from datadog_checks.dev.conditions import WaitForPortListening
from datadog_checks.dev.utils import load_jmx_config

from .common import BASE_URL, HERE, HOST, TEST_AUTH, TEST_MESSAGE, TEST_PORT, TEST_QUEUES, TEST_TOPICS
from .common import BASE_URL, HERE, HOST, TEST_AUTH, TEST_MESSAGE, TEST_PORT, TEST_QUEUES, TEST_TOPICS, JMX_PORT


def populate_server():
Expand All @@ -30,9 +30,11 @@ def populate_server():

@pytest.fixture(scope="session")
def dd_environment():
envs = {'JMX_PORT': str(JMX_PORT)}
with docker_run(
os.path.join(HERE, 'compose', 'docker-compose.yaml'),
log_patterns=['ActiveMQ Jolokia REST API available'],
conditions=[WaitForPortListening(HOST, TEST_PORT), populate_server],
env_vars=envs
):
yield load_jmx_config(), {'use_jmx': True}

0 comments on commit 14d8dfc

Please sign in to comment.