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

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

commit c9a97682065a2cf4ff91e4c268f8e35672c881d0
Author: Marcus Eriksson <[email protected]>
AuthorDate: Thu May 25 09:32:11 2023 +0200

    [CEP-21] Fix bootstrap_test
---
 bootstrap_test.py | 32 +++++++++++++++++++++++---------
 1 file changed, 23 insertions(+), 9 deletions(-)

diff --git a/bootstrap_test.py b/bootstrap_test.py
index 52dc2dfc..c3a0d757 100644
--- a/bootstrap_test.py
+++ b/bootstrap_test.py
@@ -7,6 +7,7 @@ import threading
 import time
 import logging
 import signal
+from distutils.version import LooseVersion
 
 from cassandra import ConsistencyLevel
 from cassandra.concurrent import execute_concurrent_with_args
@@ -291,13 +292,10 @@ class BootstrapTester(Tester):
 
     def 
test_consistent_range_movement_true_with_replica_down_should_fail(self):
         self._bootstrap_test_with_replica_down(True)
-
     def 
test_consistent_range_movement_false_with_replica_down_should_succeed(self):
         self._bootstrap_test_with_replica_down(False)
-
     def test_consistent_range_movement_true_with_rf1_should_fail(self):
         self._bootstrap_test_with_replica_down(True, rf=1)
-
     def test_consistent_range_movement_false_with_rf1_should_succeed(self):
         self._bootstrap_test_with_replica_down(False, rf=1)
 
@@ -319,7 +317,10 @@ class BootstrapTester(Tester):
         if cluster.version() >= '4.0':
             warning = 'Your replication factor 3 for keyspace k is higher than 
the number of nodes 1 for datacenter dc1'
             assert len(node1.grep_log(warning)) == 1
-            assert len(node2.grep_log(warning)) == 0
+            if cluster.version() >= LooseVersion('5.1'):
+                assert len(node2.grep_log(warning)) == 1  # we now log this on 
all nodes
+            else:
+                assert len(node2.grep_log(warning)) == 0
 
         session.execute("ALTER KEYSPACE k WITH REPLICATION = {'class' : 
'NetworkTopologyStrategy', 'dc1' : '2'}")
         session.execute("CREATE TABLE k.testgtrfmultidc (KEY text PRIMARY 
KEY)")
@@ -328,7 +329,10 @@ class BootstrapTester(Tester):
         if cluster.version() >= '4.0':
             warning = 'Your replication factor 2 for keyspace k is higher than 
the number of nodes 1 for datacenter dc1'
             assert len(node1.grep_log(warning)) == 1
-            assert len(node2.grep_log(warning)) == 0
+            if cluster.version() >= LooseVersion('5.1'):
+                assert len(node2.grep_log(warning)) == 1  # we now log this on 
all nodes
+            else:
+                assert len(node2.grep_log(warning)) == 0
 
         marks = map(lambda n: n.mark_log(), cluster.nodelist())
         node3 = Node(name='node3',
@@ -390,8 +394,13 @@ class BootstrapTester(Tester):
         successful_bootstrap_expected = not consistent_range_movement
 
         node3 = new_node(cluster, token=node3_token)
-        node3.start(wait_for_binary_proto=successful_bootstrap_expected, 
wait_other_notice=successful_bootstrap_expected,
-                    
jvm_args=["-Dcassandra.consistent.rangemovement={}".format(consistent_range_movement)])
+
+        jvmargs = 
["-Dcassandra.consistent.rangemovement={}".format(consistent_range_movement)]
+        if cluster.version() >= LooseVersion('5.1'):
+            
node3.set_configuration_options(values={'progress_barrier_min_consistency_level':
 'NODE_LOCAL', 'progress_barrier_default_consistency_level': 'NODE_LOCAL', 
'progress_barrier_timeout': '2000ms'})
+        node3.start(wait_for_binary_proto=successful_bootstrap_expected,
+                    wait_other_notice=successful_bootstrap_expected,
+                    jvm_args=jvmargs)
 
         if successful_bootstrap_expected:
             # with rf=1 and cassandra.consistent.rangemovement=false, missing 
sources are ignored
@@ -729,7 +738,7 @@ class BootstrapTester(Tester):
 
         # Add a new node, bootstrap=True ensures that it is not a seed
         node2 = new_node(cluster, bootstrap=True)
-
+        mark = node1.mark_log()
         # kill node2 in the middle of bootstrap
         t = KillOnBootstrap(node2)
         t.start()
@@ -740,6 +749,9 @@ class BootstrapTester(Tester):
 
         # wipe any data for node2
         self._cleanup(node2)
+        if cluster.version() >= LooseVersion('5.1'):
+            node1.watch_log_for("127.0.0.2:7000 is now DOWN", from_mark=mark)
+            res = node1.nodetool('abortbootstrap --ip 127.0.0.2')
         # Now start it again, it should be allowed to join
         mark = node2.mark_log()
         node2.start()
@@ -830,7 +842,9 @@ class BootstrapTester(Tester):
         assert not blind_replacement_node.is_running()
 
 
-    @since('2.1.1')
+    # this test relies on startup of .2 being slow, allowing .3 to start 
before .2 has finished joining
+    # with tcm this is much quicker, and this is now covered by better tests
+    @since('2.1.1', max_version='5.0.x')
     def test_simultaneous_bootstrap(self):
         """
         Attempt to bootstrap two nodes at once, to assert the second 
bootstrapped node fails, and does not interfere.


---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to