From eea7abd14acce90752a92b375feffc8492afd5d3 Mon Sep 17 00:00:00 2001 From: andyzhangx Date: Tue, 31 Mar 2020 09:14:29 +0000 Subject: [PATCH] test: add install/uninstall deployment script test fix script issue --- deploy/example/windows/README.md | 2 +- ...l-driver-standalone.sh => install-driver.sh} | 8 ++++++++ ...driver-standalone.sh => uninstall-driver.sh} | 7 +++++++ docs/install-csi-driver-master.md | 4 ++-- test/e2e/suite_test.go | 17 ++++++++++++++++- 5 files changed, 34 insertions(+), 4 deletions(-) rename deploy/{install-driver-standalone.sh => install-driver.sh} (91%) rename deploy/{uninstall-driver-standalone.sh => uninstall-driver.sh} (92%) diff --git a/deploy/example/windows/README.md b/deploy/example/windows/README.md index 066d4baf5..7dc6872b1 100644 --- a/deploy/example/windows/README.md +++ b/deploy/example/windows/README.md @@ -10,7 +10,7 @@ CSI on Windows support is an alpha feature since Kubernetes v1.18, refer to [Win ## Install CSI Driver ```console -curl -skSL https://raw.githubusercontent.com/kubernetes-sigs/azurefile-csi-driver/master/deploy/install-driver-standalone.sh | bash -s master,windows -- +curl -skSL https://raw.githubusercontent.com/kubernetes-sigs/azurefile-csi-driver/master/deploy/install-driver.sh | bash -s master,windows -- ``` ## Deploy a Windows pod with PVC mount diff --git a/deploy/install-driver-standalone.sh b/deploy/install-driver.sh similarity index 91% rename from deploy/install-driver-standalone.sh rename to deploy/install-driver.sh index 54d91da22..58c58b3b9 100755 --- a/deploy/install-driver-standalone.sh +++ b/deploy/install-driver.sh @@ -22,9 +22,17 @@ if [[ "$#" -gt 0 ]]; then fi repo="https://raw.githubusercontent.com/kubernetes-sigs/azurefile-csi-driver/master/deploy" +if [[ "$#" -gt 1 ]]; then + if [[ "$2" == *"local"* ]]; then + echo "use local deploy" + repo="./deploy" + fi +fi + if [ $ver != "master" ]; then repo="$repo/$ver" fi + echo "Installing Azure File CSI driver, version: $ver ..." kubectl apply -f $repo/crd-csi-driver-registry.yaml kubectl apply -f $repo/crd-csi-node-info.yaml diff --git a/deploy/uninstall-driver-standalone.sh b/deploy/uninstall-driver.sh similarity index 92% rename from deploy/uninstall-driver-standalone.sh rename to deploy/uninstall-driver.sh index 139287e4f..12528c96e 100755 --- a/deploy/uninstall-driver-standalone.sh +++ b/deploy/uninstall-driver.sh @@ -22,6 +22,13 @@ if [[ "$#" -gt 0 ]]; then fi repo="https://raw.githubusercontent.com/kubernetes-sigs/azurefile-csi-driver/master/deploy" +if [[ "$#" -gt 1 ]]; then + if [[ "$2" == *"local"* ]]; then + echo "use local deploy" + repo="./deploy" + fi +fi + if [ $ver != "master" ]; then repo="$repo/$ver" fi diff --git a/docs/install-csi-driver-master.md b/docs/install-csi-driver-master.md index dfef34808..d7a2aa5af 100644 --- a/docs/install-csi-driver-master.md +++ b/docs/install-csi-driver-master.md @@ -2,7 +2,7 @@ ### Install by kubectl ```console -curl -skSL https://raw.githubusercontent.com/kubernetes-sigs/azurefile-csi-driver/master/deploy/install-driver-standalone.sh | bash -s master -- +curl -skSL https://raw.githubusercontent.com/kubernetes-sigs/azurefile-csi-driver/master/deploy/install-driver.sh | bash -s master -- ``` - check pods status: @@ -22,5 +22,5 @@ csi-azurefile-node-dr4s4 3/3 Running 0 7m4 ### clean up Azure File CSI driver ```console -curl -skSL https://raw.githubusercontent.com/kubernetes-sigs/azurefile-csi-driver/master/deploy/uninstall-driver-standalone.sh | bash -s -- +curl -skSL https://raw.githubusercontent.com/kubernetes-sigs/azurefile-csi-driver/master/deploy/uninstall-driver.sh | bash -s -- ``` \ No newline at end of file diff --git a/test/e2e/suite_test.go b/test/e2e/suite_test.go index 1811cd8ba..69cdef7d2 100644 --- a/test/e2e/suite_test.go +++ b/test/e2e/suite_test.go @@ -99,7 +99,7 @@ var _ = ginkgo.BeforeSuite(func() { var _ = ginkgo.AfterSuite(func() { if !isUsingInTreeVolumePlugin && testutil.IsRunningInProw() { azurefileLog := testCmd{ - command: "sh", + command: "bash", args: []string{"test/utils/azurefile_log.sh"}, startLog: "===================azurefile log===================", endLog: "===================================================", @@ -112,6 +112,21 @@ var _ = ginkgo.AfterSuite(func() { } execTestCmd([]testCmd{azurefileLog, e2eTeardown}) + // install/uninstall CSI Driver deployment scripts test + installDriver := testCmd{ + command: "bash", + args: []string{"deploy/install-driver.sh", "master", "windows,local"}, + startLog: "===================install CSI Driver deployment scripts test===================", + endLog: "===================================================", + } + uninstallDriver := testCmd{ + command: "bash", + args: []string{"deploy/uninstall-driver.sh", "master", "windows,local"}, + startLog: "===================uninstall CSI Driver deployment scripts test===================", + endLog: "===================================================", + } + execTestCmd([]testCmd{installDriver, uninstallDriver}) + err := credentials.DeleteAzureCredentialFile() gomega.Expect(err).NotTo(gomega.HaveOccurred()) }