Skip to content

CNF-24259: Consolidate duplicate normalizeHost functions#72

Open
sebrandon1 wants to merge 1 commit into
openshift:mainfrom
sebrandon1:consolidate-normalize-host
Open

CNF-24259: Consolidate duplicate normalizeHost functions#72
sebrandon1 wants to merge 1 commit into
openshift:mainfrom
sebrandon1:consolidate-normalize-host

Conversation

@sebrandon1

Copy link
Copy Markdown
Member

Summary

  • Replace three identical host-normalization functions with a single exported stringutil.NormalizeHost()
  • All three trimmed whitespace and stripped IPv6 square brackets with the same 5-line body
  • Add 9 test cases covering IPv4, IPv6 (bracketed/unbracketed), whitespace, empty, and hostname inputs

Jira: CNF-24259

Functions removed

Function File
normalizeHost() cmd/tls-scanner/main.go
normalizeTargetHost() internal/scanner/scanner.go
normalizeTemplateHost() internal/scanner/template.go

Replaced with

stringutil.NormalizeHost() in internal/stringutil/stringutil.go

Test plan

  • go build ./... passes
  • go test ./... passes
  • make lint passes
  • New TestNormalizeHost covers 9 input variants

@openshift-ci-robot openshift-ci-robot added the jira/valid-reference Indicates that this PR references a valid Jira ticket of any type. label May 29, 2026
@openshift-ci-robot

openshift-ci-robot commented May 29, 2026

Copy link
Copy Markdown

@sebrandon1: This pull request references CNF-24259 which is a valid jira issue.

Warning: The referenced jira issue has an invalid target version for the target branch this PR targets: expected the story to target the "5.0.0" version, but no target version was set.

Details

In response to this:

Summary

  • Replace three identical host-normalization functions with a single exported stringutil.NormalizeHost()
  • All three trimmed whitespace and stripped IPv6 square brackets with the same 5-line body
  • Add 9 test cases covering IPv4, IPv6 (bracketed/unbracketed), whitespace, empty, and hostname inputs

Jira: CNF-24259

Functions removed

Function File
normalizeHost() cmd/tls-scanner/main.go
normalizeTargetHost() internal/scanner/scanner.go
normalizeTemplateHost() internal/scanner/template.go

Replaced with

stringutil.NormalizeHost() in internal/stringutil/stringutil.go

Test plan

  • go build ./... passes
  • go test ./... passes
  • make lint passes
  • New TestNormalizeHost covers 9 input variants

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 openshift-eng/jira-lifecycle-plugin repository.

@openshift-ci

openshift-ci Bot commented May 29, 2026

Copy link
Copy Markdown

[APPROVALNOTIFIER] This PR is NOT APPROVED

This pull-request has been approved by: sebrandon1
Once this PR has been reviewed and has the lgtm label, please assign smith-xyz for approval. For more information see the Code Review Process.

The full list of commands accepted by this bot can be found 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

@sebrandon1 sebrandon1 force-pushed the consolidate-normalize-host branch from 6d53d38 to 7264487 Compare June 1, 2026 21:35
@sebrandon1

Copy link
Copy Markdown
Member Author

/retest

@sebrandon1 sebrandon1 force-pushed the consolidate-normalize-host branch 2 times, most recently from 9aba608 to c70ba90 Compare June 8, 2026 21:55
@sebrandon1 sebrandon1 force-pushed the consolidate-normalize-host branch from c70ba90 to ea25e0c Compare June 15, 2026 17:29
@sebrandon1 sebrandon1 force-pushed the consolidate-normalize-host branch from ea25e0c to 198094c Compare June 18, 2026 17:32
@openshift-ci

openshift-ci Bot commented Jun 18, 2026

Copy link
Copy Markdown

@sebrandon1: 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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

jira/valid-reference Indicates that this PR references a valid Jira ticket of any type.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants