Skip to content

Commit

Permalink
CONTRIBUTING.md: Add guidelines for writing integration tests
Browse files Browse the repository at this point in the history
  • Loading branch information
Lorak-mmk committed Nov 21, 2024
1 parent 38ecb16 commit 019cf1f
Showing 1 changed file with 12 additions and 0 deletions.
12 changes: 12 additions & 0 deletions CONTRIBUTING.md
Original file line number Diff line number Diff line change
Expand Up @@ -49,6 +49,18 @@ The above commands will leave a running ScyllaDB cluster in the background.
To stop it, use `make down`.\
Starting a cluster without running any test is possible with `make up`.

### Writing tests that need to connect to Scylla

If you test requires connecting to Scylla, there are a few things you should consider.

1. Such tests are considered integration tests and should be placed in `scylla/tests/integration`.
2. To avoid name conflicts while creating a keyspace use `unique_keyspace_name` function from `utils` module.
3. This `utils` module (`scylla/tests/integration/utils.rs`) contains other functions that may be helpful for writing tests.
For example `create_new_session_builder` or `test_with_3_node_cluster`.
4. To perform DDL queries (creating / altering / dropping a keyspace / table /type) use `ddl` method from the utils module.
To do this, import the `PerformDDL` trait (`use crate::utils::PerformDDL;`). Then you can call `ddl` method on a
`Session`.

### Tracing in tests

By default cargo captures `print!` macro's output from tests and prints them for failed tests.
Expand Down

0 comments on commit 019cf1f

Please sign in to comment.