From 143e068b9a36f0ff7496ac228390643fad78ab07 Mon Sep 17 00:00:00 2001 From: andyzhangx Date: Sat, 12 Feb 2022 05:16:16 +0000 Subject: [PATCH] chore: fix shellcheck issues --- .prow.sh | 4 ++-- test/integration/run-test.sh | 5 +++-- test/sanity/run-test.sh | 2 +- test/utils/check_driver_pods_restart.sh | 6 +++--- test/utils/nfs_log.sh | 4 ++-- 5 files changed, 11 insertions(+), 10 deletions(-) diff --git a/.prow.sh b/.prow.sh index 00bd8e31..3ec03d0f 100755 --- a/.prow.sh +++ b/.prow.sh @@ -1,3 +1,5 @@ +#! /bin/bash + # Copyright 2020 The Kubernetes Authors. # # Licensed under the Apache License, Version 2.0 (the "License"); @@ -12,8 +14,6 @@ # See the License for the specific language governing permissions and # limitations under the License. -#! /bin/bash - # A Prow job can override these defaults, but this shouldn't be necessary. # Only these tests make sense for csi-driver-nfs until we can integrate k/k diff --git a/test/integration/run-test.sh b/test/integration/run-test.sh index 5dd6bfb6..3760b3ec 100755 --- a/test/integration/run-test.sh +++ b/test/integration/run-test.sh @@ -32,14 +32,14 @@ function provision_nfs_server { echo 'Installing NFS server on localhost' apt-get update -y apt-get install -y nfs-common - docker run -d --name nfs --privileged -p 2049:2049 -v $(pwd)/nfsshare:/nfsshare -e SHARED_DIRECTORY=/nfsshare itsthenetwork/nfs-server-alpine:latest + docker run -d --name nfs --privileged -p 2049:2049 -v "$(pwd)"/nfsshare:/nfsshare -e SHARED_DIRECTORY=/nfsshare itsthenetwork/nfs-server-alpine:latest } provision_nfs_server readonly CSC_BIN="$GOBIN/csc" readonly cap="1,mount," -readonly volname="citest-$(date +%s)" +volname="citest-$(date +%s)" readonly volsize="2147483648" readonly endpoint="unix:///tmp/csi.sock" readonly target_path="/tmp/targetpath" @@ -70,6 +70,7 @@ echo "publish volume test:" "$CSC_BIN" node publish --endpoint "$endpoint" --cap "$cap" --vol-context "$params" --target-path "$target_path" "$volumeid" sleep 2 +declare staging_target_path echo "node stats test:" csc node stats --endpoint "$endpoint" "$volumeid:$target_path:$staging_target_path" sleep 2 diff --git a/test/sanity/run-test.sh b/test/sanity/run-test.sh index 9ebf1e9f..012ab0a0 100755 --- a/test/sanity/run-test.sh +++ b/test/sanity/run-test.sh @@ -42,7 +42,7 @@ function provision_nfs_server { echo 'Installing NFS server on localhost' apt-get update -y apt-get install -y nfs-common - docker run -d --name nfs --privileged -p 2049:2049 -v $(pwd)/nfsshare:/nfsshare -e SHARED_DIRECTORY=/nfsshare itsthenetwork/nfs-server-alpine:latest + docker run -d --name nfs --privileged -p 2049:2049 -v "$(pwd)"/nfsshare:/nfsshare -e SHARED_DIRECTORY=/nfsshare itsthenetwork/nfs-server-alpine:latest } provision_nfs_server diff --git a/test/utils/check_driver_pods_restart.sh b/test/utils/check_driver_pods_restart.sh index f9df9fcd..71c53a9c 100644 --- a/test/utils/check_driver_pods_restart.sh +++ b/test/utils/check_driver_pods_restart.sh @@ -1,3 +1,5 @@ +#!/bin/bash + # Copyright 2020 The Kubernetes Authors. # # Licensed under the Apache License, Version 2.0 (the "License"); @@ -12,8 +14,6 @@ # See the License for the specific language governing permissions and # limitations under the License. -#!/bin/bash - set -e echo "check the driver pods if restarts ..." @@ -28,4 +28,4 @@ do fi done echo "no driver pods have restarted" -echo "======================================================================================" \ No newline at end of file +echo "======================================================================================" diff --git a/test/utils/nfs_log.sh b/test/utils/nfs_log.sh index 18a70af4..0260810d 100644 --- a/test/utils/nfs_log.sh +++ b/test/utils/nfs_log.sh @@ -1,3 +1,5 @@ +#!/bin/bash + # Copyright 2020 The Kubernetes Authors. # # Licensed under the Apache License, Version 2.0 (the "License"); @@ -12,8 +14,6 @@ # See the License for the specific language governing permissions and # limitations under the License. -#!/bin/bash - set -e NS=kube-system