From 8223ce54c2ddab60cab45813985fe8be3052748a Mon Sep 17 00:00:00 2001 From: Mayank Shah Date: Sat, 7 Nov 2020 13:13:43 +0530 Subject: [PATCH] Fixing test Signed-off-by: Mayank Shah --- Makefile | 2 +- charts/csi-driver-nfs/values.yaml | 6 +- test/e2e/driver/nfs_driver.go | 2 +- test/e2e/dynamic_provisioning_test.go | 2 +- test/e2e/e2e_suite_test.go | 57 +++++++++---------- ...namically_provisioned_cmd_volume_tester.go | 2 +- test/e2e/testsuites/specs.go | 6 +- 7 files changed, 35 insertions(+), 42 deletions(-) diff --git a/Makefile b/Makefile index 0bc2a2487..dfa565f67 100644 --- a/Makefile +++ b/Makefile @@ -66,7 +66,7 @@ install-helm: .PHONY: e2e-bootstrap e2e-bootstrap: install-helm - helm install -n csi-driver-nfs ./charts/csi-driver-nfs --namespace kube-system --wait --timeout=15m -v=5 --debug \ + helm install csi-driver-nfs ./charts/csi-driver-nfs --namespace kube-system --wait --timeout=15m -v=5 --debug \ --set image.nfs.repository=$(REGISTRY)/$(IMAGE_NAME) \ --set image.nfs.tag=$(IMAGE_VERSION) diff --git a/charts/csi-driver-nfs/values.yaml b/charts/csi-driver-nfs/values.yaml index 6c5ac2ace..d812d8238 100644 --- a/charts/csi-driver-nfs/values.yaml +++ b/charts/csi-driver-nfs/values.yaml @@ -2,15 +2,15 @@ image: nfs: repository: quay.io/k8scsi/nfsplugin tag: v2.0.0 - pullPolicy: ifNotPresent + pullPolicy: IfNotPresent csiProvisioner: repository: mcr.microsoft.com/oss/kubernetes-csi/csi-provisioner tag: v1.4.0 - pullPolicy: ifNotPresent + pullPolicy: IfNotPresent livenessProbe: repository: mcr.microsoft.com/oss/kubernetes-csi/livenessprobe tag: v1.1.0 - pullPolicy: ifNotPresent + pullPolicy: IfNotPresent nodeDriverRegistrar: repository: mcr.microsoft.com/oss/kubernetes-csi/csi-node-driver-registrar tag: v1.2.0 diff --git a/test/e2e/driver/nfs_driver.go b/test/e2e/driver/nfs_driver.go index 120cc772e..4ae8fbc9e 100644 --- a/test/e2e/driver/nfs_driver.go +++ b/test/e2e/driver/nfs_driver.go @@ -38,7 +38,7 @@ type NFSDriver struct { driverName string } -// InitNFSDriver returns SMBDriver that implements DynamicPVTestDriver interface +// InitNFSDriver returns NFSDriver that implements DynamicPVTestDriver interface func InitNFSDriver() PVTestDriver { driverName := os.Getenv(NFSDriverNameVar) if driverName == "" { diff --git a/test/e2e/dynamic_provisioning_test.go b/test/e2e/dynamic_provisioning_test.go index 02c937bd5..3bcd606de 100644 --- a/test/e2e/dynamic_provisioning_test.go +++ b/test/e2e/dynamic_provisioning_test.go @@ -60,7 +60,7 @@ var _ = ginkgo.Describe("Dynamic Provisioning", func() { }) testDriver = driver.InitNFSDriver() - ginkgo.It("should create a volume on demand with mount options [smb.csi.k8s.io]", func() { + ginkgo.It("should create a volume on demand with mount options [nfs.csi.k8s.io]", func() { pods := []testsuites.PodDetails{ { Cmd: "echo 'hello world' > /mnt/test-1/data && grep 'hello world' /mnt/test-1/data", diff --git a/test/e2e/e2e_suite_test.go b/test/e2e/e2e_suite_test.go index 93745f293..2fdad3120 100644 --- a/test/e2e/e2e_suite_test.go +++ b/test/e2e/e2e_suite_test.go @@ -10,7 +10,6 @@ import ( "testing" "github.com/kubernetes-csi/csi-driver-nfs/pkg/nfs" - testutil "github.com/kubernetes-csi/csi-driver-nfs/test/utils/testutils" "github.com/onsi/ginkgo" "github.com/onsi/gomega" "k8s.io/kubernetes/test/e2e/framework" @@ -50,40 +49,38 @@ var _ = ginkgo.BeforeSuite(func() { handleFlags() framework.AfterReadingAllFlags(&framework.TestContext) - if testutil.IsRunningInProw() { - // install nfs server - installNFSServer := testCmd{ - command: "make", - args: []string{"install-nfs-server"}, - startLog: "Installing NFS Server...", - endLog: "NFS Server successfully installed", - } - - e2eBootstrap := testCmd{ - command: "make", - args: []string{"e2e-bootstrap"}, - startLog: "Installing NFS CSI Driver...", - endLog: "NFS CSI Driver Installed", - } - // todo: Install metrics server once added to this driver - - execTestCmd([]testCmd{installNFSServer, e2eBootstrap}) - go func() { - nfsDriver.Run() - }() + // install nfs server + installNFSServer := testCmd{ + command: "make", + args: []string{"install-nfs-server"}, + startLog: "Installing NFS Server...", + endLog: "NFS Server successfully installed", } + + e2eBootstrap := testCmd{ + command: "make", + args: []string{"e2e-bootstrap"}, + startLog: "Installing NFS CSI Driver...", + endLog: "NFS CSI Driver Installed", + } + // todo: Install metrics server once added to this driver + + execTestCmd([]testCmd{installNFSServer, e2eBootstrap}) + go func() { + nfsDriver.Run() + }() + }) var _ = ginkgo.AfterSuite(func() { - if testutil.IsRunningInProw() { - e2eTeardown := testCmd{ - command: "make", - args: []string{"e2e-teardown"}, - startLog: "Uninstalling SMB CSI Driver...", - endLog: "SMB Driver uninstalled", - } - execTestCmd([]testCmd{e2eTeardown}) + e2eTeardown := testCmd{ + command: "make", + args: []string{"e2e-teardown"}, + startLog: "Uninstalling NFS CSI Driver...", + endLog: "SMB Driver uninstalled", } + execTestCmd([]testCmd{e2eTeardown}) + }) // handleFlags sets up all flags and parses the command line. diff --git a/test/e2e/testsuites/dynamically_provisioned_cmd_volume_tester.go b/test/e2e/testsuites/dynamically_provisioned_cmd_volume_tester.go index 4f19c9502..3e3836478 100644 --- a/test/e2e/testsuites/dynamically_provisioned_cmd_volume_tester.go +++ b/test/e2e/testsuites/dynamically_provisioned_cmd_volume_tester.go @@ -17,7 +17,7 @@ limitations under the License. package testsuites import ( - "github.com/kubernetes-csi/csi-driver-smb/test/e2e/driver" + "github.com/kubernetes-csi/csi-driver-nfs/test/e2e/driver" "github.com/onsi/ginkgo" v1 "k8s.io/api/core/v1" diff --git a/test/e2e/testsuites/specs.go b/test/e2e/testsuites/specs.go index 622ed54e6..df02696e5 100644 --- a/test/e2e/testsuites/specs.go +++ b/test/e2e/testsuites/specs.go @@ -118,11 +118,7 @@ func (pod *PodDetails) SetupWithDynamicVolumes(client clientset.Interface, names for n, v := range pod.Volumes { tpvc, funcs := v.SetupDynamicPersistentVolumeClaim(client, namespace, csiDriver, storageClassParameters) cleanupFuncs = append(cleanupFuncs, funcs...) - if v.VolumeMode == Block { - tpod.SetupRawBlockVolume(tpvc.persistentVolumeClaim, fmt.Sprintf("%s%d", v.VolumeDevice.NameGenerate, n+1), v.VolumeDevice.DevicePath) - } else { - tpod.SetupVolume(tpvc.persistentVolumeClaim, fmt.Sprintf("%s%d", v.VolumeMount.NameGenerate, n+1), fmt.Sprintf("%s%d", v.VolumeMount.MountPathGenerate, n+1), v.VolumeMount.ReadOnly) - } + tpod.SetupVolume(tpvc.persistentVolumeClaim, fmt.Sprintf("%s%d", v.VolumeMount.NameGenerate, n+1), fmt.Sprintf("%s%d", v.VolumeMount.MountPathGenerate, n+1), v.VolumeMount.ReadOnly) } return tpod, cleanupFuncs }