Skip to content

Commit b540539

Browse files
authored
Merge pull request kubernetes#76810 from SataQiu/fix-hack-shellcheck-2019041903
Fix shellcheck failures of hack/test-update-storage-objects.sh
2 parents f3ec8f0 + 4d6319b commit b540539

File tree

2 files changed

+10
-11
lines changed

2 files changed

+10
-11
lines changed

hack/.shellcheck_failures

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,6 @@
4141
./hack/make-rules/vet.sh
4242
./hack/pin-dependency.sh
4343
./hack/test-integration.sh
44-
./hack/test-update-storage-objects.sh
4544
./hack/update-vendor.sh
4645
./hack/verify-api-groups.sh
4746
./hack/verify-boilerplate.sh

hack/test-update-storage-objects.sh

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@ set -o errexit
2020
set -o nounset
2121
set -o pipefail
2222

23-
KUBE_ROOT=$(dirname "${BASH_SOURCE}")/..
23+
KUBE_ROOT=$(dirname "${BASH_SOURCE[0]}")/..
2424
source "${KUBE_ROOT}/hack/lib/init.sh"
2525

2626
# The api version in which objects are currently stored in etcd.
@@ -67,7 +67,7 @@ function startApiServer() {
6767
--cert-dir="${TMPDIR:-/tmp/}" \
6868
--service-cluster-ip-range="10.0.0.0/24" \
6969
--storage-versions="${storage_versions}" \
70-
--storage-media-type=${storage_media_type} 1>&2 &
70+
--storage-media-type="${storage_media_type}" 1>&2 &
7171
APISERVER_PID=$!
7272

7373
# url, prefix, wait, times
@@ -103,7 +103,7 @@ echo "${ETCD_VERSION}" > "${ETCD_DIR}/version.txt"
103103

104104
# source_file,resource,namespace,name,old_version,new_version
105105
tests=(
106-
test/e2e/testing-manifests/rbd-storage-class.yaml,storageclasses,,slow,v1beta1,v1
106+
"test/e2e/testing-manifests/rbd-storage-class.yaml,storageclasses,,slow,v1beta1,v1"
107107
)
108108

109109
KUBE_OLD_API_VERSION="networking.k8s.io/v1,storage.k8s.io/v1beta1,extensions/v1beta1"
@@ -123,7 +123,7 @@ startApiServer ${KUBE_OLD_STORAGE_VERSIONS} ${KUBE_STORAGE_MEDIA_TYPE_JSON}
123123

124124

125125
# Create object(s)
126-
for test in ${tests[@]}; do
126+
for test in "${tests[@]}"; do
127127
IFS=',' read -ra test_data <<<"$test"
128128
source_file=${test_data[0]}
129129

@@ -140,7 +140,7 @@ for test in ${tests[@]}; do
140140
namespace="${namespace}/"
141141
fi
142142
kube::log::status "Verifying ${resource}/${namespace}${name} has storage version ${old_storage_version} in etcd"
143-
ETCDCTL_API=3 ${ETCDCTL} --endpoints="http://${ETCD_HOST}:${ETCD_PORT}" get "/${ETCD_PREFIX}/${resource}/${namespace}${name}" | grep ${old_storage_version}
143+
ETCDCTL_API=3 ${ETCDCTL} --endpoints="http://${ETCD_HOST}:${ETCD_PORT}" get "/${ETCD_PREFIX}/${resource}/${namespace}${name}" | grep "${old_storage_version}"
144144
done
145145

146146
killApiServer
@@ -160,7 +160,7 @@ kube::log::status "Updating storage versions in etcd"
160160
${UPDATE_ETCD_OBJECTS_SCRIPT}
161161

162162
# Verify that the storage version was changed in etcd
163-
for test in ${tests[@]}; do
163+
for test in "${tests[@]}"; do
164164
IFS=',' read -ra test_data <<<"$test"
165165
resource=${test_data[1]}
166166
namespace=${test_data[2]}
@@ -171,7 +171,7 @@ for test in ${tests[@]}; do
171171
namespace="${namespace}/"
172172
fi
173173
kube::log::status "Verifying ${resource}/${namespace}${name} has updated storage version ${new_storage_version} in etcd"
174-
ETCDCTL_API=3 ${ETCDCTL} --endpoints="http://${ETCD_HOST}:${ETCD_PORT}" get "/${ETCD_PREFIX}/${resource}/${namespace}${name}" | grep ${new_storage_version}
174+
ETCDCTL_API=3 ${ETCDCTL} --endpoints="http://${ETCD_HOST}:${ETCD_PORT}" get "/${ETCD_PREFIX}/${resource}/${namespace}${name}" | grep "${new_storage_version}"
175175
done
176176

177177
killApiServer
@@ -188,7 +188,7 @@ RUNTIME_CONFIG="api/all=false,api/v1=true,apiregistration.k8s.io/v1=true,${KUBE_
188188
sleep 1
189189
startApiServer ${KUBE_NEW_STORAGE_VERSIONS} ${KUBE_STORAGE_MEDIA_TYPE_PROTOBUF}
190190

191-
for test in ${tests[@]}; do
191+
for test in "${tests[@]}"; do
192192
IFS=',' read -ra test_data <<<"$test"
193193
resource=${test_data[1]}
194194
namespace=${test_data[2]}
@@ -203,8 +203,8 @@ for test in ${tests[@]}; do
203203
kube::log::status "Verifying we can retrieve ${resource}/${namespace}${name} via kubectl"
204204
# We have to remove the cached discovery information about the old version; otherwise,
205205
# the 'kubectl get' will use that and fail to find the resource.
206-
rm -rf ${HOME}/.kube/cache/discovery/localhost_8080/${KUBE_OLD_STORAGE_VERSIONS}
207-
${KUBECTL} get ${namespace_flag} ${resource}/${name}
206+
rm -rf "${HOME}/.kube/cache/discovery/localhost_8080/${KUBE_OLD_STORAGE_VERSIONS}"
207+
${KUBECTL} get "${namespace_flag}" "${resource}/${name}"
208208
done
209209

210210
killApiServer

0 commit comments

Comments
 (0)