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 5f725067 Add legacy parsing to
test_deprecated_repair_error_notification
5f725067 is described below
commit 5f725067532589161ae8c5ca60c05782480a452c
Author: Brandon Williams <[email protected]>
AuthorDate: Tue Mar 21 10:15:11 2023 -0500
Add legacy parsing to test_deprecated_repair_error_notification
Patch by brandonwilliams; reviewed by bereng for CASSANDRA-18156
---
dtest.py | 28 ++++++++++++++++------------
repair_tests/deprecated_repair_test.py | 9 +++++----
2 files changed, 21 insertions(+), 16 deletions(-)
diff --git a/dtest.py b/dtest.py
index 1c295ab4..15f0be0b 100644
--- a/dtest.py
+++ b/dtest.py
@@ -520,16 +520,20 @@ def run_scenarios(scenarios, handler,
deferred_exceptions=tuple()):
raise MultiError(errors, tracebacks)
def hack_legacy_parsing(node):
- """ Hack node's shell script for nodetool legacy URL parsing, ala
CASSANDRA-17581 """
- nodetool = os.path.join(node.get_install_dir(), 'bin', 'nodetool')
- with open(nodetool, 'r+') as fd:
- contents = fd.readlines()
- if "legacy" in contents[len(contents)-6]:
- logger.debug("nodetool already hacked")
- elif not contents[len(contents)-5].endswith('\\\n'):
- logger.debug("version does not appear to need hacking")
- else:
- contents.insert(len(contents)-5, "
-Dcom.sun.jndi.rmiURLParsing=legacy \\\n")
- fd.seek(0)
- fd.writelines(contents)
+ """ Hack node's shell script for nodetool legacy URL parsing, ala
CASSANDRA-17581 """
+ if hasattr(node, 'get_install_dir'):
+ nodetool = os.path.join(node.get_install_dir(), 'bin', 'nodetool')
+ else:
+ # assume raw path
+ nodetool = node
+ with open(nodetool, 'r+') as fd:
+ contents = fd.readlines()
+ if "legacy" in contents[len(contents)-6]:
+ logger.debug("nodetool already hacked")
+ elif not contents[len(contents)-5].endswith('\\\n'):
+ logger.debug("version does not appear to need hacking")
+ else:
+ contents.insert(len(contents)-5, "
-Dcom.sun.jndi.rmiURLParsing=legacy \\\n")
+ fd.seek(0)
+ fd.writelines(contents)
diff --git a/repair_tests/deprecated_repair_test.py
b/repair_tests/deprecated_repair_test.py
index 75c770e4..2b0fc0e2 100644
--- a/repair_tests/deprecated_repair_test.py
+++ b/repair_tests/deprecated_repair_test.py
@@ -10,7 +10,7 @@ from ccmlib.common import is_win
from ccmlib.node import handle_external_tool_process, ToolError
import ccmlib.repository
-from dtest import Tester, create_ks, create_cf
+from dtest import Tester, create_ks, create_cf, hack_legacy_parsing
from tools.assertions import assert_length_equal
from tools.data import insert_c1c2
from tools.jmxutils import (JolokiaAgent, make_mbean)
@@ -256,6 +256,7 @@ class TestDeprecatedRepairNotifications(Tester):
logger.debug("Running repair on node1 using legacy nodetool (using
options that will cause failure with error)")
legacy_dirpath = ccmlib.repository.directory_name(legacy_version)
legacy_nodetool_path = os.path.join(legacy_dirpath, "bin", "nodetool")
+ hack_legacy_parsing(legacy_nodetool_path)
repair_env = self.get_legacy_environment(legacy_version,
node_env=node1.get_env())
repair_args = [legacy_nodetool_path, "-h", "localhost", "-p",
str(node1.jmx_port), "repair", "-hosts", "127.0.0.2"]
p = subprocess.Popen(repair_args, env=repair_env,
stdout=subprocess.PIPE, stderr=subprocess.PIPE, universal_newlines=True)
@@ -266,9 +267,9 @@ class TestDeprecatedRepairNotifications(Tester):
except ToolError as tool_error:
nodetool_stderr = tool_error.stderr
- # Check for repair failed message in node1 log
- repair_failed_logs = node1.grep_log(r"ERROR
\[(Repair-Task|Thread)-\d+\] \d{4}-\d{2}-\d{2} \d{2}:\d{2}:\d{2},\d{3}
RepairRunnable.java:\d+ - Repair failed")
- assert len(repair_failed_logs) > 0, "Node logs don't have an error
message for the failed repair"
# Check for error and stacktrace in nodetool output
assert nodetool_stderr.find("error") > -1, "Legacy nodetool didn't
print an error message for the failed repair"
assert nodetool_stderr.find("-- StackTrace --") > -1, "Legacy nodetool
didn't print a stack trace for the failed repair"
+ # Check for repair failed message in node1 log
+ repair_failed_logs = node1.grep_log(r"ERROR
\[(Repair-Task|Thread)-\d+\] \d{4}-\d{2}-\d{2} \d{2}:\d{2}:\d{2},\d{3}
RepairRunnable.java:\d+ - Repair failed")
+ assert len(repair_failed_logs) > 0, "Node logs don't have an error
message for the failed repair"
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]