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

Refactor l4_test assertInternalLbResourcesDeleted function #1805

Merged

Conversation

panslava
Copy link
Contributor

@panslava panslava commented Sep 9, 2022

Split assertInternalLbResourcesDeleted function in l4_test to smaller functions which separately check that forwarding rule, health check, firewall etc were deleted

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

panslava commented Sep 9, 2022

/assign cezarygerard

@panslava panslava force-pushed the refactor-l4_test-assert-delete branch from d82032a to 7ee7b9d Compare September 9, 2022 14:14
@k8s-ci-robot k8s-ci-robot 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 Sep 9, 2022
t.Errorf("verifyHealthCheckNotExists(_, %s)", hcNameShared)
}

hcNameNonShared := l4.namer.L4HealthCheck(l4.Service.Namespace, l4.Service.Name, true)
Copy link
Contributor

Choose a reason for hiding this comment

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

last arg should be false
or better:
last arg should be named variable
or event better
L4ResourcesNamer interface should have 2 methods, with no bool arg

  • L4SharedHealthCheck
  • L4NonSharedHealthCheck

also currently make test passes so it means the tests are rather poor :-/
maybe create and delete ilb service with externaltrafficpolicy:local ?

Copy link
Contributor Author

@panslava panslava Sep 10, 2022

Choose a reason for hiding this comment

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

Thank you for catching this, fixed

I agree about namer, but I don't think it should be changed in this PR

make test passes, but it is hard to imagine them to fall in this "typo" case, even in perfect scenario, cause we just checking twice that sharedHC was deleted

Copy link
Contributor

Choose a reason for hiding this comment

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

make test passes, but it is hard to imagine them to fall in this "typo" case, even in perfect scenario, cause we just checking twice that sharedHC was deleted

right, you would need to fix the the test AND break the actual controller logic, to see the test fail :-/

NVM

pkg/loadbalancers/l4_test.go Outdated Show resolved Hide resolved
pkg/loadbalancers/l4_test.go Outdated Show resolved Hide resolved
pkg/loadbalancers/l4_test.go Outdated Show resolved Hide resolved
pkg/loadbalancers/l4_test.go Outdated Show resolved Hide resolved
pkg/loadbalancers/l4_test.go Outdated Show resolved Hide resolved
@panslava panslava force-pushed the refactor-l4_test-assert-delete branch from 7ee7b9d to ebc0eab Compare September 10, 2022 10:19
@panslava panslava requested review from cezarygerard and removed request for rramkumar1 September 10, 2022 10:19
@cezarygerard
Copy link
Contributor

Slavik, please add proper description to this PR

@panslava
Copy link
Contributor Author

@cezarygerard thank you, done

@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 Sep 12, 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 0a17ebc into kubernetes:master Sep 12, 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.

None yet

3 participants