Skip to content

e2e-aws-operator: Fix machinehealthcheck test - #60

Closed
vikaschoudhary16 wants to merge 1 commit into
openshift:masterfrom
vikaschoudhary16:fix-e2e-aws-operator
Closed

vikaschoudhary16 wants to merge 1 commit into
openshift:masterfrom
vikaschoudhary16:fix-e2e-aws-operator

Conversation

@vikaschoudhary16

Copy link
Copy Markdown
Contributor

In the current test, BeforeEach() gets executed for this It. This Before reach deletes configmap as well and when, actually [stopKubeletAndValidateMachineDeletion](https://github.com/openshift/cluster-api-actuator-pkg/blob/master/pkg/e2e/machinehealthcheck/machinehealthcheck.go#L117) gets invoked again, there is no configmap and it fails to validate node deletion. And thus test failure!!

I verified this behavior running these tests locally and it occurs every time.

This PR is simplifying the nesting of BeforeEach and AfterEach. If the intention of the existing changes and this nesting is to execute stopKubeletAndValidateMachineDeletion twice for two machines, we can achieve that by simply copy pasting IT block in this PR.

@openshift-ci-robot openshift-ci-robot added the size/M Denotes a PR that changes 30-99 lines, ignoring generated files. label Apr 12, 2019
@vikaschoudhary16 vikaschoudhary16 changed the title Fix machinehealthcheck test e2e-aws-operator: Fix machinehealthcheck test Apr 12, 2019
@enxebre

enxebre commented Apr 12, 2019

Copy link
Copy Markdown
Member

ping @cynepco3hahue

@vikaschoudhary16

Copy link
Copy Markdown
Contributor Author

/retest

1 similar comment
@enxebre

enxebre commented Apr 12, 2019

Copy link
Copy Markdown
Member

/retest

@enxebre

enxebre commented Apr 12, 2019

Copy link
Copy Markdown
Member

/approve

@openshift-ci-robot

Copy link
Copy Markdown

[APPROVALNOTIFIER] This PR is APPROVED

This pull-request has been approved by: enxebre

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

The pull request process is described 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

@openshift-ci-robot openshift-ci-robot added the approved Indicates a PR has been approved by an approver from all required OWNERS files. label Apr 12, 2019

@cynepco3hahue cynepco3hahue left a comment •

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

I added two tests because we have default behavior when the configmap does not exist with the default timeout that equals to 5 minutes. I ask to preserve tests as it was before, the single thing that can be useful is to clarify via comment why we have two tests.

@cynepco3hahue

Copy link
Copy Markdown
Contributor

@vikaschoudhary16 Can you provide the link where does it fail?

@cynepco3hahue

cynepco3hahue commented Apr 14, 2019 •

Copy link
Copy Markdown
Contributor

From logs, I can see that machine was deleted by the machine health check controller, but the machine-api failed to remove finalizer

I0414 10:49:25.509708       1 controller.go:209] Deleting node "ip-10-0-129-168.ec2.internal" for machine "ci-op-5r3bjbhs-79b09-fvxxn-worker-us-east-1a-ls4t7"
E0414 10:49:25.525278       1 controller.go:219] Failed to remove finalizer from machine "ci-op-5r3bjbhs-79b09-fvxxn-worker-us-east-1a-ls4t7": Operation cannot be fulfilled on machines.machine.openshift.io "ci-op-5r3bjbhs-79b09-fvxxn-worker-us-east-1a-ls4t7": the object has been modified; please apply your changes to the latest version and try again
...
I0414 10:49:26.531912       1 controller.go:128] Reconciling Machine "ci-op-5r3bjbhs-79b09-fvxxn-worker-us-east-1a-ls4t7"
I0414 10:49:26.531931       1 controller.go:300] Machine "ci-op-5r3bjbhs-79b09-fvxxn-worker-us-east-1a-ls4t7" in namespace "cluster.k8s.io/cluster-name" doesn't specify "openshift-machine-api" label, assuming nil cluster
I0414 10:49:26.531947       1 controller.go:185] Reconciling machine "ci-op-5r3bjbhs-79b09-fvxxn-worker-us-east-1a-ls4t7" triggers delete

And probably after it fails on drainNode, so the finalizer never removed.

@cynepco3hahue

Copy link
Copy Markdown
Contributor

I created the PR - #62, it will remove finalizer when it needs to be removed, but I think it looks like the bug under the machine-api code.
@ingvagabund @enxebre Guys, what do you think regarding #60 (comment)? Does it bug under the machine-api controller?

@ingvagabund

Copy link
Copy Markdown
Member

E0414 10:49:25.525278 1 controller.go:219] Failed to remove finalizer from machine "ci-op-5r3bjbhs-79b09-fvxxn-worker-us-east-1a-ls4t7": Operation cannot be fulfilled on machines.machine.openshift.io "ci-op-5r3bjbhs-79b09-fvxxn-worker-us-east-1a-ls4t7": the object has been modified; please apply your changes to the latest version and try again

@cynepco3hahue this basically says the finalizer could not be removed since the machine object on the apiserver is never than the one the machine controller actually works with. That error is expected and the machine is reconciled again. It will get removed in the next reconciliation cycle.

What's important are those two lines:

E0414 10:49:25.525278       1 controller.go:219] Failed to remove finalizer from machine "ci-op-5r3bjbhs-79b09-fvxxn-worker-us-east-1a-ls4t7": Operation cannot be fulfilled on machines.machine.openshift.io "ci-op-5r3bjbhs-79b09-fvxxn-worker-us-east-1a-ls4t7": the object has been modified; please apply your changes to the latest version and try again
...
I0414 10:49:26.531947       1 controller.go:185] Reconciling machine "ci-op-5r3bjbhs-79b09-fvxxn-worker-us-east-1a-ls4t7" triggers delete

The first line reporting the unsuccessful Update operation. The other one saying the machine got reconciled again after some time and is to be deleted. Can you share more logs? I would expect the machine controller to eventually log something like: Machine "ci-op-5r3bjbhs-79b09-fvxxn-worker-us-east-1a-ls4t7" deletion successful.

@enxebre

enxebre commented Apr 15, 2019

Copy link
Copy Markdown
Member

/hold

@openshift-ci-robot openshift-ci-robot added the do-not-merge/hold Indicates that a PR should not merge because someone has issued a /hold command. label Apr 15, 2019
@openshift-ci-robot openshift-ci-robot added size/XS Denotes a PR that changes 0-9 lines, ignoring generated files. and removed size/M Denotes a PR that changes 30-99 lines, ignoring generated files. labels Apr 15, 2019
@vikaschoudhary16

Copy link
Copy Markdown
Contributor Author

@cynepco3hahue For me it fails consistently. Checking the machine controller logs, i can see that finalizer gets removed and machine gets deleted eventually though the test fails.

When i increased test case timeout to 7 minutes, it worked. Since this failure has been seen at CI as well, i propose to increase the time out and also wrapping the test for default case in proper context message.

@ingvagabund

Copy link
Copy Markdown
Member

@vikaschoudhary16 as you say: openshift/machine-api-operator#285 (comment)

@cynepco3hahue it takes more than 6 minutes. In my case it took 8 minutes (without 3 seconds) to wait until a machine gets deleted.

stopKubeletAndValidateMachineDeletion(workerNode, workerMachine, 6*time.Minute)
Context("without node-unhealthy-conditions configmap", func() {
It("should delete unhealthy machine", func() {
stopKubeletAndValidateMachineDeletion(workerNode, workerMachine, 7*time.Minute)

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

I don't see how putting the It clause under Context help with to fix this test. It just might be the timeout that got increased that helped. We might bump the timeout to even 10 minutes. Though, that will only hide the real issue. This might also be a bug in the HC itself.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

putting IT under context is just adding correct description about test case.

5 minutes is timeout in the configmap so machine deletion get triggered after 5 minutes. With keeping test case timeout as 7 min, effectively it is waiting for 2 mins. If we still see I failures, we can debug where exactly its taking delayed. For now, i would prefer to try out 7 min timeout.

@vikaschoudhary16

Copy link
Copy Markdown
Contributor Author

/test e2e-aws-operator

@ingvagabund

Copy link
Copy Markdown
Member

/lgtm

@openshift-ci-robot openshift-ci-robot added the lgtm Indicates that a PR is ready to be merged. label Apr 16, 2019
@enxebre

enxebre commented Apr 16, 2019

Copy link
Copy Markdown
Member

this test is disabled now until we get back CI stability, this change should be introduced as we enable it back so it gives a green

@vikaschoudhary16

Copy link
Copy Markdown
Contributor Author

This got obsoleted and superceded by other PRs so closing it.

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. do-not-merge/hold Indicates that a PR should not merge because someone has issued a /hold command. lgtm Indicates that a PR is ready to be merged. size/XS Denotes a PR that changes 0-9 lines, ignoring generated files.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants