Skip to content

[test-improver] Improve tests for tracing.InitProvider#9606

Merged
lpcox merged 1 commit into
mainfrom
test-improver/tracing-provider-all-exporters-fail-d2f1ae0ee81cecce
Jul 19, 2026
Merged

[test-improver] Improve tests for tracing.InitProvider#9606
lpcox merged 1 commit into
mainfrom
test-improver/tracing-provider-all-exporters-fail-d2f1ae0ee81cecce

Conversation

@github-actions

Copy link
Copy Markdown
Contributor

Summary

Adds test coverage for the InitProvider error path in internal/tracing/provider.go.

File analyzed

internal/tracing/provider_test.go

Improvement made

Added TestInitProvider_AllExportersFail which covers the previously untested len(exporters) == 0 guard (lines 177-179 of provider.go). A pre-cancelled context causes otlptracehttp.New to return immediately with context canceled, so every exporter in the loop fails and the function returns an error.

Coverage

Before After
internal/tracing 96.5% 97.8%
InitProvider 81.7% 88.3%

Test output

ok      github.com/github/gh-aw-mcpg/internal/tracing   0.039s

Warning

Firewall blocked 1 domain

The following domain was blocked by the firewall during workflow execution:

  • awmgmcpg

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

network:
  allowed:
    - defaults
    - "awmgmcpg"

See Network Configuration for more information.

Generated by Test Improver · 128.9 AIC · ⊞ 5.5K ·

Add TestInitProvider_AllExportersFail to cover the code path in
InitProvider where every OTLP exporter fails to initialize.  A
pre-cancelled context causes otlptracehttp.New to return an error
immediately, which exercises the 'len(exporters) == 0' guard that
returns an error (provider.go:177-179).

Coverage: internal/tracing 96.5% → 97.8%

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
@lpcox
lpcox marked this pull request as ready for review July 19, 2026 06:05
Copilot AI review requested due to automatic review settings July 19, 2026 06:05

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.

Pull request overview

Adds coverage for InitProvider when all OTLP exporters fail initialization.

Changes:

  • Adds a pre-cancelled-context test for the zero-exporter error path.
  • Verifies the provider is nil and the expected error is returned.
Show a summary per file
File Description
internal/tracing/provider_test.go Tests failed OTLP exporter initialization.

Review details

Tip

Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

  • Files reviewed: 1/1 changed files
  • Comments generated: 0
  • Review effort level: Medium

@lpcox
lpcox merged commit 1486415 into main Jul 19, 2026
21 checks passed
@lpcox
lpcox deleted the test-improver/tracing-provider-all-exporters-fail-d2f1ae0ee81cecce branch July 19, 2026 06:11
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.

2 participants