Integration Tests
How to Run
Prerequisites
-
First Time Running Tests?
If you're running the tests for the first time, please review the Short Explanation and High-Level Overview. -
Running a Subset of Tests
You can run a specific subset of tests by modifying thespecglob in/redisinsight/api/test/api/.mocharc.yml. This allows you to execute only the tests you need.
Steps to Run Tests
-
Run the Desired Environment
It's recommended to use Docker for this, as it provides better control over versioning and switching between environments. -
Execute the Tests
From the root directory of the repository, run the following command:npm run test:api:integration
Example
Let’s walk through an example where you need to run tests related to string.
-
Modify the Test Subset
Update/redisinsight/api/test/api/.mocharc.ymlto include only thestringtests:spec: - 'test/**/string/**/*.test.ts' -
Run the Environment in Docker
For this example, let’s assume you need to run the tests against theOSS-ST-6environment. To do this:-
Navigate to the environment directory:
cd /redisinsight/api/test/test-runs/oss-st-6 -
Start Docker:
docker-compose up
-
-
Run the Tests
Finally, execute the tests from the root directory:npm run test:api:integration
Short Explanation and High-Level Overview
The integration tests follow a basic structure:
- Redis Environment: Tests are executed against various Redis environments such as Redis Community Edition (Redis OSS), Redis Cluster, Redis Stack, etc.
- Test Suites: A collection of test scenarios are designed to evaluate different Redis features.
Note: Keep in mind that specific Redis environments might require additional test suites. For example, Redis Stack includes
RediSearch, which is not available in Redis OSS, meaning tests designed forRediSearchwill fail if executed in a Redis OSS environment.
Project Structure
Tests
The /redisinsight/api/test/api directory contains all the test scenarios for the integration tests.
Environments
The /redisinsight/api/test/test-runs directory houses the Redis Test Environments (RTEs). Some of these environments have more complex setups, such as TLS with authentication, and thus include all necessary components (e.g., keys, certificates).
Note: You may encounter some code related to GitHub Actions workflows, as these tests are also automatically run through CI/CD.