-
Notifications
You must be signed in to change notification settings - Fork 1.8k
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 flaky Affinity Assistant test #6925
Fix flaky Affinity Assistant test #6925
Conversation
/kind flake |
[APPROVALNOTIFIER] This PR is APPROVED This pull-request has been approved by: lbernick 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 |
Prior to this commit, the `TestAffinityAssistant_PerWorkspace` integration test validates the lifecycle status of the Affinity Assistant `StatefulSet` of the `pipeleinrun` when it is created and completed. However, the `StatefulSet` cannot be created (and deleted) immediately after the `pipelinerun` is created (and completed) due to API latency, which makes the test flacky (see [example](https://prow.tekton.dev/view/gs/tekton-prow/pr-logs/pull/tektoncd_pipeline/6921/pull-tekton-pipeline-integration-tests/1679203026977427456)). This commit removes statefulset status check in the integration test. This functionality is covered in the [unit test](https://github.com/tektoncd/pipeline/blob/b769b5620300d7fb6d6638083124d03636caa503/pkg/reconciler/pipelinerun/affinity_assistant_test.go#L188). /kind bug
c4e3b9f
to
8d25a18
Compare
/remove-kind bug |
@QuanZhang-William thanks for this PR! |
Ahh, sorry @afrittoli, kind of sending this PR in rush as the CI could be blocked by this test... I have updated the PR message and PTAL |
Thanks for updating the PR.
It removes more than that, it also removes the check that the pipeline terminates successfully.
The unit test covers the functions E2E tests that create resources are always at risk that those resources may take longer to be created and deleted, depending on the status of the cluster and node where the test is running. I think the solution for that is to add a bit of tolerance in the test, in case of a slow node. That does not guarantee that the test will always pass 100% but on a bad or very slow node the tests would most likely fail or timeout anyways. |
This E2E test verifies 2 things: 1) pods sharing the same PVC are scheduled to the same node - so it validates the final result of Affinity Assistant; 2) the state of PVC is in These 2 points cannot be covered by UT
I think the end to end usage of Affinity Assistant is covered in the pipelinerun test?
I'm open to add some tolerance to the test if we are doing it today, but I feel the lifecycle status of the StatefulSet is already covered by UT. This E2E tests just add more coverage on top it. |
Oh, right, I missed the last bit of the test.
I think that the only missing part is the cleanup, which is not covered elsewhere afaik. |
It'd be ok to add the new unit test in a separate PR /lgtm |
Synced with @afrittoli offline. We will merge the PR as it is to unblock CI, I will prioritize to add the discussed coverage by UT in a separate PR. |
When exploring the test I found that we do have UT TestReconcileOnCompletedPipelineRun which tests the cleanup function is called at |
Changes
Prior to this commit, the
TestAffinityAssistant_PerWorkspace
integration test validates the lifecycle status of the Affinity AssistantStatefulSet
of thePipelineRun
when it is created and completed. However, theStatefulSet
cannot be created (and deleted) immediately after thePipelineRun
is created (and completed) due to API latency, which makes the test flaky (see example).This commit removes
StatefulSet
status check in the integration test. This functionality is covered in the unit test./kind flake
Submitter Checklist
As the author of this PR, please check off the items in this checklist:
/kind <type>
. Valid types are bug, cleanup, design, documentation, feature, flake, misc, question, tepRelease Notes