This repository contains end-to-end tests for the LAPIS API backed by SILO. It's designed to make adding new test cases easy and straightforward, while ensuring all endpoints and functionalities work as expected.
- Docker Integration: Utilizes Docker Compose to manage test environments for LAPIS and SILO.
- Automated Testing: Runs tests using Vitest to ensure all endpoints and functionalities are working as expected.
- Configuration Flexibility: Configurable test sets and environments through Docker and external YAML/JSON files.
- Dynamic Test Set Detection: Automatically detects and runs tests for all test sets in the
/testsets/
directory.
-
Install dependencies:
npm ci
-
Run tests:
npm test
This command will start up the Docker containers and execute all defined tests.
-
Stop Docker containers:
npm run dockerDown
Also, tests can be rerun without restarting all containers by calling npm run testRunner
after npm run dockerUp
directly.
Modify the database_config.yaml
, reference_genomes.json
, and any other configuration files in the testsets
directory according to your test requirements.
/testsets/
: Contains individual test sets. Each test set is a directory that includes:data/
: Input data for the test setqueries/
: Test queries and expected responsesoutput/
: Output directory for SILO preprocessing
docker-compose.yml
: Defines the LAPIS and SILO servicesbin/
: Scripts to be executed vianpm run
src/
: Main code for the testssrc/testset.spec.ts
: Main test script that runs all queries for all test sets
vitest.config.ts
: Vitest configurationpackage.json
: Defines project dependencies and scripts.prettierrc
: Prettier configuration for code formatting
To add a new test set:
- Create a new directory under
/testsets/
- Add necessary data files to the
data/
subdirectory - Create query files in the
queries/
subdirectory (must end with.query.ts
) - Add expected response files if needed
The test runner will automatically detect and run tests for all test sets in the /testsets/
directory.
If the added queries contain test, whose expectedResponse-body is a sql:
statement, the test files need to be generated before running npm test
by running npm run generate
.
Before changing the /testsets/
directory, always call npm run dockerDown
. After modifying the directory this command might fail to take down all currently running containers, and they need to be stopped manually.
- Test set directory names should only contain alphanumeric characters, hyphens, and underscores.
- The test runner uses dynamic port allocation to avoid conflicts between test sets.
Contributions to improve the test suite or add new scenarios are welcome. Please submit a pull request with your changes, adhering to the existing code structure and documentation style.
TBD