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 35d87cf  Test that DCs are validated when repairing
35d87cf is described below

commit 35d87cf231cdcac2beca35b4c474a8451d1cc9f9
Author: Jan Karlsson <jan.karls...@ericsson.com>
AuthorDate: Wed Mar 2 12:00:52 2022 +0100

    Test that DCs are validated when repairing
    
    Patch by Jan Karlsson; reviewed by bereng and brandonwilliams for
    CASSANDRA-17407
---
 repair_tests/repair_test.py | 31 +++++++++++++++++++++++++++++++
 1 file changed, 31 insertions(+)

diff --git a/repair_tests/repair_test.py b/repair_tests/repair_test.py
index c1bd71e..af04e14 100644
--- a/repair_tests/repair_test.py
+++ b/repair_tests/repair_test.py
@@ -708,6 +708,37 @@ class TestRepair(BaseRepairTest):
         else:
             assert len(node1.grep_log('parallelism=PARALLEL')) == 1, 
str(node1.grep_log('parallelism'))
 
+
+    @since('3.11')
+    def test_repair_validates_dc(self):
+        """
+        * Set up a multi DC cluster
+        * Perform a -dc repair with nonexistent dc and without local dc
+        * Assert that the repair is not trigger in both cases
+        """
+        cluster = self._setup_multi_dc()
+        node1 = cluster.nodes["node1"]
+        node2 = cluster.nodes["node2"]
+        node3 = cluster.nodes["node3"]
+
+        opts = ["-dc", "dc1", "-dc", "dc13"]
+        opts += _repair_options(self.cluster.version(), ks="ks", 
sequential=False)
+        # repair should fail because dc13 does not exist
+        try:
+            node1.repair(opts)
+        except Exception as e:
+            nodetool_error = e
+        assert 'data center(s) [dc13] not found' in repr(nodetool_error)
+
+        opts = ["-dc", "dc2", "-dc", "dc3"]
+        opts += _repair_options(self.cluster.version(), ks="ks", 
sequential=False)
+        # repair should fail because local dc not included in repair
+        try:
+            node1.repair(opts)
+        except Exception as e:
+            nodetool_error = e
+        assert 'the local data center must be part of the repair' in 
repr(nodetool_error)
+
     def _setup_multi_dc(self):
         """
         Sets up 3 DCs (2 nodes in 'dc1', and one each in 'dc2' and 'dc3').

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

Reply via email to