From 662b10a6618c9822dfae05f9d7f6e943bce97b1a Mon Sep 17 00:00:00 2001 From: Sean Zatz Date: Tue, 29 Aug 2023 18:14:52 +0000 Subject: [PATCH] nit --- test/e2e/e2e.go | 24 ++++++++++++++---------- 1 file changed, 14 insertions(+), 10 deletions(-) diff --git a/test/e2e/e2e.go b/test/e2e/e2e.go index 33a334f73..20d33323b 100644 --- a/test/e2e/e2e.go +++ b/test/e2e/e2e.go @@ -364,20 +364,26 @@ var _ = ginkgo.Describe("[efs-csi] EFS CSI", func() { ginkgo.It("should create an access point with the desired subpath pattern", func() { ginkgo.By("Creating EFS Storage Class,PVC and associated PV") + pvName := "foo" + pvcName := "bar" + directoryCreated := fmt.Sprintf("/%s/%s", pvName, pvcName) params := map[string]string{ "provisioningMode": "efs-ap", "fileSystemId": FileSystemId, "directoryPerms": "777", - "subPathPattern": "/dynamic/${.PVC.name}/foo", + "subPathPattern": "${.PV.name}/${.PVC.name}", + "pvName": pvName, + "pvcName": pvcName, } + sc := GetStorageClass(params) sc, err := f.ClientSet.StorageV1().StorageClasses().Create(context.TODO(), sc, metav1.CreateOptions{}) framework.ExpectNoError(err, "creating storage class") - pvc, err := createEFSPVCPVDynamicProvisioning(f.ClientSet, f.Namespace.Name, f.Namespace.Name, "", map[string]string{}, sc.Name) + pvc, err := createEFSPVCPVDynamicProvisioning(f.ClientSet, f.Namespace.Name, f.Namespace.Name, "/", map[string]string{}, sc.Name) framework.ExpectNoError(err) ginkgo.By("Deploying a pod that applies the PVC to create an access point") - pod := e2epod.MakePod(f.Namespace.Name, nil, []*v1.PersistentVolumeClaim{pvc}, false, "") + pod := e2epod.MakePod(f.Namespace.Name, nil, []*v1.PersistentVolumeClaim{pvc}, false, "mkdir -p /mnt/efs && mount") pod, err = f.ClientSet.CoreV1().Pods(f.Namespace.Name).Create(context.TODO(), pod, metav1.CreateOptions{}) framework.ExpectNoError(err, "creating pod") framework.ExpectNoError(e2epod.WaitForPodNameRunningInNamespace(f.ClientSet, pod.Name, f.Namespace.Name), "waiting for pod running") @@ -386,20 +392,19 @@ var _ = ginkgo.Describe("[efs-csi] EFS CSI", func() { _ = f.ClientSet.CoreV1().PersistentVolumeClaims(f.Namespace.Name).Delete(context.TODO(), pvc.Name, metav1.DeleteOptions{}) }() - ginkgo.By("Checking if access point's directory matches expected structure") - // podClient := f.PodClientNS("kube-system") + ginkgo.By("Checking if access point's directory matches expected structure") //where can i check that the directory was created?? + // podClient := f.PodClientNS(f.Namespace.Name) // nodePods, err := podClient.List(context.Background(), metav1.ListOptions{ // LabelSelector: "app=efs-csi-node", // }) // framework.ExpectNoError(err, "Fetching efs-csi-driver node pods") // framework.ExpectNotEqual(len(nodePods.Items), 0, "Get node pods count") // nodePodName := nodePods.Items[0].Name - //cmd := fmt.Sprintf("[ -d \"/efs/dynamic/%s/foo\" ] && echo \"/efs/dynamic/%s/foo\"", pvc.Name, pvc.Name) - cmd := "ls -la" - actualDir := framework.RunKubectlOrDie("kube-system", "exec", pod.Name, "--", "/bin/sh", "-c", cmd) + cmd := fmt.Sprintf("[ -d \"/mnt/efs%s\" ] && echo \"/mnt/efs%s\"", directoryCreated, directoryCreated) + actualDir := framework.RunKubectlOrDie(f.Namespace.Name, "exec", pod.Name, "--", "/bin/sh", "-c", cmd) framework.Logf("%s", actualDir) - expectedDir := fmt.Sprintf("/efs/dynamic/%s/foo", pvc.Name) + expectedDir := fmt.Sprintf("/mnt/efs%s", directoryCreated) if actualDir != expectedDir { ginkgo.Fail("Subpath pattern directory structure does not match expected") } @@ -419,7 +424,6 @@ func createEFSPVCPVDynamicProvisioning(c clientset.Interface, namespace, name, p func makeEFSPVCPVDynamicProvisioning(namespace, name, path string, volumeAttributes map[string]string, storageClassName string) *v1.PersistentVolumeClaim { pvc := makeEFSPVCDynamicProvisioning(namespace, name, storageClassName) - // pvc.Spec.VolumeName = pv.Name return pvc }