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 2021/03/26 13:35:33 UTC

[cassandra-dtest] branch trunk updated: simplify/harden GPFS test

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 f9c3d78  simplify/harden GPFS test
f9c3d78 is described below

commit f9c3d78b7845b7dd87f49fedd7287281041aac76
Author: Brandon Williams <br...@apache.org>
AuthorDate: Wed Mar 17 15:42:59 2021 -0500

    simplify/harden GPFS test
    
    Patch by brandonwilliams, reviewed by edimitrova for CASSANDRA-13196
---
 snitch_test.py | 66 ++++++++++++++--------------------------------------------
 1 file changed, 16 insertions(+), 50 deletions(-)

diff --git a/snitch_test.py b/snitch_test.py
index ec66ed0..6fc75cb 100644
--- a/snitch_test.py
+++ b/snitch_test.py
@@ -3,6 +3,7 @@ import socket
 import time
 import pytest
 import logging
+import re
 
 from cassandra import ConsistencyLevel
 from dtest import Tester
@@ -37,27 +38,9 @@ class TestGossipingPropertyFileSnitch(Tester):
         NODE1_LISTEN_ADDRESS = '127.0.0.1'
         NODE1_BROADCAST_ADDRESS = '127.0.0.3'
 
-        NODE1_LISTEN_FMT_ADDRESS = '/127.0.0.1'
-        NODE1_BROADCAST_FMT_ADDRESS = '/127.0.0.3'
-
-        NODE1_40_LISTEN_ADDRESS = '127.0.0.1:7000'
-        NODE1_40_BROADCAST_ADDRESS = '127.0.0.3:7000'
-
-        NODE1_40_LISTEN_FMT_ADDRESS = '/127.0.0.1:7000'
-        NODE1_40_BROADCAST_FMT_ADDRESS = '/127.0.0.3:7000'
-
         NODE2_LISTEN_ADDRESS = '127.0.0.2'
         NODE2_BROADCAST_ADDRESS = '127.0.0.4'
 
-        NODE2_LISTEN_FMT_ADDRESS = '/127.0.0.2'
-        NODE2_BROADCAST_FMT_ADDRESS = '/127.0.0.4'
-
-        NODE2_40_LISTEN_ADDRESS = '127.0.0.2:7000'
-        NODE2_40_BROADCAST_ADDRESS = '127.0.0.4:7000'
-
-        NODE2_40_LISTEN_FMT_ADDRESS = '/127.0.0.2:7000'
-        NODE2_40_BROADCAST_FMT_ADDRESS = '/127.0.0.4:7000'
-
         STORAGE_PORT = 7000
 
         cluster = self.cluster
@@ -80,12 +63,6 @@ class TestGossipingPropertyFileSnitch(Tester):
                 snitch_file.write("prefer_local=true" + os.linesep)
 
         node1.start(wait_for_binary_proto=True)
-        if running40:
-            node1.watch_log_for("Listening on address: \({}:{}\)".format(NODE1_40_LISTEN_FMT_ADDRESS[:-5], STORAGE_PORT), timeout=60)
-            node1.watch_log_for("Listening on address: \({}:{}\)".format(NODE1_40_BROADCAST_FMT_ADDRESS[:-5], STORAGE_PORT), timeout=60)
-        else:
-            node1.watch_log_for("Starting Messaging Service on {}:{}".format(NODE1_LISTEN_FMT_ADDRESS, STORAGE_PORT), timeout=60)
-            node1.watch_log_for("Starting Messaging Service on {}:{}".format(NODE1_BROADCAST_FMT_ADDRESS, STORAGE_PORT), timeout=60)
 
         self._test_connect(NODE1_LISTEN_ADDRESS, STORAGE_PORT)
         self._test_connect(NODE1_BROADCAST_ADDRESS, STORAGE_PORT)
@@ -98,55 +75,44 @@ class TestGossipingPropertyFileSnitch(Tester):
         original_rows = list(session.execute("SELECT * FROM {}".format(stress_table)))
 
         node2.start(wait_for_binary_proto=True, wait_other_notice=False)
-        if running40:
-            node2.watch_log_for("Listening on address: \({}:{}\)".format(NODE2_40_LISTEN_FMT_ADDRESS[:-5], STORAGE_PORT), timeout=60)
-            node2.watch_log_for("Listening on address: \({}:{}\)".format(NODE2_40_BROADCAST_FMT_ADDRESS[:-5], STORAGE_PORT), timeout=60)
-        else:
-            node2.watch_log_for("Starting Messaging Service on {}:{}".format(NODE2_LISTEN_FMT_ADDRESS, STORAGE_PORT), timeout=60)
-            node2.watch_log_for("Starting Messaging Service on {}:{}".format(NODE2_BROADCAST_FMT_ADDRESS, STORAGE_PORT), timeout=60)
 
         self._test_connect(NODE2_LISTEN_ADDRESS, STORAGE_PORT)
         self._test_connect(NODE2_BROADCAST_ADDRESS, STORAGE_PORT)
 
-        # Intiated -> Initiated typo was fixed in 3.10
-        reconnectFmtString = "Ini?tiated reconnect to an Internal IP {} for the {}"
-        if node1.get_base_cassandra_version() >= 3.10:
-            reconnectFmtString = "Initiated reconnect to an Internal IP {} for the {}"
-        node1.watch_log_for(reconnectFmtString.format(NODE2_40_LISTEN_FMT_ADDRESS if running40 else NODE2_LISTEN_FMT_ADDRESS,
-                                               NODE2_40_BROADCAST_FMT_ADDRESS if running40 else NODE2_BROADCAST_FMT_ADDRESS), filename='debug.log', timeout=60)
-        node2.watch_log_for(reconnectFmtString.format(NODE1_40_LISTEN_FMT_ADDRESS if running40 else NODE1_LISTEN_FMT_ADDRESS,
-                                               NODE1_40_BROADCAST_FMT_ADDRESS if running40 else NODE1_BROADCAST_FMT_ADDRESS), filename='debug.log', timeout=60)
+        # substring for Intiated -> Initiated typo was fixed in 3.10
+        matchn1 = 'tiated reconnect to an Internal IP (\/)?{}(:7000)? for the (\/)?{}(:7000)?'.format(NODE1_LISTEN_ADDRESS, NODE1_BROADCAST_ADDRESS)
+        matchn2 = 'tiated reconnect to an Internal IP (\/)?{}(:7000)? for the (\/)?{}(:7000)?'.format(NODE2_LISTEN_ADDRESS, NODE2_BROADCAST_ADDRESS)
+        node1.watch_log_for(matchn2, filename='debug.log', timeout=60)
+        node2.watch_log_for(matchn1, filename='debug.log', timeout=60)
 
         # read data from node2 just to make sure data and connectivity is OK
         session = self.patient_exclusive_cql_connection(node2)
         new_rows = list(session.execute("SELECT * FROM {}".format(stress_table)))
         assert original_rows == new_rows
 
+        ipstr = "INTERNAL_IP:.+:{}"
+        if cluster.version() >= '4':
+            ipstr = "INTERNAL_ADDRESS_AND_PORT:.+:{}"
+
         out, err, _ = node1.nodetool('gossipinfo')
         assert_stderr_clean(err)
         logger.debug(out)
 
         assert "/{}".format(NODE1_BROADCAST_ADDRESS) in out
-        assert "INTERNAL_IP:{}:{}".format('10' if running40 else '7', NODE1_LISTEN_ADDRESS) in out
         assert "/{}".format(NODE2_BROADCAST_ADDRESS) in out
-        if running40:
-            assert "INTERNAL_ADDRESS_AND_PORT:8:{}".format(NODE1_40_LISTEN_ADDRESS) in out
-            assert "INTERNAL_ADDRESS_AND_PORT:8:{}".format(NODE2_40_LISTEN_ADDRESS) in out
-        else:
-            assert "INTERNAL_IP:{}:{}".format('7', NODE2_LISTEN_ADDRESS) in out
+        
+        assert re.search(ipstr.format(NODE1_LISTEN_ADDRESS), out)
+        assert re.search(ipstr.format(NODE2_LISTEN_ADDRESS), out)
 
         out, err, _ = node2.nodetool('gossipinfo')
         assert_stderr_clean(err)
         logger.debug(out)
 
         assert "/{}".format(NODE1_BROADCAST_ADDRESS) in out
-        assert "INTERNAL_IP:{}:{}".format('10' if running40 else '7', NODE2_LISTEN_ADDRESS) in out
         assert "/{}".format(NODE2_BROADCAST_ADDRESS) in out
-        if running40:
-            assert "INTERNAL_ADDRESS_AND_PORT:8:{}".format(NODE1_40_LISTEN_ADDRESS) in out
-            assert "INTERNAL_ADDRESS_AND_PORT:8:{}".format(NODE2_40_LISTEN_ADDRESS) in out
-        else:
-            assert "INTERNAL_IP:{}:{}".format('7', NODE1_LISTEN_ADDRESS) in out
+        
+        assert re.search(ipstr.format(NODE1_LISTEN_ADDRESS), out)
+        assert re.search(ipstr.format(NODE2_LISTEN_ADDRESS), out)
 
 class TestDynamicEndpointSnitch(Tester):
     @pytest.mark.resource_intensive

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