Skip to content

Commit 0b1a62d

Browse files
YashasG98GouthamML
authored andcommitted
[OKE-36784] Adding e2e test for boot volume gating case
1 parent 41e64de commit 0b1a62d

File tree

3 files changed

+40
-7
lines changed

3 files changed

+40
-7
lines changed

test/e2e/cloud-provider-oci/boot_volume.go

Lines changed: 33 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -54,3 +54,36 @@ var _ = Describe("Boot volume tests", func() {
5454
})
5555
})
5656
})
57+
58+
var _ = Describe("Boot volume gating test", func() {
59+
f := framework.NewBackupFramework("csi-basic")
60+
Context("[cloudprovider][storage][csi][boot-volume]", func() {
61+
It("Attach boot volume fails with volumeMode set to Filesystem", func() {
62+
pvcJig := framework.NewPVCTestJig(f.ClientSet, "csi-boot-vol-e2e-tests")
63+
compartmentId := ""
64+
if setupF.Compartment1 != "" {
65+
compartmentId = setupF.Compartment1
66+
} else if f.CloudProviderConfig.CompartmentID != "" {
67+
compartmentId = f.CloudProviderConfig.CompartmentID
68+
} else if f.CloudProviderConfig.Auth.CompartmentID != "" {
69+
compartmentId = f.CloudProviderConfig.Auth.CompartmentID
70+
} else {
71+
framework.Failf("Compartment Id undefined.")
72+
}
73+
74+
scName := f.CreateStorageClassOrFail(f.Namespace.Name, "blockvolume.csi.oraclecloud.com",
75+
map[string]string{framework.AttachmentType: framework.AttachmentTypeISCSI},
76+
pvcJig.Labels, "WaitForFirstConsumer", false, "Retain", nil)
77+
pvc, bootvolumeId := pvcJig.CreateAndAwaitStaticBootVolumePVCOrFailCSI(f.ComputeClient, f.Namespace.Name, compartmentId, setupF.AdLocation, setupF.MntTargetSubnetOcid, framework.MinVolumeBlock, scName, nil, v1.PersistentVolumeFilesystem, v1.ReadWriteOnce, v1.ClaimPending)
78+
pvcJig.NewPodForCSIWithoutWait("app1", f.Namespace.Name, pvc.Name, setupF.AdLabel)
79+
err := pvcJig.WaitTimeoutForPodRunningInNamespace("app1", f.Namespace.Name, 7*time.Minute)
80+
if err == nil {
81+
framework.Failf("Pod went to running state for gated condition")
82+
}
83+
84+
pvcJig.DeletePod(f.Namespace.Name, "app1", 7*time.Minute)
85+
pvcJig.DeleteBootVolume(f.BlockStorageClient, bootvolumeId, 5 * time.Minute)
86+
_ = f.DeleteStorageClass(f.Namespace.Name)
87+
})
88+
})
89+
})

test/e2e/framework/pod_util.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -406,7 +406,7 @@ func (j *PVCTestJig) CreateAndAwaitNginxPodOrFail(ns string, pvc *v1.PersistentV
406406
}
407407

408408
// Waiting for pod to be running
409-
err = j.waitTimeoutForPodRunningInNamespace(pod.Name, ns, slowPodStartTimeout)
409+
err = j.WaitTimeoutForPodRunningInNamespace(pod.Name, ns, slowPodStartTimeout)
410410
if err != nil {
411411
Failf("Pod %q is not Running: %v", pod.Name, err)
412412
}
@@ -423,7 +423,7 @@ func (j *PVCTestJig) waitTimeoutForPodNotFoundInNamespace(podName, namespace str
423423

424424
// WaitTimeoutForPodRunningInNamespace waits default amount of time (PodStartTimeout) for the specified pod to become running.
425425
// Returns an error if timeout occurs first, or pod goes in to failed state.
426-
func (j *PVCTestJig) waitTimeoutForPodRunningInNamespace(podName, namespace string, timeout time.Duration) error {
426+
func (j *PVCTestJig) WaitTimeoutForPodRunningInNamespace(podName, namespace string, timeout time.Duration) error {
427427
return wait.PollImmediate(Poll, timeout, j.podRunning(podName, namespace))
428428
}
429429

test/e2e/framework/pvc_util.go

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1045,7 +1045,7 @@ func (j *PVCTestJig) NewPodForCSI(name string, namespace string, claimName strin
10451045
}
10461046

10471047
// Waiting for pod to be running
1048-
err = j.waitTimeoutForPodRunningInNamespace(pod.Name, namespace, slowPodStartTimeout)
1048+
err = j.WaitTimeoutForPodRunningInNamespace(pod.Name, namespace, slowPodStartTimeout)
10491049
if err != nil {
10501050
Logf("Pod failed to come up, logging debug info")
10511051
j.logPodDebugInfo(namespace, pod.Name)
@@ -1159,7 +1159,7 @@ func (j *PVCTestJig) NewPodForCSIwAntiAffinity(name string, namespace string, cl
11591159
}
11601160

11611161
// Waiting for pod to be running
1162-
err = j.waitTimeoutForPodRunningInNamespace(pod.Name, namespace, slowPodStartTimeout)
1162+
err = j.WaitTimeoutForPodRunningInNamespace(pod.Name, namespace, slowPodStartTimeout)
11631163
if err != nil {
11641164
Failf("Pod %q is not Running: %v", pod.Name, err)
11651165
}
@@ -1214,7 +1214,7 @@ func (j *PVCTestJig) NewPodWithLabels(name string, namespace string, claimName s
12141214
}
12151215

12161216
// Waiting for pod to be running
1217-
err = j.waitTimeoutForPodRunningInNamespace(pod.Name, namespace, slowPodStartTimeout)
1217+
err = j.WaitTimeoutForPodRunningInNamespace(pod.Name, namespace, slowPodStartTimeout)
12181218
if err != nil {
12191219
Logf("Pod failed to come up, logging debug info\n")
12201220
j.logPodDebugInfo(namespace, pod.Name)
@@ -1291,7 +1291,7 @@ func (j *PVCTestJig) NewPodForCSIClone(name string, namespace string, claimName
12911291
}
12921292

12931293
// Waiting for pod to be running
1294-
err = j.waitTimeoutForPodRunningInNamespace(pod.Name, namespace, slowPodStartTimeout)
1294+
err = j.WaitTimeoutForPodRunningInNamespace(pod.Name, namespace, slowPodStartTimeout)
12951295
if err != nil {
12961296
Logf("Pod failed to come up, logging debug info\n")
12971297
j.logPodDebugInfo(namespace, pod.Name)
@@ -1408,7 +1408,7 @@ func (j *PVCTestJig) NewPodForCSIFSSWrite(name string, namespace string, claimNa
14081408
}
14091409

14101410
// Waiting for pod to be running
1411-
err = j.waitTimeoutForPodRunningInNamespace(pod.Name, namespace, slowPodStartTimeout)
1411+
err = j.WaitTimeoutForPodRunningInNamespace(pod.Name, namespace, slowPodStartTimeout)
14121412
if err != nil {
14131413
Logf("Pod failed to come up, logging debug info\n")
14141414
j.logPodDebugInfo(namespace, pod.Name)

0 commit comments

Comments
 (0)