Skip to content

[54] automatically test endpoints#80

Open
Mateusz-Dobrzynski wants to merge 9 commits intomasterfrom
54-automatically-test-endpoints
Open

[54] automatically test endpoints#80
Mateusz-Dobrzynski wants to merge 9 commits intomasterfrom
54-automatically-test-endpoints

Conversation

@Mateusz-Dobrzynski
Copy link
Member

I figured out a way to perform endpoint tests using Rust.

  • #[tokio::test] allows running tests in Tokio runtime, making it possible to run a server and perform requests.
  • I populated the tests/ with some integration tests. They can be run with cargo run along with unit tests or separately with cargo run --tests, the only prerequisite being that the database must be up (ofc).
  • Unit tests can be run separately with cargo run --lib, so I changed the Github Actions workflow accordingly.
  • Contrary to unit tests, which are run in parallel, integration tests are run in serial, as enforced by the #[serial] macro. This is because the database is a critical resource. This prolongs execution time, but ensures tests' isolation and stability. A single module (in this case tests contained within a single file) can be run with cargo test --test [module_name].

@Mateusz-Dobrzynski Mateusz-Dobrzynski linked an issue Feb 7, 2026 that may be closed by this pull request
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Automatically test endpoints

1 participant