Skip to content

Commit 019cf1f

Browse files
committed
CONTRIBUTING.md: Add guidelines for writing integration tests
1 parent 38ecb16 commit 019cf1f

File tree

1 file changed

+12
-0
lines changed

1 file changed

+12
-0
lines changed

CONTRIBUTING.md

+12
Original file line numberDiff line numberDiff line change
@@ -49,6 +49,18 @@ The above commands will leave a running ScyllaDB cluster in the background.
4949
To stop it, use `make down`.\
5050
Starting a cluster without running any test is possible with `make up`.
5151

52+
### Writing tests that need to connect to Scylla
53+
54+
If you test requires connecting to Scylla, there are a few things you should consider.
55+
56+
1. Such tests are considered integration tests and should be placed in `scylla/tests/integration`.
57+
2. To avoid name conflicts while creating a keyspace use `unique_keyspace_name` function from `utils` module.
58+
3. This `utils` module (`scylla/tests/integration/utils.rs`) contains other functions that may be helpful for writing tests.
59+
For example `create_new_session_builder` or `test_with_3_node_cluster`.
60+
4. To perform DDL queries (creating / altering / dropping a keyspace / table /type) use `ddl` method from the utils module.
61+
To do this, import the `PerformDDL` trait (`use crate::utils::PerformDDL;`). Then you can call `ddl` method on a
62+
`Session`.
63+
5264
### Tracing in tests
5365

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

0 commit comments

Comments
 (0)