Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Split GetPortsAndProtocol function to 4 separate functions #1764

Merged
merged 1 commit into from
Aug 16, 2022

Conversation

panslava
Copy link
Contributor

Return values are independent, and there is no reason to do it in single function

@k8s-ci-robot k8s-ci-robot added cncf-cla: yes Indicates the PR's author has signed the CNCF CLA. size/M Denotes a PR that changes 30-99 lines, ignoring generated files. labels Jul 29, 2022
@k8s-ci-robot k8s-ci-robot requested review from bowei and thockin July 29, 2022 13:30
@k8s-ci-robot k8s-ci-robot added the approved Indicates a PR has been approved by an approver from all required OWNERS files. label Jul 29, 2022
@panslava
Copy link
Contributor Author

/assign cezarygerard

@panslava
Copy link
Contributor Author

panslava commented Aug 2, 2022

/assign bowei

@cezarygerard
Copy link
Contributor

small comments, otherwise LGTM

pkg/loadbalancers/forwarding_rules.go Outdated Show resolved Hide resolved
pkg/loadbalancers/l4.go Outdated Show resolved Hide resolved
pkg/loadbalancers/l4netlb.go Outdated Show resolved Hide resolved
@panslava
Copy link
Contributor Author

panslava commented Aug 4, 2022

I also think I should add Unit tests here, cause these functions were not covered

@panslava panslava force-pushed the split-get-ports-protocol branch from ce607ef to 991df17 Compare August 4, 2022 15:33
@k8s-ci-robot k8s-ci-robot added size/L Denotes a PR that changes 100-499 lines, ignoring generated files. needs-rebase Indicates a PR cannot be merged because it has merge conflicts with HEAD. and removed size/M Denotes a PR that changes 30-99 lines, ignoring generated files. labels Aug 4, 2022
@panslava panslava force-pushed the split-get-ports-protocol branch from 991df17 to eff3a02 Compare August 9, 2022 11:09
@k8s-ci-robot k8s-ci-robot removed the needs-rebase Indicates a PR cannot be merged because it has merge conflicts with HEAD. label Aug 9, 2022
Copy link
Contributor

@cezarygerard cezarygerard left a comment

Choose a reason for hiding this comment

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

just readability concerns

again ;-)

}
}

func TestGetPorts(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.

this does not need to be a table test
but I can live with it ;-)

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I think there is some value in checking it for "edge" condition (empty slice) and with some real value

Copy link
Contributor

Choose a reason for hiding this comment

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

yeah, I did not notice that the test actually has more than 1 condition.

pkg/utils/utils_test.go Show resolved Hide resolved
pkg/utils/utils_test.go Outdated Show resolved Hide resolved
pkg/utils/utils_test.go Show resolved Hide resolved
Return values are independent, and there is no reason to do it in single
function
@panslava panslava force-pushed the split-get-ports-protocol branch from eff3a02 to 25758ef Compare August 16, 2022 10:14
@cezarygerard
Copy link
Contributor

/lgtm

@k8s-ci-robot k8s-ci-robot added the lgtm "Looks good to me", indicates that a PR is ready to be merged. label Aug 16, 2022
@k8s-ci-robot
Copy link
Contributor

[APPROVALNOTIFIER] This PR is APPROVED

This pull-request has been approved by: cezarygerard, panslava

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

The pull request process is described here

Needs approval from an approver in each of these files:
  • OWNERS [cezarygerard,panslava]

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

@k8s-ci-robot k8s-ci-robot merged commit be8700f into kubernetes:master Aug 16, 2022
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. cncf-cla: yes Indicates the PR's author has signed the CNCF CLA. lgtm "Looks good to me", indicates that a PR is ready to be merged. 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.

4 participants