You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@cassandra.apache.org by br...@apache.org on 2022/05/05 11:03:50 UTC

[cassandra-dtest] branch trunk updated: Test both ipv4 and v6 with nodetool

This is an automated email from the ASF dual-hosted git repository.

brandonwilliams pushed a commit to branch trunk
in repository https://gitbox.apache.org/repos/asf/cassandra-dtest.git


The following commit(s) were added to refs/heads/trunk by this push:
     new e672b480 Test both ipv4 and v6 with nodetool
e672b480 is described below

commit e672b4804d4b0dd4b1ba02b916fe700315759448
Author: Brandon Williams <br...@apache.org>
AuthorDate: Wed May 4 11:51:58 2022 -0500

    Test both ipv4 and v6 with nodetool
    
    Patch by brandonwilliams; reviwed by bereng for CASSANDRA-17581
---
 nodetool_test.py | 27 +++++++++++++++++++++++++++
 1 file changed, 27 insertions(+)

diff --git a/nodetool_test.py b/nodetool_test.py
index 05ed974d..dc141395 100644
--- a/nodetool_test.py
+++ b/nodetool_test.py
@@ -522,3 +522,30 @@ class TestNodetool(Tester):
         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"))
+
+


---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@cassandra.apache.org
For additional commands, e-mail: commits-help@cassandra.apache.org