Skip to content

Commit 780c28e

Browse files
committed
update readme
1 parent 93b7c8e commit 780c28e

File tree

1 file changed

+22
-78
lines changed
  • mcp_servers/integration_test_generator

1 file changed

+22
-78
lines changed

mcp_servers/integration_test_generator/README.md

Lines changed: 22 additions & 78 deletions
Original file line numberDiff line numberDiff line change
@@ -8,17 +8,9 @@ This MCP server helps generate OTel integration metric test files similar to `te
88
- `Test_<Integration>MetricsCollection` - validates metrics received by collector
99
- `Test_BackendValidity` - validates metrics received by backend
1010
- `Test_Smoke` - generates integration-specific activity and validates basic metrics
11-
12-
- **Pre-configured integrations** with smoke tests:
13-
- Redis
14-
- MySQL
15-
- Nginx
16-
- Kafka
1711

1812
- **Uses shared utilities**:
1913
- All tests use the shared `utils/otel_metrics_validator.py`
20-
- No duplicate code across integrations
21-
- Consistent validation logic
2214

2315
- **Generates supporting files**:
2416
- `__init__.py`
@@ -43,7 +35,7 @@ Add to your MCP configuration file:
4335
"integration-test-generator": {
4436
"command": "python3",
4537
"args": [
46-
"/Users/quinna.halim/system-tests/mcp_servers/integration_test_generator/server.py"
38+
"/Users/<firstname.lastname>/system-tests/mcp_servers/integration_test_generator/server.py"
4739
]
4840
}
4941
}
@@ -70,20 +62,12 @@ Add to your MCP configuration file:
7062

7163
### Basic Usage
7264

73-
In Cursor or Claude Desktop, you can now use natural language to generate tests:
74-
75-
```
76-
Generate a Redis integration test with metrics file redis_metrics.json
77-
```
65+
In Cursor or Claude Desktop, you can now use natural language to generate tests, i.e.:
7866

7967
```
8068
Create a MySQL integration test, excluding the metrics: mysql.slow_queries, mysql.replication.delay
8169
```
8270

83-
```
84-
List all supported integrations with pre-configured smoke tests
85-
```
86-
8771
### Available Tools
8872

8973
#### 1. `generate_integration_test`
@@ -128,63 +112,45 @@ Generate a metrics JSON template for Redis with metrics: redis.commands.processe
128112
### Step 1: Generate the Test Files
129113

130114
```
131-
Generate a Redis integration test with metrics file redis_metrics.json
115+
Ex: Generate a MySQL integration test with metrics file mysql_metrics.json
132116
```
133117

134118
The MCP server will provide:
135-
1. `test_redis_metrics.py` - The main test file
119+
1. `test_mysql_metrics.py` - The main test file
136120
2. `__init__.py` - Package init file
137121
3. Directory structure instructions
138122

139-
**Note**: No `utils.py` is generated because all tests use the shared `utils/otel_metrics_validator.py`!
140-
141123
### Step 2: Create the Directory
142124

143125
```bash
144126
mkdir -p tests/otel_redis_metrics_e2e
145127
```
146128

147-
### Step 3: Save the Files
148-
149-
Save the generated files to the new directory:
150-
- `tests/otel_redis_metrics_e2e/test_redis_metrics.py`
151-
- `tests/otel_redis_metrics_e2e/__init__.py`
152-
153-
**Note**: No `utils.py` file is needed! The test automatically imports from the shared `utils/otel_metrics_validator.py`.
154-
155-
### Step 4: Create the Metrics JSON
129+
### Step 3: Create the Metrics JSON
156130

157-
Create `tests/otel_redis_metrics_e2e/redis_metrics.json`:
131+
Create `tests/otel_<integration>_metrics_e2e/<integration>_metrics.json`:
158132

159133
```json
160134
{
161-
"redis.commands.processed": {
135+
"postgresql.backends": {
162136
"data_type": "Sum",
163-
"description": "Total number of commands processed by the server"
137+
"description": "The number of backends."
164138
},
165-
"redis.keys.expired": {
139+
"postgresql.bgwriter.buffers.allocated": {
166140
"data_type": "Sum",
167-
"description": "Total number of key expiration events"
141+
"description": "Number of buffers allocated."
168142
},
169-
"redis.net.input": {
170-
"data_type": "Sum",
171-
"description": "Total number of bytes received from network"
172-
}
173143
}
174144
```
175145

176-
Or use the template generator:
177-
```
178-
Generate a metrics JSON template for Redis with metrics: redis.commands.processed, redis.keys.expired, redis.net.input
179-
```
180146

181-
### Step 5: Customize the Smoke Test
147+
### Step 4: Customize the Smoke Test
182148

183-
Review and update the smoke test operations in `test_redis_metrics.py` if needed:
149+
Review and update the smoke test operations in `test_<integration>_metrics.py` if needed:
184150

185151
```python
186152
def setup_main(self) -> None:
187-
"""When the redis container spins up, we need some activity."""
153+
"""When the container spins up, we need some activity."""
188154
scenario: OtelCollectorScenario = context.scenario
189155
container = scenario.redis_container
190156

@@ -194,52 +160,30 @@ def setup_main(self) -> None:
194160
# ... more operations
195161
```
196162

197-
### Step 6: Add Feature to utils/_features.py
163+
### Step 5: Add Feature to utils/_features.py
198164

199165
If the feature doesn't exist, add it:
200166

201167
```python
202-
redis_receiver_metrics = Feature("redis_receiver_metrics")
168+
@staticmethod
169+
def postgres_receiver_metrics(test_object):
170+
"""OpenTelemetry semantic conventions for Postgres receiver metrics
171+
172+
https://feature-parity.us1.prod.dog/#/?feature=498
173+
"""
174+
return _mark_test_object(test_object, feature_id=498, owner=_Owner.idm)
203175
```
204176

205-
### Step 7: Format and Test
177+
### Step 6: Format and Test
206178

207179
```bash
208180
./format.sh
209181
./run.sh otel_collector # or appropriate scenario
210182
```
211183

212-
## Adding Support for New Integrations
213-
214-
To add pre-configured support for a new integration, edit `server.py` and add to `INTEGRATION_CONFIGS`:
215-
216-
```python
217-
INTEGRATION_CONFIGS = {
218-
# ... existing configs ...
219-
"mongodb": {
220-
"container_name": "mongodb_container",
221-
"smoke_test_operations": [
222-
'r = container.exec_run("mongo --eval \'db.test.insertOne({x: 1})\'")',
223-
'logger.info(r.output)',
224-
],
225-
"expected_smoke_metrics": [
226-
"mongodb.operations",
227-
"mongodb.connections",
228-
],
229-
},
230-
}
231-
```
232184

233185
## Example Outputs
234186

235-
### For Redis
236-
237-
The generator will create a complete test structure with:
238-
- Metrics validation against collector logs
239-
- Backend API validation (both "combined" and "native" semantic modes)
240-
- Smoke test with Redis-specific operations (SET, GET, INCR)
241-
- Expected metrics for smoke test validation
242-
243187
### For MySQL
244188

245189
The generator will create:

0 commit comments

Comments
 (0)