ci: run unit tests in CI#918
Conversation
Unit tests (tests/unit/) were never run in CI — only integration tests that require a running Scylla cluster. Since unit tests use mocks and have no external dependencies, they are fast and cheap to run, and would have caught regressions like the missing scope validation in wait_for_schema_agreement (#917) and the error accumulation bug in _set_keyspace_for_all_pools (#915). Mark the two pre-existing test failures as xfail (referencing their fix PRs) so they don't block this change while the fixes are pending.
|
Warning Review limit reached
Next review available in: 34 minutes Enable usage-based reviews in Billing to review now. Otherwise, wait until the next included review is available. How can I continue?After more reviews become available, a review can be triggered using the To avoid repeated limits, reduce automatic review volume by pausing incremental auto-reviews earlier, using label-based review opt-in, excluding WIP or generated PR titles, or requesting reviews manually when the PR is ready. If your team needs uninterrupted high-volume reviews, an organization admin can enable usage-based reviews. How do review limits work?CodeRabbit enforces per-developer PR review limits for each organization. Most developers receive the normal plan review availability. For paid Pro and Pro+ PR reviews, CodeRabbit uses adaptive limits for sustained high-volume activity. When a developer's recent PR review activity reaches the 95th percentile or higher among CodeRabbit users, additional reviews become available more gradually as earlier reviews age out of the rolling window. Please refer docs for additional details. Review details⚙️ Run configurationConfiguration used: Organization UI Review profile: CHILL Plan: Pro Plus Run ID: 📒 Files selected for processing (2)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
Not true. We are running unit tests. More than once actually, because we run them for each target that we build wheels for. See for example test output from your other PR: https://github.com/scylladb/python-driver/actions/runs/28400830092/job/84151324434?pr=917#step:12:1693 The issue is not that we are not running unit tests, but that we are silently skipping some tests, as I described in #904 The solution is to disallow skipping in CI, and instead explicitly list skipped tests, which Sylwia is working on in #911 |
But I did not fail on libev specific tests... ? |
What didn't? As an example, setup of those tests has this:
log.debug("Using default event loop (libev)")
try:
from cassandra.io.libevreactor import LibevConnection
connection_class = LibevConnection
except DependencyException as e:
log.debug('Could not import LibevConnection, '
'using connection_class=None; '
'failed with error:\n {}'.format(
repr(e)
))
log.debug("Will attempt to set connection class at cluster initialization")
connection_class = NoneSo if libev is not installed, it will be None and all |
Problem
Unit tests (
tests/unit/) are never executed in any CI workflow. Theintegration-tests.ymlonly runstests/integration/standard/andtests/integration/cqlengine/— which require a running Scylla cluster via ccm.This means bugs in unit-testable code can go undetected for weeks. Example:
Session.wait_for_schema_agreementwas added in commit0d215f45bwith a docstring and test promisingValueErrorfor invalid scope, but the validation was never implemented. It was only caught now because a human looked at the test output.Solution
Add a
uv run pytest tests/unit/test_*.py -xstep after the build and before the Scylla download/start. Unit tests:Pre-existing test failures
Two tests fail on
masterdue to bugs introduced before CI was running them:test_wait_for_schema_agreement_rejects_unknown_scopetest_set_keyspace_for_all_pools_reports_all_errorscallback(host_errors)should pass accumulated errorsBoth are marked
@pytest.mark.xfail(strict=False)referencing their fix PRs. Once those PRs merge, these xfail markers should be removed.