From 85df0fd2b1704b60e072eecc0516a6adf6a9465e Mon Sep 17 00:00:00 2001 From: Kamil Braun Date: Wed, 18 Jan 2023 15:22:48 +0100 Subject: [PATCH] test/pylib: scylla_cluster: mark cluster as dirty if it fails to boot If a cluster fails to boot, it saves the exception in `self.start_exception` variable; the exception will be rethrown when a test tries to start using this cluster. As explained in `before_test`: ``` def before_test(self, name) -> None: """Check that the cluster is ready for a test. If there was a start error, throw it here - the server is running when it's added to the pool, which can't be attributed to any specific test, throwing it here would stop a specific test.""" ``` It's arguable whether we should blame some random test for a failure that it didn't cause, but nevertheless, there's a problem here: the `start_exception` will be rethrown and the test will fail, but then the cluster will be simply returned to the pool and the next test will attempt to use it... and so on. Prevent this by marking the cluster as dirty the first time we rethrow the exception. Closes #12560 (cherry picked from commit 147dd7399688b634a91c91fd0f87fdae42a14eeb) --- test/pylib/scylla_cluster.py | 2 ++ 1 file changed, 2 insertions(+) diff --git a/test/pylib/scylla_cluster.py b/test/pylib/scylla_cluster.py index 54da334e75..770238fdf0 100644 --- a/test/pylib/scylla_cluster.py +++ b/test/pylib/scylla_cluster.py @@ -706,6 +706,8 @@ class ScyllaCluster: to any specific test, throwing it here would stop a specific test.""" if self.start_exception: + # Mark as dirty so further test cases don't try to reuse this cluster. + self.is_dirty = True raise self.start_exception for server in self.running.values():