Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
26 changes: 18 additions & 8 deletions tests/e2e/util.go
Original file line number Diff line number Diff line change
Expand Up @@ -2773,9 +2773,13 @@ func verifyIsAttachedInSupervisor(ctx context.Context, f *framework.Framework,
gomega.Expect(instance).NotTo(gomega.BeNil())
for _, vol := range instance.Status.VolumeStatus {
if vol.Name == volumeHandle {
// Access the Attached field within the PVC status
volumeAttachmentStatus = vol.PersistentVolumeClaim.Attached
break
for _, cond := range vol.PersistentVolumeClaim.Conditions {
// Access the Status & Type field within the PVC's Conditions
if string(cond.Type) == "VolumeAttached" && cond.Status == metav1.ConditionTrue {
volumeAttachmentStatus = true
break
}
}
}
}
framework.Logf("instance attached found to be : %t\n", volumeAttachmentStatus)
Expand All @@ -2800,11 +2804,17 @@ func verifyIsDetachedInSupervisor(ctx context.Context, f *framework.Framework,
if isBatchAttachSupported {
instance := getCnsNodeVMBatchAttachmentByName(ctx, f, nodeName, crdVersion, crdGroup)
gomega.Expect(instance).NotTo(gomega.BeNil())
for _, vol := range instance.Status.VolumeStatus {
if vol.Name == volumeHandle {
// Access the Attached field within the PVC status
volumeAttachmentStatus = vol.PersistentVolumeClaim.Attached
break
if instance.Status.VolumeStatus != nil {
for _, vol := range instance.Status.VolumeStatus {
if vol.Name == volumeHandle {
for _, cond := range vol.PersistentVolumeClaim.Conditions {
// Access the Status & Type field within the PVC's Conditions
if string(cond.Type) != "VolumeAttached" && cond.Status != metav1.ConditionTrue {
volumeAttachmentStatus = false
break
}
}
}
}
}
framework.Logf("instance attached found to be : %t\n", volumeAttachmentStatus)
Expand Down