-
Notifications
You must be signed in to change notification settings - Fork 431
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
Fix tests in bastion_hosts_test.go
file
#1754
Conversation
Hi @karuppiah7890. Thanks for your PR. I'm waiting for a kubernetes-sigs member to verify that this patch is reasonable to test. If it is, they should reply with Once the patch is verified, the new status will be reflected by the I understand the commands that are listed here. 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/test-infra repository. |
/ok-to-test |
/test pull-cluster-api-provider-azure-e2e |
606ff86
to
002984f
Compare
002984f
to
7cb0828
Compare
Sorry about the messy diff. I reordered the tests to put failure scenarios first and then finally the success scenario, for both Reconcile and Delete test |
- Remove `create publicip fails` test in bastion host `Reconcile` test as we don't create public IP as part of bastion host `Reconcile` - Remove `bastion successfully created with created public ip` test in bastion host `Reconcile` test as we don't create public IP as part of bastion host `Reconcile` - Remove unnecessary / wrong method call expectations using mocks - `mPublicIP.CreateOrUpdate` method call expectations - `m.Delete(gomockinternal.AContext(), "my-rg", "my-bastionhost1")` expectation - Fix the order of method call expectations using mocks - `mPublicIP.Get` gets called before `mSubnet.Get` - Comment out `t.Parallel` temporarily with details about the removal of parallelization - tldr; enabling parallel tests seems to give wrong test results - Fix the expected error messages Signed-off-by: Karuppiah Natarajan <[email protected]>
7cb0828
to
bcfe2cd
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
/lgtm
/assign @CecileRobertMichon
Much better!
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
/lgtm
) | ||
}, | ||
}, | ||
} | ||
|
||
for _, tc := range testcases { | ||
tc := tc |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Nice find!
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
/approve
[APPROVALNOTIFIER] This PR is APPROVED This pull-request has been approved by: CecileRobertMichon 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:
Approvers can indicate their approval by writing |
/kind bug
/kind cleanup
/kind failing-test
/kind flake
What this PR does / why we need it:
Fixes #1753
This PR fixes some of the tests in
bastion_hosts_test.go
filef737685 commit made some changes to how
bastionhosts
serviceReconcile
method works and removed the creation of public IP from thebastionhosts
service'sReconcile
logic and moved it intopublicips
serviceReconcile
logic by just defining a public ip spec for the bastion host in the cluster scope. The tests were not changed to as part of this commit though, to reflect the changed code. And for some reason the tests passed, though the tests should have ideally failed due to the code change but no test change. This shows there's some shady behavior that we are yet to uncover, leading to false results, in this case false passing tests when the tests should have failedThis PR does the following
create publicip fails
test in bastion hostReconcile
test as we don't create public IP as part of bastion hostReconcile
mPublicIP.CreateOrUpdate
method call expectationsm.Delete(gomockinternal.AContext(), "my-rg", "my-bastionhost1")
expectationmPublicIP.Get
gets called beforemSubnet.Get
t.Parallel
temporarily with details about the removal of parallelization - tldr; enabling parallel tests seems to give wrong test resultsWhich issue(s) this PR fixes:
Fixes #1753
Special notes for your reviewer:
TODOs:
addsmodifies unit testsRelease note: