-
Type: Improvement
-
Resolution: Unresolved
-
Priority: Unknown
-
None
-
Affects Version/s: None
-
Component/s: Test Runner
-
None
The transaction test runner README states that:
Running killAllSessions cleans up any open transactions from a previously failed test to prevent the current test from blocking. It is sufficient to run this command once before starting the test suite and once after each failed test.
Currently the driver executes killAllSessions before every single test in the transaction (and others) test suite. This is unnecessary according to the spec, slows down the test runner a bit, and worse, is also implicated in occasional failed tests against 4.0 sharded clusters.
Let's take each of the requirements one by one:
It is sufficient to run this command once before starting the test suite
To implement this, it's sufficient to do this once at the start of the whole test suite, such as in the static initializer of ClusterFixture.
and once after each failed test.
I think we can eliminate this. The reason is because in the cleanup after every test, we close any ClientSession instances that were used by the test, and the close method already aborts any in-progress transactions.
One could argue that if the test cleanup already aborts all in-progress transactions, it's not necessary to do this at all even on startup. But there are a few cases where the per-test cleanup code does not run reliably:
- when running tests in the debugger and you hit the stop button
- when running gradle on the command line and you hit Ctrl-C