Skip to content

Commit

Permalink
[DCOS-48462][Cassandra] Honor config JMX_PORT (#2927)
Browse files Browse the repository at this point in the history
Apache Cassandra 3.11+ adds in new logic and classes for parsing the JMX_PORT from cassandra-env.sh which is hardcoded to 7199. This commit replaces the value in the file with the user-specified framework config
  • Loading branch information
samvantran committed Feb 19, 2019
1 parent 2451635 commit 03476ec
Show file tree
Hide file tree
Showing 2 changed files with 28 additions and 0 deletions.
3 changes: 3 additions & 0 deletions frameworks/cassandra/src/main/dist/svc.yml
Original file line number Diff line number Diff line change
Expand Up @@ -66,6 +66,9 @@ pods:
ARGS="$ARGS -R"
fi
# Honor jmx_port config otherwise Cassandra will hardcode to 7199
sed -i 's/JMX_PORT=.*/JMX_PORT="{{TASKCFG_ALL_JMX_PORT}}"/' apache-cassandra-{{CASSANDRA_VERSION}}/conf/cassandra-env.sh
exec ./apache-cassandra-{{CASSANDRA_VERSION}}/bin/cassandra $ARGS
configs:
cassandra:
Expand Down
25 changes: 25 additions & 0 deletions frameworks/cassandra/tests/test_sanity.py
Original file line number Diff line number Diff line change
@@ -1,12 +1,15 @@
import pytest
import logging

import sdk_cmd
import sdk_hosts
import sdk_install
import sdk_jobs
import sdk_metrics
import sdk_networks
import sdk_plan
import sdk_service
import sdk_tasks
import sdk_upgrade

from tests import config
Expand Down Expand Up @@ -96,3 +99,25 @@ def expected_metrics_exist(emitted_metrics):
config.DEFAULT_CASSANDRA_TIMEOUT,
expected_metrics_exist,
)


@pytest.mark.sanity
def test_custom_jmx_port():
expected_open_port = ":7200 (LISTEN)"

new_config = {"cassandra": {"jmx_port": 7200}}

sdk_service.update_configuration(
config.PACKAGE_NAME,
config.get_foldered_service_name(),
new_config,
config.DEFAULT_TASK_COUNT,
)

sdk_plan.wait_for_completed_deployment(config.get_foldered_service_name())

tasks = sdk_tasks.get_service_tasks(config.get_foldered_service_name(), "node")

for task in tasks:
_, stdout, _ = sdk_cmd.run_cli("task exec {} lsof -i :7200".format(task.id))
assert expected_open_port in stdout

0 comments on commit 03476ec

Please sign in to comment.