Skip to content

Fix flaky link_validator test by using .invalid TLD - #940

Merged
openshift-merge-bot[bot] merged 1 commit into
openshift:masterfrom
samanthajayasinghe:fix/link-validator-test-use-invalid-tld
Jul 30, 2026
Merged

Fix flaky link_validator test by using .invalid TLD#940
openshift-merge-bot[bot] merged 1 commit into
openshift:masterfrom
samanthajayasinghe:fix/link-validator-test-use-invalid-tld

Conversation

@samanthajayasinghe

@samanthajayasinghe samanthajayasinghe commented Jul 30, 2026

Copy link
Copy Markdown
Contributor

Summary

  • The TestLinkValidator_ValidateLinks/message_with_network_error_URL test was failing because the fake .com domain it relied on started resolving
  • Switched the test URL from http://this-domain-should-not-exist-12345.com to http://this-domain-should-not-exist-12345.invalid, using the IANA-reserved .invalid TLD (RFC 2606) which is guaranteed to never resolve

Test plan

  • go test ./pkg/link_validator/ -v passes
  • All other tests unaffected (go test ./...)

🤖 Generated with Claude Code

Summary by CodeRabbit

  • Tests
    • Updated link validation test data to use a guaranteed-invalid domain for network error scenarios.

The test used a .com domain that started resolving, causing the
network-error test case to pass unexpectedly. Switch to the
IANA-reserved .invalid TLD (RFC 2606) which is guaranteed to
never resolve.

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

coderabbitai Bot commented Jul 30, 2026

Copy link
Copy Markdown

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: Repository: openshift/coderabbit/.coderabbit.yaml

Review profile: CHILL

Plan: Enterprise

Run ID: 01aef4c6-2472-48f8-b5a7-e6307bfb11a3

📥 Commits

Reviewing files that changed from the base of the PR and between 9fb7f0c and 1ba1ee3.

📒 Files selected for processing (1)
  • pkg/link_validator/link_validator_test.go

Walkthrough

The network-error case in TestLinkValidator_ValidateLinks now uses a reserved .invalid domain instead of a .com domain.

Changes

Link validator test

Layer / File(s) Summary
Network-error test input
pkg/link_validator/link_validator_test.go
The test message URL was changed to use a non-existent .invalid domain.

Estimated code review effort: 1 (Trivial) | ~2 minutes

🚥 Pre-merge checks | ✅ 15
✅ Passed checks (15 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title clearly summarizes the main change: fixing the flaky link_validator test by switching to the reserved .invalid TLD.
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.
Stable And Deterministic Test Names ✅ Passed No Ginkgo-style titles are present; the only named subtest is static, and the change affects only a URL in the test body.
Test Structure And Quality ✅ Passed PASS: The change only swaps a flaky test URL to .invalid; the test remains table-driven, cleans up servers with defer, and has no Ginkgo/cluster-timeout issues.
Microshift Test Compatibility ✅ Passed Changed file is a plain Go unit test in pkg/link_validator; no Ginkgo e2e constructs or MicroShift-unsupported APIs are present.
Single Node Openshift (Sno) Test Compatibility ✅ Passed No new Ginkgo/e2e tests were added; this is a standard Go unit test in pkg/link_validator, so SNO assumptions do not apply.
Topology-Aware Scheduling Compatibility ✅ Passed Only pkg/link_validator/link_validator_test.go changed, and it updates a test URL; no deployment, operator, or controller scheduling code was modified.
Ote Binary Stdout Contract ✅ Passed PR only changes a test input string in pkg/link_validator/link_validator_test.go; no main/init/TestMain/suite setup or stdout writes are introduced.
Ipv6 And Disconnected Network Test Compatibility ✅ Passed This is a plain Go unit test, not a Ginkgo e2e test, and it uses a reserved .invalid hostname rather than public internet or IPv4-specific assumptions.
No-Weak-Crypto ✅ Passed PR only changes a test URL to .invalid; no weak crypto, custom crypto, or non-constant-time secret comparison found.
Container-Privileges ✅ Passed Only pkg/link_validator/link_validator_test.go changed; no manifests or privilege-related settings (privileged, hostPID/Network/IPC, SYS_ADMIN, allowPrivilegeEscalation) were added.
No-Sensitive-Data-In-Logs ✅ Passed PR only changes a test URL from .com to .invalid; no logging or sensitive-data handling code was added or modified.
✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests

Comment @coderabbitai help to get the list of available commands.

@openshift-ci
openshift-ci Bot requested review from petrkotas and zmird-r July 30, 2026 01:59
@openshift-ci

openshift-ci Bot commented Jul 30, 2026

Copy link
Copy Markdown
Contributor

@samanthajayasinghe: all tests passed!

Full PR test history. Your PR dashboard.

Details

Instructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the kubernetes-sigs/prow repository. I understand the commands that are listed here.

@geowa4 geowa4 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.

/lgtm

@openshift-ci openshift-ci Bot added the lgtm Indicates that a PR is ready to be merged. label Jul 30, 2026
@openshift-ci

openshift-ci Bot commented Jul 30, 2026

Copy link
Copy Markdown
Contributor

[APPROVALNOTIFIER] This PR is APPROVED

This pull-request has been approved by: geowa4, samanthajayasinghe

The full list of commands accepted by this bot can be found here.

The pull request process is described here

Details Needs approval from an approver in each of these files:

Approvers can indicate their approval by writing /approve in a comment
Approvers can cancel approval by writing /approve cancel in a comment

@openshift-ci openshift-ci Bot added the approved Indicates a PR has been approved by an approver from all required OWNERS files. label Jul 30, 2026
@geowa4

geowa4 commented Jul 30, 2026

Copy link
Copy Markdown
Contributor

Example.com was reserved and intended for this use case right?

@openshift-merge-bot
openshift-merge-bot Bot merged commit 0161c53 into openshift:master Jul 30, 2026
8 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

approved Indicates a PR has been approved by an approver from all required OWNERS files. lgtm Indicates that a PR is ready to be merged.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants