Skip to content

Reorganise integration tests - part 2#1351

Merged
wprzytula merged 42 commits intoscylladb:mainfrom
wprzytula:reorganise-integration-tests
May 26, 2025
Merged

Reorganise integration tests - part 2#1351
wprzytula merged 42 commits intoscylladb:mainfrom
wprzytula:reorganise-integration-tests

Conversation

@wprzytula
Copy link
Collaborator

This is a follow-up of #1350. Motivation is the same.

This PR, in contrast with the previous one, dissolves many large test files and splits them into more granular, tree-structured modules.

Sanity check

I deleted one test, which I believe to be redundant and pointless (test_await_schema_agreement()). With this in mind, the number of tests before and after is correct, which means I didn't lose any test.

Before:

Running tests/integration/main.rs (target/debug/deps/integration-6bde174c2b23de7e)

running 108 tests

After:

Running tests/integration/main.rs (target/debug/deps/integration-6bde174c2b23de7e)

running 107 tests

Pre-review checklist

  • I have split my patch into logically separate commits.
  • All commit messages clearly explain what they change and why.
  • [] I added relevant tests for new features and bug fixes.
  • All commits compile, pass static checks and pass test.
  • PR description sums up the changes and reasons why they should be introduced.
  • [ ] I have provided docstrings for the public items that I want to introduce.
  • [ ] I have adjusted the documentation in ./docs/source/.
  • [ ] I added appropriate Fixes: annotations to PR description.

@wprzytula wprzytula requested review from Lorak-mmk and muzarski May 10, 2025 08:53
@wprzytula wprzytula self-assigned this May 10, 2025
@wprzytula wprzytula added this to the 1.2.0 milestone May 10, 2025
@wprzytula wprzytula added the area/testing Related to tests - unit, integration, or even out of repo label May 10, 2025
@github-actions
Copy link

github-actions bot commented May 10, 2025

cargo semver-checks found no API-breaking changes in this PR.
Checked commit: 7b4dadb

Copy link
Collaborator

@Lorak-mmk Lorak-mmk left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

What I wrote about prepared I think also applies to batch and unprepared - they also could be a files instead of folders.

Copy link
Contributor

@muzarski muzarski left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nice job.

@wprzytula wprzytula force-pushed the reorganise-integration-tests branch from ae1b69b to f403aa1 Compare May 26, 2025 07:54
@wprzytula
Copy link
Collaborator Author

Rebased on main.

wprzytula added 18 commits May 26, 2025 10:20
As noted during the review of this PR, it's better to have all
batch-related tests in a single file for better organization
and maintainability.
`test_shard_out_of_range()` was put in `load_balancing.rs`, while
`shards.rs` seems to be a much better place for it.
The only test that is left there regards latency latency_awareness,
so such rename makes sense. And module_inception is no longer there.
Vector type is definitely more about a CQL collection than about
the Session.
…ns.rs

The test is definitely more about CQL collections than about
the Session.
This test is about load balancing more than about the Session.
The `metadata_custom_timeouts.rs` file is renamed to `configuration.rs`,
which is going to contain all the metadata fetching configuration tests.
This obviously belongs to `metadata/configuration.rs` category.
These are tests that simply check that driver keeps metadata of some
kind. As these tests are similar in their concept, I believe it makes
sense to have them all in one file.
Materialized views test suits metadata/contents.rs as well.
It belongs to `metadata/configuration.rs`.
Having read the contents of the test, I was confused what it actually
tests. `git blame` shed some light, so I pasted the commit message as
a doc comment: "This test case indicates that we support enough CQL
types to parse schema keyspace information.". A-ha!

But we no longer type check nor deserialize rows eagerly!
The deserialization refactor seems to have rendered this test case
useless. To fix this, I materialise all rows as Row, which actually
performs the type check and deserialization. This way I virtually
bring back the old, intended semantics of this test.
wprzytula added 21 commits May 26, 2025 11:15
Tests `tests_timestamp()` and `test_timestamp_generator()` are extracted
from `session/session.rs` into `statement/timestamps.rs`
There is a bunch of tests which check that statements are reprepared
if the DB responds with DbError::Unprepared. They are extracted from
`session/session.rs` into `statements/transparent_reprepare.rs`.
Test `test_unprepared_statement()` is extracted into
`statements/unprepared.rs`.
Test `test_prepared_statement()` is extracted into
`statements/prepared.rs`.
There was a test case in test_prepared_statement() that actually had
nothing to do with prepared statements, but was testing the ser/de
macros. It was extracted to a separate file.
Test `test_batch()` is extracted into `statements/batch.rs`.
The test is extracted into `statements/batch.rs`.
The test is moved into `statements/batch.rs`.
The test is extracted into `statements/prepared.rs`.
The test is about creating a new Session, so it fits there well.
Tests:
- test_iter_works_when_retry_policy_returns_ignore_write_error()
- test_iter_methods_with_modification_statements()
are extracted into `session/pager.rs`.
The test is extracted into `statements/prepared.rs`.
The test is extracted into `statements/prepared.rs`.
The test is extracted to `statements/request_timeout.rs`.
The test case brings no value to our suite. There are plenty of other
tests that call `Session::await_schema_agreement()`.
The test is extracted to `statements/named_bind_markers.rs`.
The remaining two tests in session.rs:
- test_db_errors(),
- test_rate_limit_exceeded_exception(),
regard DB errors, so the file is renamed accordingly.

This finishes dissolution of the old overloaded `session_test.rs` module.
Hooray!
The test is extracted into `statements/prepared.rs`.
The only tests remaining in `statement.rs` are about coordinator
enforcing, so the file is renamed accordingly.
The test is strictly about unprepared statements, so it's moved to
the corresponding module.
The test is strictly about prepared statements, so it's moved to the
corresponding module.
@wprzytula wprzytula force-pushed the reorganise-integration-tests branch from 943f892 to 7b4dadb Compare May 26, 2025 09:17
@wprzytula
Copy link
Collaborator Author

v1.2: addressed valuelists comment.

@wprzytula wprzytula requested review from Lorak-mmk and muzarski May 26, 2025 09:17
@wprzytula wprzytula merged commit 4c7e189 into scylladb:main May 26, 2025
12 checks passed
@wprzytula wprzytula deleted the reorganise-integration-tests branch May 26, 2025 10:47
@wprzytula wprzytula mentioned this pull request May 26, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

area/testing Related to tests - unit, integration, or even out of repo

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants