diff --git a/Makefile b/Makefile index 75ec6aec..0925c8b9 100644 --- a/Makefile +++ b/Makefile @@ -119,10 +119,4 @@ e2e-teardown: .PHONY: e2e-test e2e-test: - go test -v -timeout=0 ./test/e2e ${GINKGO_FLAGS} - -.PHONY: create-example-deployment -create-example-deployment: - kubectl apply -f ./deploy/example/storageclass-nfs.yaml - kubectl apply -f ./deploy/example/deployment.yaml - kubectl apply -f ./deploy/example/statefulset.yaml + go test -v -timeout=0 ./test/e2e ${GINKGO_FLAGS} \ No newline at end of file diff --git a/deploy/example/deployment.yaml b/deploy/example/deployment.yaml index 6a4a0f71..adbc1ad3 100644 --- a/deploy/example/deployment.yaml +++ b/deploy/example/deployment.yaml @@ -30,7 +30,7 @@ spec: "kubernetes.io/os": linux containers: - name: deployment-nfs - image: mcr.icrosoft.com/oss/nginx/nginx:1.19.5 + image: mcr.microsoft.com/oss/nginx/nginx:1.19.5 command: - "/bin/bash" - "-c" diff --git a/hack/verify-examples.sh b/hack/verify-examples.sh new file mode 100755 index 00000000..1c248d43 --- /dev/null +++ b/hack/verify-examples.sh @@ -0,0 +1,30 @@ +#!/bin/bash +# Copyright 2020 The Kubernetes Authors. +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +set -euo pipefail + +echo "begin to create deployment examples ..." + +kubectl apply -f ./deploy/example/storageclass-nfs.yaml +kubectl apply -f ./deploy/example/deployment.yaml +kubectl apply -f ./deploy/example/statefulset.yaml + +echo "sleep 60s ..." +sleep 60 + +kubectl get pods --field-selector status.phase=Running | grep deployment-nfs +kubectl get pods --field-selector status.phase=Running | grep statefulset-nfs-0 + +echo "deployment examples running completed." diff --git a/test/e2e/e2e_suite_test.go b/test/e2e/e2e_suite_test.go index ea837c90..e6eed16c 100644 --- a/test/e2e/e2e_suite_test.go +++ b/test/e2e/e2e_suite_test.go @@ -26,8 +26,6 @@ import ( "strings" "testing" - "time" - "github.com/kubernetes-csi/csi-driver-nfs/pkg/nfs" "github.com/onsi/ginkgo" "github.com/onsi/gomega" @@ -96,14 +94,12 @@ var _ = ginkgo.BeforeSuite(func() { var _ = ginkgo.AfterSuite(func() { createExampleDeployment := testCmd{ - command: "make", - args: []string{"create-example-deployment"}, + command: "bash", + args: []string{"hack/verify-examples.sh"}, startLog: "create example deployments", endLog: "example deployments created", } execTestCmd([]testCmd{createExampleDeployment}) - // sleep 120s waiting for deployment running complete - time.Sleep(120 * time.Second) nfsLog := testCmd{ command: "bash",