fix: fix unittest failure when validating gh url#2593
Merged
chmouel merged 1 commit intotektoncd:mainfrom Mar 19, 2026
Conversation
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>
theakshaypant
approved these changes
Mar 19, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
📝 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.Typefield 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:
🔗 Linked GitHub Issue
Fixes #2592
🧪 Testing Strategy
🤖 AI Assistance
✅ Submitter Checklist
make testandmake lintlocallyCo-Authored-By: Claude Opus 4.6 noreply@anthropic.com