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 1 commit
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
}
}
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

missing trailing newline

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Good catch!

44 changes: 43 additions & 1 deletion integration/tests/test_sanity.py
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
import sys
import json
import dcos
import pytest
from . import infinity_commons

import dcos
import shakedown

Expand Down Expand Up @@ -199,3 +199,45 @@ def test_cpus_increase_slightly(install_framework):
print(plan)
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.sanity
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))