From 641f883b8211a3d06c84daac9f2de157630b9f4f Mon Sep 17 00:00:00 2001 From: xichengliudui <1693291525@qq.com> Date: Mon, 18 Feb 2019 01:16:39 -0500 Subject: [PATCH] fix shellcheck in test/integration/... and test/kubemark/... --- hack/.shellcheck_failures | 4 ---- test/integration/ipamperf/test-performance.sh | 8 ++++---- test/integration/scheduler_perf/test-performance.sh | 6 +++--- test/kubemark/configure-kubectl.sh | 4 ++-- test/kubemark/pre-existing/util.sh | 4 ++-- 5 files changed, 11 insertions(+), 15 deletions(-) diff --git a/hack/.shellcheck_failures b/hack/.shellcheck_failures index 6ba671b985e..d4734a1e894 100644 --- a/hack/.shellcheck_failures +++ b/hack/.shellcheck_failures @@ -199,16 +199,12 @@ ./test/images/volume/rbd/create_block.sh ./test/images/volume/rbd/mon.sh ./test/images/volume/rbd/osd.sh -./test/integration/ipamperf/test-performance.sh -./test/integration/scheduler_perf/test-performance.sh ./test/kubemark/common/util.sh -./test/kubemark/configure-kubectl.sh ./test/kubemark/gce/util.sh ./test/kubemark/iks/shutdown.sh ./test/kubemark/iks/startup.sh ./test/kubemark/iks/util.sh ./test/kubemark/master-log-dump.sh -./test/kubemark/pre-existing/util.sh ./test/kubemark/resources/start-kubemark-master.sh ./test/kubemark/run-e2e-tests.sh ./test/kubemark/start-kubemark.sh diff --git a/test/integration/ipamperf/test-performance.sh b/test/integration/ipamperf/test-performance.sh index 0540978c090..20d9832c87d 100755 --- a/test/integration/ipamperf/test-performance.sh +++ b/test/integration/ipamperf/test-performance.sh @@ -67,13 +67,13 @@ while getopts ":hdr:o:p:ca:k:n:m:l:" opt; do esac done -KUBE_ROOT=$(dirname "${BASH_SOURCE}")/../../../ +KUBE_ROOT=$(dirname "${BASH_SOURCE[0]}")/../../../ source "${KUBE_ROOT}/hack/lib/init.sh" kube::golang::setup_env -DIR_BASENAME=$(dirname "${BASH_SOURCE}") -pushd ${DIR_BASENAME} +DIR_BASENAME=$(dirname "${BASH_SOURCE[0]}") +pushd "${DIR_BASENAME}" cleanup() { popd 2> /dev/null @@ -87,5 +87,5 @@ kube::etcd::start # Running IPAM tests. It might take a long time. kube::log::status "performance test (IPAM) start" -go test ${PROFILE_OPTS} -test.run=${RUN_PATTERN} -test.timeout=60m -test.short=false -v -args ${TEST_ARGS} +go test "${PROFILE_OPTS}" -test.run="${RUN_PATTERN}" -test.timeout=60m -test.short=false -v -args "${TEST_ARGS}" kube::log::status "... IPAM tests finished." diff --git a/test/integration/scheduler_perf/test-performance.sh b/test/integration/scheduler_perf/test-performance.sh index 472939d5cb4..ad75fae5dfd 100755 --- a/test/integration/scheduler_perf/test-performance.sh +++ b/test/integration/scheduler_perf/test-performance.sh @@ -18,13 +18,13 @@ set -o errexit set -o nounset set -o pipefail -KUBE_ROOT=$(dirname "${BASH_SOURCE}")/../../../ +KUBE_ROOT=$(dirname "${BASH_SOURCE[0]}")/../../../ source "${KUBE_ROOT}/hack/lib/init.sh" kube::golang::setup_env -DIR_BASENAME=$(dirname "${BASH_SOURCE}") -pushd ${DIR_BASENAME} +DIR_BASENAME=$(dirname "${BASH_SOURCE[0]}") +pushd "${DIR_BASENAME}" cleanup() { popd 2> /dev/null diff --git a/test/kubemark/configure-kubectl.sh b/test/kubemark/configure-kubectl.sh index eec173b2a59..2ac77b5e73d 100755 --- a/test/kubemark/configure-kubectl.sh +++ b/test/kubemark/configure-kubectl.sh @@ -16,5 +16,5 @@ # This script assumes that kubectl binary is present in PATH. kubectl config set-cluster hollow-cluster --server=http://localhost:8080 --insecure-skip-tls-verify=true -kubectl config set-credentials $(whoami) -kubectl config set-context hollow-context --cluster=hollow-cluster --user=$(whoami) +kubectl config set-credentials "$(whoami)" +kubectl config set-context hollow-context --cluster=hollow-cluster --user="$(whoami)" diff --git a/test/kubemark/pre-existing/util.sh b/test/kubemark/pre-existing/util.sh index 22be7913569..3e279af5e92 100644 --- a/test/kubemark/pre-existing/util.sh +++ b/test/kubemark/pre-existing/util.sh @@ -14,7 +14,7 @@ # See the License for the specific language governing permissions and # limitations under the License. -KUBE_ROOT=$(dirname "${BASH_SOURCE}")/../../.. +KUBE_ROOT=$(dirname "${BASH_SOURCE[0]}")/../../.. source "${KUBE_ROOT}/test/kubemark/common/util.sh" @@ -23,5 +23,5 @@ source "${KUBE_ROOT}/test/kubemark/common/util.sh" function execute-cmd-on-pre-existing-master-with-retries() { IP_WITHOUT_PORT=$(echo "${MASTER_IP}" | cut -f 1 -d ':') || "${MASTER_IP}" - RETRIES="${2:-1}" run-cmd-with-retries ssh kubernetes@"${IP_WITHOUT_PORT}" $1 + RETRIES="${2:-1}" run-cmd-with-retries ssh kubernetes@"${IP_WITHOUT_PORT}" "${1}" }