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
This commit is contained in:
Kamil Braun
2023-01-18 15:22:48 +01:00
committed by Nadav Har'El
parent 4c33791f96
commit 147dd73996

View File

@@ -709,6 +709,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():