test: refactor verify example test
fix image
This commit is contained in:
parent
7271a3cc0f
commit
67218855ab
8
Makefile
8
Makefile
@ -119,10 +119,4 @@ e2e-teardown:
|
|||||||
|
|
||||||
.PHONY: e2e-test
|
.PHONY: e2e-test
|
||||||
e2e-test:
|
e2e-test:
|
||||||
go test -v -timeout=0 ./test/e2e ${GINKGO_FLAGS}
|
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
|
|
||||||
@ -30,7 +30,7 @@ spec:
|
|||||||
"kubernetes.io/os": linux
|
"kubernetes.io/os": linux
|
||||||
containers:
|
containers:
|
||||||
- name: deployment-nfs
|
- name: deployment-nfs
|
||||||
image: mcr.icrosoft.com/oss/nginx/nginx:1.19.5
|
image: mcr.microsoft.com/oss/nginx/nginx:1.19.5
|
||||||
command:
|
command:
|
||||||
- "/bin/bash"
|
- "/bin/bash"
|
||||||
- "-c"
|
- "-c"
|
||||||
|
|||||||
30
hack/verify-examples.sh
Executable file
30
hack/verify-examples.sh
Executable file
@ -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."
|
||||||
@ -26,8 +26,6 @@ import (
|
|||||||
"strings"
|
"strings"
|
||||||
"testing"
|
"testing"
|
||||||
|
|
||||||
"time"
|
|
||||||
|
|
||||||
"github.com/kubernetes-csi/csi-driver-nfs/pkg/nfs"
|
"github.com/kubernetes-csi/csi-driver-nfs/pkg/nfs"
|
||||||
"github.com/onsi/ginkgo"
|
"github.com/onsi/ginkgo"
|
||||||
"github.com/onsi/gomega"
|
"github.com/onsi/gomega"
|
||||||
@ -96,14 +94,12 @@ var _ = ginkgo.BeforeSuite(func() {
|
|||||||
|
|
||||||
var _ = ginkgo.AfterSuite(func() {
|
var _ = ginkgo.AfterSuite(func() {
|
||||||
createExampleDeployment := testCmd{
|
createExampleDeployment := testCmd{
|
||||||
command: "make",
|
command: "bash",
|
||||||
args: []string{"create-example-deployment"},
|
args: []string{"hack/verify-examples.sh"},
|
||||||
startLog: "create example deployments",
|
startLog: "create example deployments",
|
||||||
endLog: "example deployments created",
|
endLog: "example deployments created",
|
||||||
}
|
}
|
||||||
execTestCmd([]testCmd{createExampleDeployment})
|
execTestCmd([]testCmd{createExampleDeployment})
|
||||||
// sleep 120s waiting for deployment running complete
|
|
||||||
time.Sleep(120 * time.Second)
|
|
||||||
|
|
||||||
nfsLog := testCmd{
|
nfsLog := testCmd{
|
||||||
command: "bash",
|
command: "bash",
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user