Skip to content

Commit

Permalink
nit
Browse files Browse the repository at this point in the history
  • Loading branch information
seanzatzdev-amazon committed Aug 29, 2023
1 parent 51303ba commit 662b10a
Showing 1 changed file with 14 additions and 10 deletions.
24 changes: 14 additions & 10 deletions test/e2e/e2e.go
Original file line number Diff line number Diff line change
Expand Up @@ -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")
Expand All @@ -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")
}
Expand All @@ -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
}

Expand Down

0 comments on commit 662b10a

Please sign in to comment.