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

Fix populators not repopulating pvc after it was deleted #3056

Merged

Conversation

ShellyKa13
Copy link
Contributor

What this PR does / why we need it:
This PR should fix this bug:
Jira-ticket: https://issues.redhat.com/browse/CNV-35085

Which issue(s) this PR fixes (optional, in fixes #<issue number>(, fixes #<issue_number>, ...) format, will close the issue(s) when PR gets merged):
Fixes #CNV-35085

Special notes for your reviewer:

Release note:

None

@kubevirt-bot kubevirt-bot added release-note-none Denotes a PR that doesn't merit a release note. dco-signoff: yes Indicates the PR's author has DCO signed all their commits. size/L labels Jan 9, 2024
@ShellyKa13 ShellyKa13 force-pushed the fix-populators-not-repopulating-pvc branch from fd6becd to 108ba33 Compare January 9, 2024 14:25
@akalenyu
Copy link
Collaborator

/retest
failures not related to PR

@@ -138,6 +138,33 @@ var _ = Describe("all clone tests", func() {
Expect(uploader.DeletionTimestamp).To(BeNil())
})

It("should recreate and reclone target pvc if it was deleted", func() {
Copy link
Collaborator

Choose a reason for hiding this comment

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

So this test will actually run Serially since it's under Describe("[rfe_id:1277][crit:high][vendor:cnv-qe@redhat.com][level:component]Cloner Test Suite", Serial, func()
Can we maybe move it around so it can run parallel, or is there a constraint I am missing?

Copy link
Contributor Author

@ShellyKa13 ShellyKa13 Jan 11, 2024

Choose a reason for hiding this comment

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

yes sure thanks for noticing, I guess it was introduced recently

Comment on lines 2093 to 2095
By("Verify PVC prime was created")
pvcPrime, err = utils.WaitForPVC(f.K8sClient, pvc.Namespace, populators.PVCPrimeName(pvc))
Expect(err).ToNot(HaveOccurred())
Copy link
Collaborator

@arnongilboa arnongilboa Jan 10, 2024

Choose a reason for hiding this comment

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

Just a dumb question (I guess this is done in many tests), can't PVC prime already be deleted in this point if import was quick enough to complete? and why are you verifying it's creation in this flow? I guess PVC bound and verifying the content in the end are more than enough?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

yeah I agree, I did several changes in this test, since I found the deletePVCByUID then its safe enough to see that the new created PVC became bound again.. (I had a race there with the get). Ill simplify the test more.

Signed-off-by: Shelly Kagan <skagan@redhat.com>
In case someone deleted the pvc a new pvc is created and the
status of the dv is still succeded. when using populators
in order for the population to restart and the dv state to change accordingly
we need to retrigger the population, this depends on the existing of the source CR.
That CR should exist as long as the pvc pod state is not succeeded.
When the pvc is recreated the succeded pod state annotation was removed.
Adjusted UT accordingly

Signed-off-by: Shelly Kagan <skagan@redhat.com>
Move cloner test to a parallel test suite.
Simplify import test.

Signed-off-by: Shelly Kagan <skagan@redhat.com>
@ShellyKa13 ShellyKa13 force-pushed the fix-populators-not-repopulating-pvc branch from 108ba33 to 4188a86 Compare January 11, 2024 10:42
@alromeros
Copy link
Collaborator

Looks really good. Maybe add an upload functional test?

@akalenyu
Copy link
Collaborator

akalenyu commented Jan 14, 2024

Looks really good. Maybe add an upload functional test?

Random question. Did we not ever have tests that check the PVC recreated & repopulated upon deletion?
Do those exist, and for some reason not use populators?

@ShellyKa13
Copy link
Contributor Author

@akalenyu hmm from what I saw I didnt find any..
@alromeros the pipeline of upload populator is like the import populator, so I thought that UT for both and functest for import is enough..

@akalenyu
Copy link
Collaborator

hmm from what I saw I didnt find any..

There's

It("[test_id:4962]Should create a new PVC when PVC is deleted during import", func() {

@ShellyKa13
Copy link
Contributor Author

hmm from what I saw I didnt find any..

There's

It("[test_id:4962]Should create a new PVC when PVC is deleted during import", func() {

Yeah this is different since we delete the pvc during the import so the dv haven't reached succeeded state yet thatss why we didnt catch the bug

@ShellyKa13
Copy link
Contributor Author

@akalenyu @alromeros @arnongilboa can you review again?

@alromeros
Copy link
Collaborator

/lgtm

@kubevirt-bot kubevirt-bot added the lgtm Indicates that a PR is ready to be merged. label Jan 15, 2024
@akalenyu
Copy link
Collaborator

cc @mhenriks
I am fine with the test changes I was suggesting

@mhenriks
Copy link
Member

/approve

@kubevirt-bot
Copy link
Contributor

[APPROVALNOTIFIER] This PR is APPROVED

This pull-request has been approved by: mhenriks

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 /approve in a comment
Approvers can cancel approval by writing /approve cancel in a comment

@kubevirt-bot kubevirt-bot added the approved Indicates a PR has been approved by an approver from all required OWNERS files. label Jan 16, 2024
@kubevirt-bot kubevirt-bot merged commit 40a382d into kubevirt:main Jan 17, 2024
18 checks passed
@ShellyKa13
Copy link
Contributor Author

/cherrypick release-v1.57

@kubevirt-bot
Copy link
Contributor

@ShellyKa13: #3056 failed to apply on top of branch "release-v1.57":

Applying: Add tests to verify pvc is recreated and repopulated after delete
Using index info to reconstruct a base tree...
M	tests/cloner_test.go
M	tests/import_test.go
M	tests/utils/datavolume.go
M	tests/utils/pvc.go
Falling back to patching base and 3-way merge...
Auto-merging tests/utils/pvc.go
Auto-merging tests/utils/datavolume.go
Auto-merging tests/import_test.go
CONFLICT (content): Merge conflict in tests/import_test.go
Auto-merging tests/cloner_test.go
error: Failed to merge in the changes.
hint: Use 'git am --show-current-patch=diff' to see the failed patch
Patch failed at 0001 Add tests to verify pvc is recreated and repopulated after delete
When you have resolved this problem, run "git am --continue".
If you prefer to skip this patch, run "git am --skip" instead.
To restore the original branch and stop patching, run "git am --abort".

In response to this:

/cherrypick release-v1.57

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.

@jpeimer
Copy link
Contributor

jpeimer commented Jan 17, 2024

Needs a backport to 1.58 as well

@ShellyKa13
Copy link
Contributor Author

/cherrypick release-v1.58

@kubevirt-bot
Copy link
Contributor

@ShellyKa13: new pull request created: #3071

In response to this:

/cherrypick release-v1.58

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.

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. dco-signoff: yes Indicates the PR's author has DCO signed all their commits. lgtm Indicates that a PR is ready to be merged. release-note-none Denotes a PR that doesn't merit a release note. size/L
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

7 participants