chore: fix MCP e2e tests - #435
Merged
Merged
Conversation
Add support for test: prefix in release-drafter.yml to match the allowed prefixes in pr-title.yml workflow.
Introduces a new Agent resource for Prometheus. Updates the SLO definition in test inputs to include time windows and a nested Prometheus query structure. Refactors the e2e test setup to apply all resources once in setup_file and simplifies assertions.
There was a problem hiding this comment.
Pull request overview
Updates MCP e2e fixtures and Bats tests, adds a safer/clearer config current-context behavior for showing secrets, and streamlines running e2e tests via a helper script that can source credentials from config.
Changes:
- Fix MCP e2e inputs/outputs and adjust Bats tests to validate MCP structured responses.
- Add
--show-secretsupport (gated behind--verbose) forsloctl config current-context, plus unit tests. - Simplify
make test/bats/e2eby delegating env/config handling toscripts/run-e2e-tests.sh, and update Release Drafter autolabeling fortest:.
Reviewed changes
Copilot reviewed 12 out of 12 changed files in this pull request and generated 2 comments.
Show a summary per file
| File | Description |
|---|---|
test/outputs/mcp-e2e/get-slo.json |
Adds expected MCP SLO output fixture. |
test/outputs/mcp-e2e/get-project.yaml |
Adds expected MCP Project output fixture. |
test/outputs/config/get-current-context-full-show-secret.yaml |
Adds fixture for verbose current-context output with secrets shown. |
test/mcp-e2e.bats |
Refactors MCP e2e tests to apply resources once and validate MCP structured JSON. |
test/inputs/mcp-e2e/slo.yaml |
Aligns SLO input with expected schema (time windows + query-based raw metric). |
test/inputs/mcp-e2e/agent.yaml |
Adds Agent resource used by the SLO metric source. |
test/inputs/config/config.toml |
Switches default context for tests from minimal to full. |
test/config-unit.bats |
Adds unit coverage for --show-secret behavior and gating. |
scripts/run-e2e-tests.sh |
New runner to extract missing credentials from current context and run e2e in Docker. |
internal/config.go |
Adds --show-secret flag and updates current-context help/logic. |
Makefile |
Uses the new runner script for Bats e2e. |
.github/release-drafter.yml |
Adds test label/category and title autolabeler rule for test:. |
Comments suppressed due to low confidence (3)
test/mcp-e2e.bats:46
- Extracting JSON by taking the first line that matches
{is brittle (any log line containing{will break parsing because that entire line is included). Prefer makingrun_mcp_inspectoremit machine-only JSON (if supported), or tighten the filter to only start from a line that begins with JSON (e.g.,^[[:space:]]*{) and fail explicitly if no JSON payload is found.
json_output=$(echo "$output" | sed -n '/{/,$p')
assert_equal "$(jq -r '.structuredContent.kind' <<<"$json_output")" "Project"
scripts/run-e2e-tests.sh:29
- If the
docker runcommand outputs partial/invalid JSON to stdout and then exits non-zero, the|| echo "{}"fallback can still leaveCONTEXT_CONFIGcontaining non-JSON, causing the subsequentjqreads to fail or misbehave. A more robust pattern is to only assign stdout on success and otherwise setCONTEXT_CONFIG="{}"after checking the exit status.
CONTEXT_CONFIG=$(docker run --rm \
-v "$CONFIG_PATH:/config.toml:ro" \
"$SLOCTL_IMAGE" \
config current-context --verbose --show-secret -o json --config=/config.toml 2>/dev/null || echo "{}")
test/outputs/config/get-current-context-full-show-secret.yaml:2
- This fixture stores a plaintext secret in-repo (even if it鈥檚 a dummy value). To reduce the chance of accidental real secret snapshots later, consider using an unmistakably fake placeholder convention (e.g.,
example_invalid_secret_do_not_use) and/or adding a brief comment in the test explaining that the values must remain non-production and non-functional.
clientId: full_client_id
clientSecret: full_client_secret
馃挕 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
daniel-zelazny
self-requested a review
February 26, 2026 14:44
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
test:prefix in release-drafter.yml autolabelertestlabel to Maintenance categorymake test/bats/e2e, it now sources the credentials fromconfig.toml(if present)