This is an automated email from the ASF dual-hosted git repository.
netudima 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 d70098d1 Fix test_relative_paths leaking its working directory into
later tests
d70098d1 is described below
commit d70098d138cfcac1d2893f66fd4700b3beec3fcd
Author: Dmitry Konstantinov <[email protected]>
AuthorDate: Mon Oct 26 09:49:41 2026 +0000
Fix test_relative_paths leaking its working directory into later tests
test_relative_paths changed into a temp dir with os.chdir and never changed
back, so later tests in the same split that resolve files from the cwd
(test_wide_row_repair_lcs in dtest-novnode split 44/64) failed. Use
monkeypatch.chdir so the cwd is restored on teardown, and resolve the wide row
stress profile relative to the test file.
patch by Dmitry Konstantinov; reviewed by Stefan Miklosovic for
CASSANDRA-21807
---
configuration_test.py | 5 +++--
repair_tests/repair_test.py | 2 +-
2 files changed, 4 insertions(+), 3 deletions(-)
diff --git a/configuration_test.py b/configuration_test.py
index 7e43576c..23981e30 100644
--- a/configuration_test.py
+++ b/configuration_test.py
@@ -106,7 +106,7 @@ class TestConfiguration(Tester):
write_to_trigger_fsync(session, 'ks', 'tab')
assert commitlog_size(node) == init_size, "Commitlog was written with
durable writes disabled"
- def test_relative_paths(self):
+ def test_relative_paths(self, monkeypatch):
"""
@jira_ticket CASSANDRA-17084
"""
@@ -114,7 +114,8 @@ class TestConfiguration(Tester):
node1 = self.cluster.nodelist()[0]
cassdir = tempfile.mkdtemp()
os.mkdir(os.path.join(cassdir, 'bin'))
- os.chdir(cassdir)
+ # monkeypatch restores the cwd on teardown, so it does not leak into
later tests in the same split
+ monkeypatch.chdir(cassdir)
node1.set_configuration_options({'commitlog_directory':
'bin/../data/commitlog', 'data_file_directories': ['bin/../data/data']})
self.cluster.start()
self.cluster.stop()
diff --git a/repair_tests/repair_test.py b/repair_tests/repair_test.py
index fad82475..94c605bc 100644
--- a/repair_tests/repair_test.py
+++ b/repair_tests/repair_test.py
@@ -1179,7 +1179,7 @@ class TestRepair(BaseRepairTest):
cluster.populate(2).start()
node1, node2 = cluster.nodelist()
node2.stop(wait_other_notice=True)
- template_path = os.path.join(os.getcwd(),
'stress_profiles/repair_wide_rows.yaml.tmpl')
+ template_path =
os.path.join(os.path.dirname(os.path.realpath(__file__)), '..',
'stress_profiles', 'repair_wide_rows.yaml.tmpl')
with open(template_path) as profile_template:
profile = profile_template.read().replace("{{ compaction_strategy
}}", compaction_strategy)
with tempfile.NamedTemporaryFile(mode='w+') as stress_profile:
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]