Skip to content
Merged
Show file tree
Hide file tree
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
41 changes: 41 additions & 0 deletions test/e2e/dynamic_provisioning_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -245,6 +245,47 @@ var _ = ginkgo.Describe("Dynamic Provisioning", func() {
test.Run(ctx, cs, ns)
})

// Track issue https://github.com/kubernetes-csi/csi-driver-smb/issues/834
ginkgo.It(fmt.Sprintf("should delete PV with reclaimPolicy even if it contains read-only subdir %q [smb.csi.k8s.io]", v1.PersistentVolumeReclaimDelete), func(ctx ginkgo.SpecContext) {
skipIfTestingInWindowsCluster()
reclaimPolicy := v1.PersistentVolumeReclaimDelete
pod := testsuites.PodDetails{
Cmd: convertToPowershellCommandIfNecessary("echo 'hello world' >> /mnt/test-1/data && while true; do sleep 100; done"),
Volumes: []testsuites.VolumeDetails{
{
ClaimSize: "10Gi",
MountOptions: []string{
"dir_mode=0777",
"file_mode=0777",
"noperm",
},
ReclaimPolicy: &reclaimPolicy,
VolumeMount: testsuites.VolumeMountDetails{
NameGenerate: "test-volume-",
MountPathGenerate: "/mnt/test-",
},
},
},
IsWindows: isWindowsCluster,
WinServerVer: winServerVer,
}

podCheckCmd := []string{"sh", "-c", "mkdir /mnt/test-1/subdir-test;chmod a-w /mnt/test-1/subdir-test;ls -ld /mnt/test-1/subdir-test"}
expectedString := "dr-xr-xr-x"

test := testsuites.DynamicallyProvisionedDeletePodTest{
CSIDriver: testDriver,
Pod: pod,
PodCheck: &testsuites.PodExecCheck{
Cmd: podCheckCmd,
ExpectedString: expectedString,
},
SkipAfterRestartCheck: true,
StorageClassParameters: defaultStorageClassParameters,
}
test.Run(ctx, cs, ns)
})

ginkgo.It(fmt.Sprintf("should delete PV with reclaimPolicy %q [smb.csi.k8s.io] [Windows]", v1.PersistentVolumeReclaimDelete), func(ctx ginkgo.SpecContext) {
reclaimPolicy := v1.PersistentVolumeReclaimDelete
volumes := []testsuites.VolumeDetails{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,7 @@ type DynamicallyProvisionedDeletePodTest struct {
CSIDriver driver.DynamicPVTestDriver
Pod PodDetails
PodCheck *PodExecCheck
SkipAfterRestartCheck bool
StorageClassParameters map[string]string
}

Expand Down Expand Up @@ -67,7 +68,7 @@ func (t *DynamicallyProvisionedDeletePodTest) Run(ctx context.Context, client cl
ginkgo.By("checking again that the pod is running")
tDeployment.WaitForPodReady(ctx)

if t.PodCheck != nil {
if t.PodCheck != nil && !t.SkipAfterRestartCheck {
ginkgo.By("sleep 5s and then check pod exec after pod restart again")
time.Sleep(5 * time.Second)
// pod will be restarted so expect to see 2 instances of string
Expand Down
Loading