Skip to content

Commit 2497843

Browse files
committed
fix: * improve logic in syncer and snapshot reconciliation to handle e2e tests failures
* Improve logging and assertion in snapshot e2e test
1 parent 6a76a0a commit 2497843

File tree

5 files changed

+135
-110
lines changed

5 files changed

+135
-110
lines changed

pkg/controllers/resources/ingresses/syncer.go

Lines changed: 2 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -62,15 +62,8 @@ func (s *ingressSyncer) Syncer() syncertypes.Sync[client.Object] {
6262

6363
func (s *ingressSyncer) SyncToHost(ctx *synccontext.SyncContext, event *synccontext.SyncToHostEvent[*networkingv1.Ingress]) (ctrl.Result, error) {
6464
if s.applyLimitByClass(ctx, event.Virtual) {
65-
s.EventRecorder().Eventf(
66-
event.Virtual,
67-
nil,
68-
"Warning",
69-
"SyncWarning",
70-
"IngressSyncWarning",
71-
"did not sync ingress %q to host because it does not match the selector under 'sync.fromHost.ingressClasses.selector'",
72-
event.Virtual.GetName(),
73-
)
65+
// applyLimitByClass already logs the appropriate error message with details
66+
// (including ingress class name), so we don't need to log another message here
7467
return ctrl.Result{}, nil
7568
}
7669

pkg/controllers/resources/pods/syncer.go

Lines changed: 1 addition & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -377,19 +377,7 @@ func (s *podSyncer) Sync(ctx *synccontext.SyncContext, event *synccontext.SyncEv
377377
// NewSyncerPatcher() is called so that there are no
378378
// differences found in host QOSClass and virtual QOSClass and
379379
// a patch event for this field is not created
380-
virtualQOS := event.Virtual.Status.QOSClass
381-
if event.VirtualOld != nil {
382-
virtualQOS = event.VirtualOld.Status.QOSClass
383-
}
384-
// Set both Host and Virtual to the same QOSClass value to prevent patching
385-
event.Host.Status.QOSClass = virtualQOS
386-
if event.HostOld != nil {
387-
event.HostOld.Status.QOSClass = virtualQOS
388-
}
389-
event.Virtual.Status.QOSClass = virtualQOS
390-
if event.VirtualOld != nil {
391-
event.VirtualOld.Status.QOSClass = virtualQOS
392-
}
380+
event.Host.Status.QOSClass = event.VirtualOld.Status.QOSClass
393381

394382
// patch objects
395383
patch, err := patcher.NewSyncerPatcher(ctx, event.Host, event.Virtual, patcher.TranslatePatches(ctx.Config.Sync.ToHost.Pods.Patches, false))

pkg/snapshot/controller.go

Lines changed: 0 additions & 51 deletions
Original file line numberDiff line numberDiff line change
@@ -154,13 +154,6 @@ func (c *Reconciler) Reconcile(ctx context.Context, req ctrl.Request) (result ct
154154
return ctrl.Result{}, nil
155155
}
156156
}
157-
158-
// If a newer snapshot request exists for the same URL, cancel this one if it's in progress.
159-
err = c.cancelIfNewerRequestExists(ctx, snapshotRequest)
160-
if err != nil {
161-
return ctrl.Result{}, fmt.Errorf("failed to check for newer snapshot requests: %w", err)
162-
}
163-
164157
canContinue, err := c.cancelPreviousRequests(ctx, snapshotRequest)
165158
if err != nil {
166159
return ctrl.Result{}, fmt.Errorf("failed to cancel previous snapshot requests: %w", err)
@@ -578,47 +571,3 @@ func (c *Reconciler) cancelPreviousRequests(ctx context.Context, request *Reques
578571

579572
return currentRequestCanContinue, nil
580573
}
581-
582-
func (c *Reconciler) cancelIfNewerRequestExists(ctx context.Context, request *Request) error {
583-
if request.Status.Phase != RequestPhaseCreatingVolumeSnapshots &&
584-
request.Status.Phase != RequestPhaseCreatingEtcdBackup &&
585-
request.Status.Phase != RequestPhaseNotStarted {
586-
return nil
587-
}
588-
589-
var configMaps corev1.ConfigMapList
590-
listOptions := &client.ListOptions{
591-
LabelSelector: labels.SelectorFromSet(map[string]string{
592-
constants.SnapshotRequestLabel: "",
593-
}),
594-
Namespace: c.getRequestNamespace(),
595-
}
596-
if err := c.client().List(ctx, &configMaps, listOptions); err != nil {
597-
return fmt.Errorf("failed to list snapshot request ConfigMaps: %w", err)
598-
}
599-
600-
for _, configMap := range configMaps.Items {
601-
otherRequest, err := UnmarshalSnapshotRequest(&configMap)
602-
if err != nil {
603-
c.logger.Errorf("Failed to unmarshal snapshot request from ConfigMap %s/%s: %v", configMap.Namespace, configMap.Name, err)
604-
continue
605-
}
606-
if otherRequest.Name == request.Name {
607-
continue
608-
}
609-
if otherRequest.Spec.URL != request.Spec.URL {
610-
continue
611-
}
612-
if !otherRequest.CreationTimestamp.Time.After(request.CreationTimestamp.Time) {
613-
continue
614-
}
615-
if otherRequest.Done() {
616-
continue
617-
}
618-
619-
request.Status.Phase = RequestPhaseCanceling
620-
return nil
621-
}
622-
623-
return nil
624-
}

pkg/snapshot/volumes/csi/snapshothandler.go

Lines changed: 104 additions & 31 deletions
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,16 @@ type snapshotHandler struct {
2525
logger loghelper.Logger
2626
}
2727

28+
type updateDeleteResult struct {
29+
policyUpdated bool
30+
deleteIssued bool
31+
}
32+
33+
const (
34+
cleanupComplete = true
35+
cleanupInProgress = false
36+
)
37+
2838
// createPreProvisionedVolumeSnapshot creates the pre-provisioned VolumeSnapshot
2939
func (h *snapshotHandler) createPreProvisionedVolumeSnapshot(ctx context.Context, requestLabel, requestName string, volumeSnapshotRequest volumes.SnapshotRequest) (*snapshotsv1api.VolumeSnapshot, error) {
3040
volumeSnapshotName := fmt.Sprintf("%s-%s", volumeSnapshotRequest.PersistentVolumeClaim.Name, requestName)
@@ -142,48 +152,63 @@ func (h *snapshotHandler) deleteVolumeSnapshot(ctx context.Context, requestLabel
142152
}
143153
volumeSnapshot, volumeSnapshotContent, err := h.getVolumeSnapshotResources(ctx, volumeSnapshotNamespace, volumeSnapshotName, volumeSnapshotContentName)
144154
if err != nil {
145-
return false, fmt.Errorf("failed to get volume snapshot resources for VolumeSnapshot %s/%s: %w", volumeSnapshotNamespace, volumeSnapshotName, err)
155+
return cleanupInProgress, fmt.Errorf("failed to get volume snapshot resources for VolumeSnapshot %s/%s: %w", volumeSnapshotNamespace, volumeSnapshotName, err)
146156
}
147157

148158
resourceRecreated := false
149159
if volumeSnapshotContent == nil && recreateResourceIfNotFound {
150160
h.logger.Debugf("VolumeSnapshotContent %s not found, recreate it", volumeSnapshotContentName)
151161
_, err = h.createVolumeSnapshotContentResource(ctx, requestLabel, requestName, volumeSnapshotRequest, snapshotHandle, snapshotsv1api.VolumeSnapshotContentDelete)
152162
if err != nil {
153-
return false, fmt.Errorf("failed to recreate VolumeSnapshotContent %s: %w", volumeSnapshotContentName, err)
163+
return cleanupInProgress, fmt.Errorf("failed to recreate VolumeSnapshotContent %s: %w", volumeSnapshotContentName, err)
154164
}
155165
resourceRecreated = true
156166
}
157167
if volumeSnapshot == nil && recreateResourceIfNotFound {
158168
h.logger.Debugf("VolumeSnapshot %s/%s not found, recreate it", volumeSnapshotNamespace, volumeSnapshotName)
159169
_, err = h.createPreProvisionedVolumeSnapshot(ctx, requestLabel, requestName, volumeSnapshotRequest)
160170
if err != nil {
161-
return false, fmt.Errorf("failed to recreate VolumeSnapshot %s/%s: %w", volumeSnapshotNamespace, volumeSnapshotName, err)
171+
return cleanupInProgress, fmt.Errorf("failed to recreate VolumeSnapshot %s/%s: %w", volumeSnapshotNamespace, volumeSnapshotName, err)
162172
}
163173
resourceRecreated = true
164174
}
165175
if resourceRecreated {
166-
return false, nil
176+
return cleanupInProgress, nil
167177
}
168178

169179
if volumeSnapshot == nil && volumeSnapshotContent == nil {
170180
// both the VolumeSnapshot and the VolumeSnapshotContent have been deleted
171-
return true, nil
181+
return cleanupComplete, nil
172182
}
173183
if volumeSnapshot != nil {
174-
volumeSnapshotJSON, _ := json.Marshal(volumeSnapshot)
175-
h.logger.Debugf("VolumeSnapshot %s/%s still not deleted: %s", volumeSnapshot.Namespace, volumeSnapshot.Name, volumeSnapshotJSON)
184+
h.logger.Debugf("VolumeSnapshot %s/%s deletion pending (deletionTimestamp=%v)", volumeSnapshot.Namespace, volumeSnapshot.Name, volumeSnapshot.DeletionTimestamp)
176185
}
177186
if volumeSnapshotContent != nil {
178-
volumeSnapshotContentJSON, _ := json.Marshal(volumeSnapshotContent)
179-
h.logger.Debugf("VolumeSnapshotContent %s still not deleted: %s", volumeSnapshotContent.Name, volumeSnapshotContentJSON)
187+
h.logger.Debugf("VolumeSnapshotContent %s deletion pending (policy=%s, deletionTimestamp=%v)", volumeSnapshotContent.Name, volumeSnapshotContent.Spec.DeletionPolicy, volumeSnapshotContent.DeletionTimestamp)
180188
}
181189

182-
err = h.updateAndDeleteVolumeSnapshotResource(ctx, volumeSnapshot, volumeSnapshotContent, snapshotsv1api.VolumeSnapshotContentDelete)
190+
result, err := h.updateAndDeleteVolumeSnapshotResource(ctx, volumeSnapshot, volumeSnapshotContent, snapshotsv1api.VolumeSnapshotContentDelete)
183191
if err != nil {
184-
return false, fmt.Errorf("failed to delete volume snapshot: %w", err)
192+
if kerrors.IsConflict(err) {
193+
h.logger.Debugf("Conflict deleting %s/%s (likely processed by controller), will retry: %v", volumeSnapshotNamespace, volumeSnapshotName, err)
194+
return cleanupInProgress, nil
195+
}
196+
return cleanupInProgress, fmt.Errorf("failed to delete volume snapshot: %w", err)
197+
}
198+
if result.policyUpdated {
199+
h.logger.Debugf("DeletionPolicy updated for %s/%s, waiting for controller reconciliation", volumeSnapshotNamespace, volumeSnapshotName)
200+
return cleanupInProgress, nil
201+
}
202+
return cleanupInProgress, nil
203+
}
204+
205+
func isCleanupComplete(volumeSnapshot *snapshotsv1api.VolumeSnapshot, volumeSnapshotContent *snapshotsv1api.VolumeSnapshotContent) bool {
206+
if volumeSnapshot == nil && volumeSnapshotContent == nil {
207+
return true
185208
}
186-
return false, nil
209+
snapshotDeleting := volumeSnapshot == nil || !volumeSnapshot.DeletionTimestamp.IsZero()
210+
contentDeleting := volumeSnapshotContent == nil || !volumeSnapshotContent.DeletionTimestamp.IsZero()
211+
return snapshotDeleting && contentDeleting
187212
}
188213

189214
// cleanupVolumeSnapshotResource deletes the VolumeSnapshot and the VolumeSnapshotContent with the deletion policy set
@@ -192,23 +217,53 @@ func (h *snapshotHandler) deleteVolumeSnapshot(ctx context.Context, requestLabel
192217
func (h *snapshotHandler) cleanupVolumeSnapshotResource(ctx context.Context, volumeSnapshotNamespace, volumeSnapshotName string) (bool, error) {
193218
volumeSnapshot, volumeSnapshotContent, err := h.getVolumeSnapshotResources(ctx, volumeSnapshotNamespace, volumeSnapshotName, "")
194219
if err != nil {
195-
return false, fmt.Errorf("failed to get volume snapshot resources for VolumeSnapshot %s/%s: %w", volumeSnapshotNamespace, volumeSnapshotName, err)
220+
return cleanupInProgress, fmt.Errorf("failed to get volume snapshot resources for VolumeSnapshot %s/%s: %w", volumeSnapshotNamespace, volumeSnapshotName, err)
196221
}
222+
// If resources are gone, cleanup is done
197223
if volumeSnapshot == nil && volumeSnapshotContent == nil {
198-
return true, nil
224+
return cleanupComplete, nil
199225
}
200-
err = h.updateAndDeleteVolumeSnapshotResource(ctx, volumeSnapshot, volumeSnapshotContent, snapshotsv1api.VolumeSnapshotContentRetain)
226+
227+
// Check if resources are already being deleted (have DeletionTimestamp set)
228+
// If they are, we consider them as effectively cleaned up
229+
if isCleanupComplete(volumeSnapshot, volumeSnapshotContent) {
230+
h.logger.Debugf("Volume snapshot resources for%s/%s are marked for deletion, cleanup considered complete", volumeSnapshotNamespace, volumeSnapshotName)
231+
return cleanupComplete, nil
232+
}
233+
234+
result, err := h.updateAndDeleteVolumeSnapshotResource(ctx, volumeSnapshot, volumeSnapshotContent, snapshotsv1api.VolumeSnapshotContentRetain)
235+
if err != nil {
236+
if kerrors.IsConflict(err) {
237+
h.logger.Debugf("Conflict cleaning up volume snapshot resources for %s/%s (likely being processed), will retry: %v", volumeSnapshotNamespace, volumeSnapshotName, err)
238+
return cleanupInProgress, nil
239+
}
240+
return cleanupInProgress, fmt.Errorf("failed to cleanup volume snapshot resources for %s/%s: %w", volumeSnapshotNamespace, volumeSnapshotName, err)
241+
}
242+
243+
if result.policyUpdated {
244+
h.logger.Debugf("DeletionPolicy updated for %s/%s, waiting for controller reconciliation", volumeSnapshotNamespace, volumeSnapshotName)
245+
return cleanupInProgress, nil
246+
}
247+
248+
// Re-check to confirm deletion has started (DeletionTimestamp set) or resources are gone.
249+
volumeSnapshot, volumeSnapshotContent, err = h.getVolumeSnapshotResources(ctx, volumeSnapshotNamespace, volumeSnapshotName, "")
201250
if err != nil {
202-
return false, fmt.Errorf("failed to cleanup volume snapshot resources: %w", err)
251+
return cleanupInProgress, fmt.Errorf("failed to recheck volume snapshot resources for VolumeSnapshot %s/%s: %w", volumeSnapshotNamespace, volumeSnapshotName, err)
203252
}
204-
return false, nil
253+
254+
if isCleanupComplete(volumeSnapshot, volumeSnapshotContent) {
255+
return cleanupComplete, nil
256+
}
257+
258+
h.logger.Debugf("Cleanup initiated for %s/%s but deletion timestamp not yet set. Will retry.", volumeSnapshotNamespace, volumeSnapshotName)
259+
return cleanupInProgress, nil
205260
}
206261

207262
func (h *snapshotHandler) updateAndDeleteVolumeSnapshotResource(
208263
ctx context.Context,
209264
volumeSnapshot *snapshotsv1api.VolumeSnapshot,
210265
volumeSnapshotContent *snapshotsv1api.VolumeSnapshotContent,
211-
requiredVolumeSnapshotContentDeletionPolicy snapshotsv1api.DeletionPolicy) error {
266+
requiredVolumeSnapshotContentDeletionPolicy snapshotsv1api.DeletionPolicy) (updateDeleteResult, error) {
212267
if volumeSnapshotContent != nil &&
213268
volumeSnapshotContent.DeletionTimestamp.IsZero() &&
214269
volumeSnapshotContent.Spec.DeletionPolicy != requiredVolumeSnapshotContentDeletionPolicy {
@@ -217,16 +272,22 @@ func (h *snapshotHandler) updateAndDeleteVolumeSnapshotResource(
217272
// 2. DeletionPolicy=Delete when deleting the volume snapshots
218273
err := h.setVolumeSnapshotContentDeletionPolicy(ctx, volumeSnapshotContent.Name, requiredVolumeSnapshotContentDeletionPolicy)
219274
if err != nil {
220-
return fmt.Errorf("failed to set VolumeSnapshotContent %s DeletionPolicy to %s: %w", volumeSnapshotContent.Name, requiredVolumeSnapshotContentDeletionPolicy, err)
275+
return updateDeleteResult{}, fmt.Errorf("failed to set VolumeSnapshotContent %s DeletionPolicy to %s: %w", volumeSnapshotContent.Name, requiredVolumeSnapshotContentDeletionPolicy, err)
221276
}
222-
return nil
277+
return updateDeleteResult{policyUpdated: true}, nil
223278
}
224279

225-
err := h.deleteVolumeSnapshotResources(ctx, volumeSnapshot, volumeSnapshotContent)
280+
err := h.deleteVolumeSnapshotObj(ctx, volumeSnapshot)
226281
if err != nil {
227-
return fmt.Errorf("failed to delete VolumeSnapshot and/or VolumeSnapshotContent: %w", err)
282+
return updateDeleteResult{}, fmt.Errorf("failed to delete VolumeSnapshot: %w", err)
228283
}
229-
return nil
284+
285+
err = h.deleteVolumeSnapshotContentObj(ctx, volumeSnapshot, volumeSnapshotContent)
286+
if err != nil {
287+
return updateDeleteResult{}, fmt.Errorf("failed to delete VolumeSnapshotContent: %w", err)
288+
}
289+
290+
return updateDeleteResult{deleteIssued: true}, nil
230291
}
231292

232293
func (h *snapshotHandler) setVolumeSnapshotContentDeletionPolicy(ctx context.Context, volumeSnapshotContentName string, deletionPolicy snapshotsv1api.DeletionPolicy) error {
@@ -246,27 +307,35 @@ func (h *snapshotHandler) setVolumeSnapshotContentDeletionPolicy(ctx context.Con
246307
return nil
247308
}
248309

249-
func (h *snapshotHandler) deleteVolumeSnapshotResources(
310+
// deleteVolumeSnapshotObj deletes the VolumeSnapshot resource.
311+
func (h *snapshotHandler) deleteVolumeSnapshotObj(
250312
ctx context.Context,
251-
volumeSnapshot *snapshotsv1api.VolumeSnapshot,
252-
volumeSnapshotContent *snapshotsv1api.VolumeSnapshotContent) error {
313+
volumeSnapshot *snapshotsv1api.VolumeSnapshot) error {
253314
if volumeSnapshot != nil &&
254315
volumeSnapshot.DeletionTimestamp.IsZero() {
255316
h.logger.Debugf("Delete VolumeSnapshot %s/%s", volumeSnapshot.Namespace, volumeSnapshot.Name)
256317
err := h.snapshotsClient.SnapshotV1().VolumeSnapshots(volumeSnapshot.Namespace).Delete(ctx, volumeSnapshot.Name, metav1.DeleteOptions{})
257318
if err != nil && !kerrors.IsNotFound(err) {
258-
// If the error is a conflict (e.g., controller is adding finalizers),
259-
// it means the snapshot is being processed
319+
// If the error is a conflict, we return it to allow the reconciler to retry with backoff.
260320
if kerrors.IsConflict(err) {
261321
h.logger.Debugf("VolumeSnapshot %s/%s deletion conflicted (likely being processed by controller), will retry", volumeSnapshot.Namespace, volumeSnapshot.Name)
262-
} else {
263-
return fmt.Errorf("failed to delete VolumeSnapshot %s/%s: %w", volumeSnapshot.Namespace, volumeSnapshot.Name, err)
264322
}
323+
return fmt.Errorf("failed to delete VolumeSnapshot %s/%s: %w", volumeSnapshot.Namespace, volumeSnapshot.Name, err)
265324
}
266325
}
326+
return nil
327+
}
328+
329+
// deleteVolumeSnapshotContentObj deletes the VolumeSnapshotContent resource.
330+
func (h *snapshotHandler) deleteVolumeSnapshotContentObj(
331+
ctx context.Context,
332+
volumeSnapshot *snapshotsv1api.VolumeSnapshot,
333+
volumeSnapshotContent *snapshotsv1api.VolumeSnapshotContent) error {
267334
if volumeSnapshotContent != nil &&
268335
volumeSnapshotContent.DeletionTimestamp.IsZero() &&
269-
volumeSnapshotContent.Spec.DeletionPolicy == snapshotsv1api.VolumeSnapshotContentRetain {
336+
// If the VolumeSnapshot is already gone, the controller cannot clean up the content.
337+
// Delete it manually even when the policy is Delete to avoid orphaned content.
338+
(volumeSnapshotContent.Spec.DeletionPolicy == snapshotsv1api.VolumeSnapshotContentRetain || volumeSnapshot == nil) {
270339
// Delete the VolumeSnapshotContent manually in case it has the Retain deletion policy.
271340
// Otherwise, the VolumeSnapshotContent resource will be deleted automatically by the snapshot-controller.
272341
// Here we have 2 cases:
@@ -277,6 +346,10 @@ func (h *snapshotHandler) deleteVolumeSnapshotResources(
277346
h.logger.Debugf("Delete VolumeSnapshotContent %s", volumeSnapshotContent.Name)
278347
err := h.snapshotsClient.SnapshotV1().VolumeSnapshotContents().Delete(ctx, volumeSnapshotContent.Name, metav1.DeleteOptions{})
279348
if err != nil && !kerrors.IsNotFound(err) {
349+
// If the error is a conflict, we return it to allow the reconciler to retry with backoff.
350+
if kerrors.IsConflict(err) {
351+
h.logger.Debugf("VolumeSnapshotContent %s deletion conflicted (likely being processed by controller), will retry", volumeSnapshotContent.Name)
352+
}
280353
return fmt.Errorf("failed to delete VolumeSnapshotContent %s: %w", volumeSnapshotContent.Name, err)
281354
}
282355
}

test/e2e/snapshot/snapshot.go

Lines changed: 28 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -566,7 +566,6 @@ var _ = Describe("snapshot and restore", Ordered, func() {
566566
Expect(err).NotTo(HaveOccurred())
567567
Expect(volumeSnapshotContents.Items).To(BeEmpty())
568568
})
569-
570569
It("Deletes the PVC with test data", func(ctx context.Context) {
571570
deletePVC(ctx, f, controllerTestNamespaceName, pvcToRestoreName)
572571
})
@@ -720,17 +719,40 @@ var _ = Describe("snapshot and restore", Ordered, func() {
720719
Should(Succeed())
721720
})
722721

723-
It("completed new new snapshot request", func(ctx context.Context) {
722+
It("completed new snapshot request", func(ctx context.Context) {
724723
Eventually(func(g Gomega, ctx context.Context) {
725724
_, newerSnapshotRequest := getTwoSnapshotRequests(g, ctx, f)
726-
g.Expect(newerSnapshotRequest.Status.Phase).Should(
727-
Equal(snapshot.RequestPhaseCompleted),
728-
fmt.Sprintf("Newer snapshot request %s is not completed, got: %s", newerSnapshotRequest.Name, toJSON(newerSnapshotRequest)))
725+
726+
// First check individual volume snapshot phases for better diagnostics
727+
// This helps identify which specific snapshots are stuck
729728
for pvcName, volumeSnapshot := range newerSnapshotRequest.Status.VolumeSnapshots.Snapshots {
730729
g.Expect(volumeSnapshot.Phase).To(
731730
Equal(volumes.RequestPhaseCompleted),
732-
fmt.Sprintf("New volume snapshot request for PVC %s should be completed, got: %s", pvcName, toJSON(volumeSnapshot)))
731+
fmt.Sprintf("Volume snapshot for PVC %s is not completed. Phase: %s, SnapshotHandle: %s, Error: %s. Full snapshot request: %s",
732+
pvcName,
733+
volumeSnapshot.Phase,
734+
volumeSnapshot.SnapshotHandle,
735+
toJSON(volumeSnapshot.Error),
736+
toJSON(newerSnapshotRequest)))
733737
}
738+
739+
// Then check the overall volumeSnapshots phase
740+
g.Expect(newerSnapshotRequest.Status.VolumeSnapshots.Phase).To(
741+
Equal(volumes.RequestPhaseCompleted),
742+
fmt.Sprintf("VolumeSnapshots phase is not completed for snapshot request %s. Phase: %s, Overall phase: %s, VolumeSnapshots: %s",
743+
newerSnapshotRequest.Name,
744+
newerSnapshotRequest.Status.VolumeSnapshots.Phase,
745+
newerSnapshotRequest.Status.Phase,
746+
toJSON(newerSnapshotRequest.Status.VolumeSnapshots)))
747+
748+
// Finally check the overall snapshot request phase
749+
g.Expect(newerSnapshotRequest.Status.Phase).Should(
750+
Equal(snapshot.RequestPhaseCompleted),
751+
fmt.Sprintf("Newer snapshot request %s is not completed. Overall phase: %s, VolumeSnapshots phase: %s, Full request: %s",
752+
newerSnapshotRequest.Name,
753+
newerSnapshotRequest.Status.Phase,
754+
newerSnapshotRequest.Status.VolumeSnapshots.Phase,
755+
toJSON(newerSnapshotRequest)))
734756
}).WithContext(ctx).
735757
WithPolling(framework.PollInterval).
736758
WithTimeout(framework.PollTimeoutLong).

0 commit comments

Comments
 (0)