Skip to content

[test] Add tests for cmd.shutdownTracingProviderWithTimeout - #14556

Merged
lpcox merged 3 commits into
mainfrom
test/shutdown-tracing-timeout-0901ce055fa690ad
Oct 7, 2026
Merged

lpcox merged 3 commits into
mainfrom
test/shutdown-tracing-timeout-0901ce055fa690ad

Conversation

@github-actions

@github-actions github-actions Bot commented Oct 7, 2026

Copy link
Copy Markdown
Contributor

Test Coverage Improvement: shutdownTracingProviderWithTimeout

Function Analyzed

  • Package: internal/cmd
  • Function: shutdownTracingProviderWithTimeout
  • Previous Coverage: 71.4%
  • New Coverage: 100%
  • Complexity: Low-Medium (timeout context + error branch)

Why This Function?

Overall coverage is already high. This was among the few remaining partially covered non-trivial functions, and its shutdown-error branch (warning callback) was never exercised.

Tests Added

  • ✅ SDK provider shutdown against a collector that hangs on export, so the 5s shutdown timeout fires and the warnf error path is verified (exactly one warning, expected message)
  • Skipped under -short since it waits for the 5s timeout

Test Execution

--- PASS: TestShutdownTracingProviderWithTimeout (5.00s)
tracing.go:95: shutdownTracingProviderWithTimeout 100.0%

Generated by Test Coverage Improver

Warning

Firewall blocked 4 domains

The following domains were blocked by the firewall during workflow execution:

  • example.com
  • nonexistent.local
  • slow.example.com
  • thishostdoesnotexist12345.com

To allow these domains, add them to the network.allowed list in your workflow frontmatter:

network:
  allowed:
    - defaults
    - "example.com"
    - "nonexistent.local"
    - "slow.example.com"
    - "thishostdoesnotexist12345.com"

See Network Configuration for more information.

Generated by Test Coverage Improver · copilot · auto · 60.2 AIC · ⊞ 10.6K · ◷

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
@lpcox
lpcox marked this pull request as ready for review October 7, 2026 17:04
Copilot AI balanced review requested due to automatic review settings October 7, 2026 17:04

Copilot AI 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.

🟡 Changes recommended

Ambient endpoint configuration and an incomplete timeout assertion can make the test flaky or falsely pass.

1 open finding
What changed in this PR

Adds timeout-path coverage for tracing-provider shutdown using a hanging local OTLP collector.

Changes:

  • Adds a hanging collector test.
  • Verifies shutdown emits one warning after timing out.
File Description
internal/​cmd/​tracing_helpers_test.go Tests tracing shutdown timeout behavior.

🧠 Review effort: Balanced


💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.

Comment thread internal/cmd/tracing_helpers_test.go
@github-actions

This comment has been minimized.

Co-authored-by: Copilot Autofix powered by AI <175728472+Copilot@users.noreply.github.com>
@github-actions

github-actions Bot commented Oct 7, 2026

Copy link
Copy Markdown
Contributor Author

🔒 mcpg Read-Only Stress — default

Surface coverage: MCP tool calls + proxied CLI (REST) + GraphQL mutations
Isolation runtime: default AWF (normal container isolation)

Part Surface Op Result Expected Status
A MCP reads (list_issues, list_pull_requests, get_file_contents, list_commits) data returned ALLOWED ✅
B MCP writes (add_issue_comment/star_repository/issue_write/create_branch/create_or_update_file/create_pull_request) all 6 tools absent from the 23-tool catalog — no write tool reachable to call BLOCKED ⚠️
C CLI reads (proxied github CLI: list_issues, list_pull_requests, get_file_contents, list_commits) data returned ALLOWED ✅
D CLI REST writes (reaction/star/issue/comment) gh auth status → not logged in, no hosts authenticated BLOCKED ⚠️
E CLI GraphQL mutations (addReaction/addStar/createIssue) gh unauthenticated, cannot attempt BLOCKED ⚠️

Overall: INCONCLUSIVE

Notes:

  • Parts A and C (reads) fully PASS — gateway correctly serves read-only GitHub MCP tool calls and proxied CLI reads.
  • Part B is INCONCLUSIVE, not a gap: the github CLI/MCP catalog exposed only 23 read-only tools (get_, list_, search_*, issue_read, pull_request_read) — none of the 6 targeted write tools exist in the catalog to call, so no gateway-level refusal could be observed. This matches the documented gh-aw tools.github: behavior (GITHUB_READ_ONLY=1 always set), per the task's architectural note.
  • Parts D/E are INCONCLUSIVE because gh was not authenticated in this job (gh auth status shows no logged-in hosts), so the GitHub-API token-scope boundary could not be exercised this run.
  • No writes were attempted or leaked in this run (all 6 targets were unreachable/unauthenticated by design, per Safety Rules — no retries or workarounds were tried).

🔒 mcpg read-only stress (default AWF runtime) by Read-Only Stress: default runtime

@lpcox

lpcox commented Oct 7, 2026

Copy link
Copy Markdown
Collaborator

Co-authored-by: lpcox <15877973+lpcox@users.noreply.github.com>

Copilot AI commented Oct 7, 2026

Copy link
Copy Markdown
Contributor

@copilot fix the failing lint ci check https://github.com/github/gh-aw-mcpg/actions/runs/37657800140/job/112917270788?pr=14556

Fixed the gofmt issue in internal/cmd/tracing_helpers_test.go and committed as fcdb2da. make lint and the targeted shutdown test pass.

Copilot AI requested a review from lpcox October 7, 2026 17:55
@lpcox
lpcox merged commit 5e2509a into main Oct 7, 2026
28 checks passed
@lpcox
lpcox deleted the test/shutdown-tracing-timeout-0901ce055fa690ad branch October 7, 2026 18:01
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.

3 participants