Skip to content

chore: fix MCP e2e tests - #435

Merged
nieomylnieja merged 4 commits into
mainfrom
fix-mcp-e2e-tests
Feb 26, 2026
Merged

chore: fix MCP e2e tests#435
nieomylnieja merged 4 commits into
mainfrom
fix-mcp-e2e-tests

Conversation

@nieomylnieja

@nieomylnieja nieomylnieja commented Feb 26, 2026

Copy link
Copy Markdown
Collaborator

Summary

  • Add support for test: prefix in release-drafter.yml autolabeler
  • Add test label to Maintenance category
  • Simplify make test/bats/e2e, it now sources the credentials from config.toml (if present)
  • correct MCP e2e tests

Add support for test: prefix in release-drafter.yml to match
the allowed prefixes in pr-title.yml workflow.
@nieomylnieja nieomylnieja changed the title chore: add test commit title to release drafter config chore: fix MCP e2e tests Feb 26, 2026
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.

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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-secret support (gated behind --verbose) for sloctl config current-context, plus unit tests.
  • Simplify make test/bats/e2e by delegating env/config handling to scripts/run-e2e-tests.sh, and update Release Drafter autolabeling for test:.

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 making run_mcp_inspector emit 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 run command outputs partial/invalid JSON to stdout and then exits non-zero, the || echo "{}" fallback can still leave CONTEXT_CONFIG containing non-JSON, causing the subsequent jq reads to fail or misbehave. A more robust pattern is to only assign stdout on success and otherwise set CONTEXT_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.

Comment thread test/mcp-e2e.bats
Comment thread internal/config.go
@daniel-zelazny
daniel-zelazny self-requested a review February 26, 2026 14:44

@daniel-zelazny daniel-zelazny left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@nieomylnieja
nieomylnieja merged commit aaafe7c into main Feb 26, 2026
5 checks passed
@nieomylnieja
nieomylnieja deleted the fix-mcp-e2e-tests branch February 26, 2026 16:15
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants