Skip to content

fix: fix unittest failure when validating gh url#2593

Merged
chmouel merged 1 commit intotektoncd:mainfrom
chmouel:issue-2592-failing-unit-test-in-webhook-validation-after-dependency-bump-grpc-1-79-3
Mar 19, 2026
Merged

fix: fix unittest failure when validating gh url#2593
chmouel merged 1 commit intotektoncd:mainfrom
chmouel:issue-2592-failing-unit-test-in-webhook-validation-after-dependency-bump-grpc-1-79-3

Conversation

@chmouel
Copy link
Copy Markdown
Member

@chmouel chmouel commented Mar 19, 2026

📝 Description of the Change

The isGitHubInstance() function was making HTTP HEAD requests to detect GitHub Enterprise (GHE) servers, which was causing test failures when the function attempted to validate hostnames that don't exist in the test environment. This regressed after the gRPC 1.79.3 dependency bump.

Root cause: The function relied on HTTP-based detection as a fallback, which is brittle and network-dependent.

Solution: Updated the function to check the GitProvider.Type field first as the primary source of truth. This avoids unnecessary network calls and makes the webhook validation more robust and testable. The GitProvider type is already set explicitly by the webhook handler based on the provider configuration.

Benefits:

  • Eliminates brittle HTTP-based detection
  • Improves test reliability
  • Reduces unnecessary network calls
  • Makes code behavior explicit and easier to reason about

🔗 Linked GitHub Issue

Fixes #2592

🧪 Testing Strategy

  • Unit tests
  • Integration tests
  • End-to-end tests
  • Manual testing

🤖 AI Assistance

  • Used AI to help with implementation

✅ Submitter Checklist

  • Commit messages follow the project guidelines
  • Ran make test and make lint locally
  • No documentation changes needed
  • Unit tests added/updated
  • Needs API review
  • Needs security review

Co-Authored-By: Claude Opus 4.6 noreply@anthropic.com

The isGitHubInstance function made HTTP HEAD requests to detect GHE
servers, causing test failures when hitting fake hostnames. Check
GitProvider.Type first to avoid unnecessary network calls.

Fixes tektoncd#2592

Signed-off-by: Chmouel Boudjnah <chmouel@redhat.com>
@chmouel chmouel merged commit 8cc1747 into tektoncd:main Mar 19, 2026
13 checks passed
@chmouel chmouel deleted the issue-2592-failing-unit-test-in-webhook-validation-after-dependency-bump-grpc-1-79-3 branch March 19, 2026 07:52
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.

Failing unit test in webhook validation after dependency bump (grpc 1.79.3)

2 participants