-
Notifications
You must be signed in to change notification settings - Fork 49
Description
Our integration tests are in a pretty sorry state, which isn't good considering we use this driver for pretty much all Scylla tests.
I'd like to improve this situation so I'm opening this issue to keep track of those efforts and the current state.
I'm describing the problems as I understand them, and I'm not an expert in this codebase. If anything here is incorrect feel free to correct me.
Problem 1: We don't run all the tests
Currently we are running standard and cqlengine tests. We should work on enabling long
, upgrade
and simulacron
tests, and run them, but not in CI (parhaps before reach release).
TODO:
- Fix and enable the rest of
tests/integration/standard
tests. - Fix and enable
tests/integration/cqlengine
tests. - Fix
tests/integration/long
, and start running them before release - Adjust
tests/integration/upgrade
so that it can test Scylla upgrades too, and run them before release. - Remove tests that use DSE-specific functionality. I don't think we support such functionality, so it would we better to yank all DSE-specific code from the driver - to reduce complexity and avoid confusion (e.g. DSE Cloud vs Scylla Cloud). This includes removing
tests/integration/cloud
and most oftests/integration/advanced
, along with associated code in the driver and documentation. - I'm not sure what to do about
tests/integration/simulacron
and what even are those - more research needed. If they can be used with Scylla - great. If not, let's not delete them - we can use them with Cassandra only.
Problem 2: We only test with Scylla, and with 1 version of it.
This is pretty self explanatory. I think we should run integration tests with:
- Currently supported stable Scylla releases (right now: 5.1 and 5.0)
- Latest Cassandra stable release
- Optional: upcoming Scylla stable release.
Matrix tests (when we get them to work) take care of testing with various Scylla version. It would be breat to also add integration tests CI running on latest stable Cassandra.
TODO:
- Add Cassandra integration tests to CI
Problem 3: Tests are slow
Tests are run sequentially, and each one needs to setup a cluster - unless the previous one was using cluster with the same topology. This is quite slow, considering very long Scylla startup times. Afaik this is the limitation of tests/integration/__init__.py
(unless there is some limitation I don't know about, like ccm not being able to run >1 cluster), that has a global var to hold a cluster - so it can only use one at a time.
Tests are now faster than in the past, thank to improvements in Scylla startup times.
The above about sub-optimal usage of clusters, resulting in more restarts than necessary, is still true, and accounts for big chunk of execution time.
What can we do about it? Migrate tests to pytest fully, so that we are able to use fixtures. Then, we can use them (and optionally pytest hooks) to guarantee optimal execution order and cluster utilization.
Apart from that, some tests are itself quite slow. Sometimes because of sleeps, sometimes because they to a lot of (perhaps not necessary) work.
TODD:
- Migrate test code from unittest to pytest
- Prepare test utils (fixtures etc) to make cluster usage by tests optimal
- Migrate tests to use the above
- Investigate tests execution time, and fix slow tests
- Bonus: refactor
__init__.py
in integration to be more comprehensible.
Problem 4: We only run those tests with asyncio reactor
That one I'm not sure is important or even correct.
I can see that there are more reactors supported by driver (and we do run some unit tests on some of those), yet we only use asyncio libev during integration tests. Shouldn't we run some tests with all the other ones?
We now run integration tests with libev, asyncio, and asyncore (for older Python version). We could start testing the rest of reactors too (eventlet, gevent, twisted).
This would result in more resources spent on integration testing - I think we can reduce amount of tested Python version to counteract this (maybe test latest, and oldest supported?).
We still run unit tests with only 1 reactor (I think) - we could tests more here as well.
Problem 5: A lot of unnecessary logs from ccm (I guess?).
Setup / teardown logs are massive - they cause my terminal to lag, and require some time to scroll trough. Most of the time they are also completely useless. They should be hidden by default and only displayed when some env variable is set.
I think this is no longer a problem (because I don't remember encountering it lately), but I'm not sure. Will update if I ever encounter it.
Problem 6: Multiple warnings
There are a lot of warnings printed when executing integration test. Not all of them are our fault, but we should fix those that we can, as they make it harder to read the results.
Problem 7: Skipped tests
A lot of tests are skipped - we should go through them, and make sure there are no unnecessary skips.