Skip to content

Conversation

@intojhanurag
Copy link
Member

Follow up: #3275

@knative-prow
Copy link

knative-prow bot commented Dec 11, 2025

[APPROVALNOTIFIER] This PR is NOT APPROVED

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

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

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

@knative-prow knative-prow bot added the size/L Denotes a PR that changes 100-499 lines, ignoring generated files. label Dec 11, 2025
@knative-prow knative-prow bot added size/M Denotes a PR that changes 30-99 lines, ignoring generated files. and removed size/L Denotes a PR that changes 100-499 lines, ignoring generated files. labels Dec 11, 2025
@codecov
Copy link

codecov bot commented Dec 11, 2025

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 54.71%. Comparing base (be256cd) to head (f0f35b7).

Additional details and impacted files
@@            Coverage Diff             @@
##             main    #3293      +/-   ##
==========================================
- Coverage   54.74%   54.71%   -0.03%     
==========================================
  Files         168      168              
  Lines       19605    19602       -3     
==========================================
- Hits        10732    10726       -6     
- Misses       7807     7811       +4     
+ Partials     1066     1065       -1     
Flag Coverage Δ
e2e 40.32% <33.33%> (+<0.01%) ⬆️
e2e go 36.28% <33.33%> (-0.01%) ⬇️
e2e node 31.74% <0.00%> (+0.01%) ⬆️
e2e python 35.93% <33.33%> (-0.09%) ⬇️
e2e quarkus 31.89% <0.00%> (+0.01%) ⬆️
e2e rust 31.32% <0.00%> (-0.02%) ⬇️
e2e springboot 31.37% <0.00%> (+0.03%) ⬆️
e2e typescript 31.86% <0.00%> (+0.01%) ⬆️
integration 17.72% <0.00%> (+0.01%) ⬆️
unit macos-14 44.42% <100.00%> (+0.02%) ⬆️
unit macos-latest 44.42% <100.00%> (+0.01%) ⬆️
unit ubuntu-24.04-arm 44.62% <100.00%> (+0.02%) ⬆️
unit ubuntu-latest 45.34% <100.00%> (+0.01%) ⬆️
unit windows-latest 44.45% <100.00%> (+0.01%) ⬆️

Flags with carried forward coverage won't be shown. Click here to find out more.

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

@intojhanurag
Copy link
Member Author

/ok-to-test

@knative-prow knative-prow bot added the ok-to-test Indicates a non-member PR verified by an org member that is safe to test. label Dec 12, 2025
@intojhanurag
Copy link
Member Author

intojhanurag commented Dec 12, 2025

Hey @gauron99 , Please take a look on it . I added the suggestions of the preivous PR ( because that PR was messed up ).

Copy link
Contributor

@gauron99 gauron99 left a comment

Choose a reason for hiding this comment

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

Thanks! just a few naming nits. See below

Comment on lines 35 to 38
if val == "" {
val = "localhost"
}
return val, "8080"
Copy link
Contributor

Choose a reason for hiding this comment

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

use the default values defined as variables for host and port. Also the TODO at the top of the file // TODO allow to be altered via a runOpt can be removed since we are adding this option to edit the host

Comment on lines 45 to 48
name string
val string
host string
port string
Copy link
Contributor

Choose a reason for hiding this comment

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

can we name this something clearer like expectedHost and expectedPort? so its clear that those values are an expected result. Or the other way around; specify input or inputString instead of the ambiguous val

err io.Writer
}

func ParseAddressFlag(val string) (string, string) {
Copy link
Contributor

Choose a reason for hiding this comment

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

Suggested change
func ParseAddressFlag(val string) (string, string) {
func ParseAddress(val string) (string, string) {

}
}

func TestParseAddressFlag(t *testing.T) {
Copy link
Contributor

Choose a reason for hiding this comment

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

Suggested change
func TestParseAddressFlag(t *testing.T) {
func TestParseAddress(t *testing.T) {

@knative-prow knative-prow bot added size/L Denotes a PR that changes 100-499 lines, ignoring generated files. and removed size/M Denotes a PR that changes 30-99 lines, ignoring generated files. labels Dec 12, 2025
@intojhanurag
Copy link
Member Author

Hey @gauron99 , Now is it good to go ?

Copy link
Contributor

@gauron99 gauron99 left a comment

Choose a reason for hiding this comment

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

Thanks for the cleanups. I reviewed the functionality and have some suggestions. I tested the functionality a little locally and I think my suggestions should cover all the cases. If you discover something Im missing please let me know!

}
}

func TestParseAddress(t *testing.T) {
Copy link
Contributor

Choose a reason for hiding this comment

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

every case which has implicit defaulting should expect the defaultX variable value instead of hardcoded string so the test doesnt have to be re-written if the default changes

}
}
host, port := ParseAddress(address)
explicitPort := address != "" && strings.Contains(address, ":")
Copy link
Contributor

Choose a reason for hiding this comment

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

this : check wont work. IPv6 addresses contain the symbol and also for IPv4 you can specify host like this 127.0.0.1: - SplitHostPort accepts this just fine. I would add a return value to ParseAddress which specifies if port was or was not given. This way we can decide when we know if we are returning defaultPort or port because it was specified in the address flag. Check my comment for the ParseAddress function.

Comment on lines 30 to 39
func ParseAddress(val string) (string, string) {
if h, p, err := net.SplitHostPort(val); err == nil {
return h, p
}

if val == "" {
return defaultRunHost, defaultRunPort
}
return val, defaultRunPort
}
Copy link
Contributor

Choose a reason for hiding this comment

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

I would leverage the net library and rely on what it accepts - adhering to the standards that are already used in this default, widely used package. The one exception is the last return which returns the given value val as host and adds the default Port. I think this should cover all the cases?
The suggestion below is a pseudo-code.

Suggested change
func ParseAddress(val string) (string, string) {
if h, p, err := net.SplitHostPort(val); err == nil {
return h, p
}
if val == "" {
return defaultRunHost, defaultRunPort
}
return val, defaultRunPort
}
func ParseAddress(val string) (host, port string, explicitPort bool) {
if val == "" {
return defaultRunHost, defaultRunPort
// explicit port false
}
if h, p, err := net.SplitHostPort(val); err == nil {
if h == "" {
// set default host to return value
}
if p == "" {
// set default port
// explicitPort is false
} else {
// set explicit port to true
}
return
}
return val, defaultRunPort
// explicit port is false
}

@intojhanurag
Copy link
Member Author

intojhanurag commented Dec 13, 2025

Hey @gauron99, PTAL now , Good eye btw :)

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

Labels

ok-to-test Indicates a non-member PR verified by an org member that is safe to test. size/L Denotes a PR that changes 100-499 lines, ignoring generated files.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants