Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Added integration tests for validating JMX_PORT config #257

Open
wants to merge 4 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions integration/tests/jmx.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
{
"cassandra": {
"jmx_port": 8199
}
}
44 changes: 44 additions & 0 deletions integration/tests/test_sanity.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
import sys
import json
import dcos
import pytest
from . import infinity_commons
import time

import dcos
Expand Down Expand Up @@ -207,6 +209,48 @@ def test_cpus_increase_slightly(install_framework):
assert plan['status'] == infinity_commons.PlanState.COMPLETE.value


@pytest.mark.sanity
def test_jmx_default(install_framework):
try:
result = dcos.http.get(cassandra_api_url('connection/address'))
except:
result = dcos.http.get(cassandra_api_url('nodes/connect/address'))

try:
nodes = result.json()
for node in nodes:
node = node.split(":")[0]
assert is_port_listen(node, "7199")
except:
print('Failed to parse connect response')
raise


@pytest.mark.disabled
def test_jmx_override():
try:
uninstall()
shakedown.install_package_and_wait(package_name=PACKAGE_NAME, options_file=sys.path[0] + "/tests/jmx.json")
check_health()
try:
result = dcos.http.get(cassandra_api_url('connection/address'))
except:
result = dcos.http.get(cassandra_api_url('nodes/connect/address'))

nodes = result.json()
for node in nodes:
node = node.split(":")[0]
assert is_port_listen(node, "8199")
finally:
uninstall()


def is_port_listen(host, port):
"""
Returns True if the netstat -plant | grep <PORT> command exits successfully, False otherwise.
"""
return shakedown.run_command_on_agent(host, "netstat -plant | grep {}".format(port))

@pytest.mark.sanity
def test_is_suppressed(install_framework):
infinity_commons.get_and_verify_plan(lambda p: p['status'] == 'COMPLETE')
Expand Down