Skip to content

Commit a0ae1c3

Browse files
authored
DEV: Add integration tests readme (#4316)
1 parent fa50a4f commit a0ae1c3

File tree

1 file changed

+81
-0
lines changed

1 file changed

+81
-0
lines changed

redisinsight/api/test/README.md

Lines changed: 81 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,81 @@
1+
# Integration Tests
2+
3+
## How to Run
4+
5+
### Prerequisites
6+
7+
- **First Time Running Tests?**
8+
If you're running the tests for the first time, please review the [Short Explanation and High-Level Overview](#short-explanation-and-high-level-overview).
9+
10+
- **Running a Subset of Tests**
11+
You can run a specific subset of tests by modifying the `spec` glob in `/redisinsight/api/test/api/.mocharc.yml`. This allows you to execute only the tests you need.
12+
13+
### Steps to Run Tests
14+
15+
1. **Run the Desired Environment**
16+
It's recommended to use Docker for this, as it provides better control over versioning and switching between environments.
17+
18+
1. **Execute the Tests**
19+
From the root directory of the repository, run the following command:
20+
21+
```bash
22+
yarn test:api:integration
23+
```
24+
25+
#### Example
26+
27+
Let’s walk through an example where you need to run tests related to `string`.
28+
29+
1. **Modify the Test Subset**
30+
Update `/redisinsight/api/test/api/.mocharc.yml` to include only the `string` tests:
31+
32+
```yaml
33+
spec:
34+
- 'test/**/string/**/*.test.ts'
35+
```
36+
37+
1. **Run the Environment in Docker**
38+
For this example, let’s assume you need to run the tests against the `OSS-ST-6` environment. To do this:
39+
40+
- Navigate to the environment directory:
41+
42+
```bash
43+
cd /redisinsight/api/test/test-runs/oss-st-6
44+
```
45+
46+
- Start Docker:
47+
```bash
48+
docker-compose up
49+
```
50+
51+
1. **Run the Tests**
52+
Finally, execute the tests from the root directory:
53+
54+
```bash
55+
yarn test:api:integration
56+
```
57+
58+
---
59+
60+
## Short Explanation and High-Level Overview
61+
62+
The integration tests follow a basic structure:
63+
64+
- **Redis Environment**: Tests are executed against various Redis environments such as Redis Community Edition (Redis OSS), Redis Cluster, Redis Stack, etc.
65+
- **Test Suites**: A collection of test scenarios are designed to evaluate different Redis features.
66+
67+
> **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 for `RediSearch` will fail if executed in a Redis OSS environment.
68+
69+
---
70+
71+
### Project Structure
72+
73+
#### Tests
74+
75+
The `/redisinsight/api/test/api` directory contains all the test scenarios for the integration tests.
76+
77+
#### Environments
78+
79+
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).
80+
81+
> **Note:** You may encounter some code related to GitHub Actions workflows, as these tests are also automatically run through CI/CD.

0 commit comments

Comments
 (0)