Skip to content

Commit

Permalink
fixup! make sure export data upload job is not created before export …
Browse files Browse the repository at this point in the history
…job is completed
  • Loading branch information
ushitora-anqou committed Nov 8, 2024
1 parent aefbb65 commit c07278f
Showing 1 changed file with 13 additions and 10 deletions.
23 changes: 13 additions & 10 deletions internal/controller/mantlebackup_controller_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -505,16 +505,19 @@ var _ = Describe("MantleBackup controller", func() {
Expect(isFromSnapNameFound).To(BeTrue())

// Make sure an upload Jobs has not yet been created.
var jobUpload batchv1.Job
err = k8sClient.Get(
ctx,
types.NamespacedName{
Name: fmt.Sprintf("mantle-upload-%s", backup.GetUID()),
Namespace: resMgr.ClusterID,
},
&jobUpload,
)
Expect(aerrors.IsNotFound(err)).To(BeTrue())
Consistently(ctx, func(g Gomega) error {
var jobUpload batchv1.Job
err = k8sClient.Get(
ctx,
types.NamespacedName{
Name: fmt.Sprintf("mantle-upload-%s", backup.GetUID()),
Namespace: resMgr.ClusterID,
},
&jobUpload,
)
g.Expect(aerrors.IsNotFound(err)).To(BeTrue())
return nil
}, "1s").Should(Succeed())

// Make the export Job completed to proceed the reconciliation for backup.
err = resMgr.ChangeJobCondition(ctx, &jobExport, batchv1.JobComplete, corev1.ConditionTrue)
Expand Down

0 comments on commit c07278f

Please sign in to comment.