Skip to content

ci: improve sysdig client test coverage#81

Merged
tembleking merged 1 commit into
mainfrom
test/improve-sysdig-client-coverage
May 7, 2026
Merged

ci: improve sysdig client test coverage#81
tembleking merged 1 commit into
mainfrom
test/improve-sysdig-client-coverage

Conversation

@tembleking
Copy link
Copy Markdown
Member

@tembleking tembleking commented Apr 27, 2026

4 functions in client.go had 0% coverage (GetTokenFromContext, GetHostFromContext, WithFallbackAuthentication, WithVersion). New tests exercise auth strategies through the actual client against httptest servers, not as isolated RequestEditorFn unit tests.

Refactors duplicated handler into shared permissionsHandler across TLS and auth tests.

Copilot AI review requested due to automatic review settings April 27, 2026 08:58
@tembleking tembleking requested a review from a team as a code owner April 27, 2026 08:58
Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull request overview

Improves test coverage for Sysdig client authentication/context helpers by exercising the real client against httptest servers (rather than isolated RequestEditorFn unit tests).

Changes:

  • Refactors duplicated test server logic into a reusable permissionsHandler.
  • Adds coverage for context helpers (GetTokenFromContext, GetHostFromContext) including panic paths.
  • Adds authentication/versioning tests for WithHostAndTokenFromContext, WithFallbackAuthentication, and WithVersion.

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

Comment thread internal/infra/sysdig/client_test.go
Comment thread internal/infra/sysdig/client_test.go
@tembleking tembleking merged commit 92c2c9c into main May 7, 2026
10 checks passed
@tembleking tembleking deleted the test/improve-sysdig-client-coverage branch May 7, 2026 07:00
dangaiden pushed a commit that referenced this pull request May 7, 2026
4 functions in client.go had 0% coverage (GetTokenFromContext,
GetHostFromContext, WithFallbackAuthentication, WithVersion). New tests
exercise auth strategies through the actual client against httptest
servers, not as isolated RequestEditorFn unit tests.

Refactors duplicated handler into shared permissionsHandler across TLS
and auth tests.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants