Skip to content

Commit 4c2fef4

Browse files
committed
docs: add data-plane/admin review guidance to testing skill
1 parent 788ab03 commit 4c2fef4

1 file changed

Lines changed: 53 additions & 0 deletions

File tree

.claude/skills/testing/SKILL.md

Lines changed: 53 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -181,6 +181,59 @@ The `createTestClient(env?)` factory in `tests/helpers/mcp-client.ts` spawns
181181
a real server process and returns a connected MCP `Client`. Override env vars
182182
by passing a partial record. Always call `close()` in `afterAll`.
183183

184+
## Reviewing data-plane and admin changes
185+
186+
When a change adds or modifies a tool that talks to an InfluxDB endpoint
187+
(writes, queries, database/token management), verify the actual API contract
188+
and exercise it against a real instance. Tool descriptions, CHANGELOG entries,
189+
and code comments are not authoritative on their own — confirm them.
190+
191+
### Verify the API contract first
192+
193+
Confirm the HTTP method, path, and request/response shape against both the
194+
InfluxData docs knowledge source and the `influxdata/influxdb` source
195+
(`influxdb3_server/src/http.rs` routing, `influxdb3_types/src/http.rs` structs).
196+
197+
Gotchas that have already bitten this repo:
198+
199+
- Core/Enterprise `update_database` retention is `PUT /api/v3/configure/database`
200+
with `retention_period` as a duration string (`"60d"`) — not `PATCH`, not
201+
`retention_period_ns`.
202+
- Core can update retention since v3.2.0 (static docs wrongly say it's immutable).
203+
- `/ping` and `/health` use `Token` auth even for core/enterprise (v1/v2 compat);
204+
the admin client uses `Bearer`. Both are intentional.
205+
206+
### Exercise it against a real instance
207+
208+
Admin endpoints (`/api/v3/configure/*`) need an admin token; `health_check`
209+
does not, so a passing `health_check` does not prove the token works. Run a
210+
self-contained Core for an admin-path test on a free port:
211+
212+
```bash
213+
docker run -d --name mcp-it-core -p 8383:8181 \
214+
-v "$PWD/tests/fixtures/admin-token.json":/admin-token.json:ro \
215+
influxdb:3-core influxdb3 serve \
216+
--node-id local-test --object-store memory \
217+
--admin-token-file /admin-token.json
218+
219+
INFLUX_TEST_ENABLED=true INFLUX_DB_INSTANCE_URL=http://localhost:8383/ \
220+
INFLUX_DB_TOKEN=apiv3_test INFLUX_DB_PRODUCT_TYPE=core \
221+
npx vitest run tests/integration.test.ts
222+
223+
docker rm -f mcp-it-core
224+
```
225+
226+
This uses the offline preconfigured admin token in `tests/fixtures/admin-token.json`
227+
(token `apiv3_test`) — the `docker-compose.test.yml` pattern, but on a port you
228+
choose so it does not collide with other local instances.
229+
230+
### Token gotcha
231+
232+
v3 tokens are base64 and can contain `+`, `/`, and `=`. Do not extract one with
233+
`grep -oE 'apiv3_[A-Za-z0-9_-]+'` — it truncates at the first base64 character
234+
and yields an invalid token (the server returns `401 "the request was not
235+
authenticated"`).
236+
184237
## Additional Resources
185238

186239
### Reference Files

0 commit comments

Comments
 (0)