Skip to content
Permalink
Browse files
Test both ipv4 and v6 with nodetool
Patch by brandonwilliams; reviwed by bereng for CASSANDRA-17581
  • Loading branch information
driftx committed May 5, 2022
1 parent be48c41 commit e672b4804d4b0dd4b1ba02b916fe700315759448
Showing 1 changed file with 27 additions and 0 deletions.
@@ -522,3 +522,30 @@ def nodetool(node):
out, err, _ = nodetool(node2)
assert_stderr_clean(err)
assert warning not in out

def test_ipv4_ipv6_host(self):
"""
Test that both ipv4 and ipv6 hosts are accepted by nodetool
"""
cluster = self.cluster
cluster.populate(1)
cluster.start()

node = cluster.nodelist()[0]
tool = node.get_tool('nodetool')
env = node.get_env()

def nodetool(host):
cmd = [tool, '-h', host, '-p', str(node.jmx_port), 'status']
p = subprocess.Popen(cmd, env=env, stdout=subprocess.PIPE, stderr=subprocess.PIPE, universal_newlines=True)
return ccmlib.node.handle_external_tool_process(p, cmd)

# ipv4 should work
nodetool('127.0.0.1')
# if ipv6 fails, make sure the reason is valid
try:
nodetool('::1')
except ToolError as e:
assert any(reason in e.stderr for reason in ("Connection refused", "Protocol family unavailable"))


0 comments on commit e672b48

Please sign in to comment.