Skip to content

Commit

Permalink
cql-pytest: fix skipping of tests on Cassandra or old Scylla
Browse files Browse the repository at this point in the history
Recently we added a trick to allow running cql-pytests either with or
without tablets. A single fixture test_keyspace uses two separate
fixtures test_keyspace_tablets or test_keyspace_vnodes, as requested.

The problem is that even if test_keyspace doesn't use its
test_keyspace_tablets fixture (it doesn't, if the test isn't
parameterized to ask for tablets explicitly), it's still a fixture,
and it causes the test to be skipped. This causes every test to be
skipped when running on Cassandra or old Scylla which doesn't support
tablets.

The fix is simple - the internal fixture test_keyspace_tablets should
yield None instead of skipping. It is the caller, test_keyspace, which
now skips the test if tablets are requested but test_keyspace_tablets
is None.

Fixes scylladb#17266

Signed-off-by: Nadav Har'El <nyh@scylladb.com>
  • Loading branch information
nyh committed Feb 11, 2024
1 parent 7a71042 commit 32f1a1a
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion test/cql-pytest/conftest.py
Original file line number Diff line number Diff line change
Expand Up @@ -91,7 +91,7 @@ def this_dc(cql):
@pytest.fixture(scope="session")
def test_keyspace_tablets(cql, this_dc, has_tablets):
if not is_scylla(cql) or not has_tablets:
pytest.skip("tablet-specific test skipped")
yield None
return

name = unique_name()
Expand Down Expand Up @@ -120,6 +120,8 @@ def test_keyspace(request, test_keyspace_vnodes, test_keyspace_tablets, cql, thi
if request.param == "vnodes":
yield test_keyspace_vnodes
elif request.param == "tablets":
if not test_keyspace_tablets:
pytest.skip("tablet-specific test skipped")
yield test_keyspace_tablets
else:
pytest.fail(f"test_keyspace(): invalid request parameter: {request.param}")
Expand Down

0 comments on commit 32f1a1a

Please sign in to comment.