taskwarrior/taskchampion/integration-tests
Dustin J. Mitchell 52fdc6a877 Update Actix crates to latest versions
This avoids a vulnerability in tokio (#3085). The major version updates
of both actix-web and actix-rt required some signficant changes. Chief
among those, it turns out we were relying on actix-rt to run the
HttpServer in a different thread from the rest of the test, so that we
could talk to it from sync code in the test thread. This no longer
works, so the sync code is now run in a dedicated thread with
`actix_rt::task::spawn_blocking`.
2023-04-09 15:44:26 -04:00
..
src Add support for _not_ creating a DB if one does not exist 2022-12-18 13:01:32 -05:00
tests Update Actix crates to latest versions 2023-04-09 15:44:26 -04:00
.gitignore rename rust/ to taskchampion/ 2022-07-29 21:41:41 -04:00
build.rs apply clippy fixes 2022-12-26 17:49:04 -05:00
Cargo.toml Update Actix crates to latest versions 2023-04-09 15:44:26 -04:00
README.md rename rust/ to taskchampion/ 2022-07-29 21:41:41 -04:00

Integration Tests for Taskchampion

"Regular" Tests

Some of the tests in tests/ are just regular integration tests. Nothing exciting to see.

Bindings Tests

The bindings tests are a bit more interesting, since they are written in C. They are composed of a collection of "suites", each in one C file in integration-tests/src/bindings_tests/. Each suite contains a number of tests (using Unity) and an exported function named after the suite that returns an exit status (1 = failure).

The build script (integration-tests/build.rs) builds these files into a library that is linked with the integration_tests library crate. This crate contains a bindings_tests module with a pub function for each suite.

Finally, the integration-tests/tests/bindings.rs test file calls each of those functions in a separate test case.

Adding Tests

To add a test, select a suite and add a new test-case function. Add a RUN_TEST invocation for your new function to the .._tests function at the bottom. Keep the RUN_TESTs in the same order as the functions they call.

Adding Suites

To add a suite,

  1. Add a new C file in integration-tests/src/bindings_tests/, based off of one of the others.
  2. Add a the suite name to suites in integration-tests/build.rs.