Fix shellcheck failures in test/cmd/d.*.sh

This commit is contained in:
Xiangyang Chu 2019-06-18 18:09:16 +08:00
parent 835552ecb6
commit 3a344c7168
3 changed files with 7 additions and 9 deletions

View File

@ -18,7 +18,5 @@
./hack/lib/test.sh
./hack/test-integration.sh
./hack/verify-test-featuregates.sh
./test/cmd/diff.sh
./test/cmd/discovery.sh
./test/cmd/legacy-script.sh
./test/images/image-util.sh

View File

@ -48,7 +48,7 @@ run_kubectl_diff_same_names() {
create_and_use_new_namespace
kube::log::status "Test kubectl diff with multiple resources with the same name"
output_message=$(KUBECTL_EXTERNAL_DIFF=find kubectl diff -Rf hack/testdata/diff/)
output_message=$(KUBECTL_EXTERNAL_DIFF="find" kubectl diff -Rf hack/testdata/diff/)
kube::test::if_has_string "${output_message}" 'v1\.Pod\..*\.test'
kube::test::if_has_string "${output_message}" 'apps\.v1\.Deployment\..*\.test'
kube::test::if_has_string "${output_message}" 'v1\.ConfigMap\..*\.test'

View File

@ -30,11 +30,11 @@ run_RESTMapper_evaluation_tests() {
### Non-existent resource type should give a recognizeable error
# Pre-condition: None
# Command
kubectl get "${kube_flags[@]}" unknownresourcetype 2>${RESTMAPPER_ERROR_FILE} || true
kubectl get "${kube_flags[@]:?}" unknownresourcetype 2>"${RESTMAPPER_ERROR_FILE}" || true
if grep -q "the server doesn't have a resource type" "${RESTMAPPER_ERROR_FILE}"; then
kube::log::status "\"kubectl get unknownresourcetype\" returns error as expected: $(cat ${RESTMAPPER_ERROR_FILE})"
kube::log::status "\"kubectl get unknownresourcetype\" returns error as expected: $(cat "${RESTMAPPER_ERROR_FILE}")"
else
kube::log::status "\"kubectl get unknownresourcetype\" returns unexpected error or non-error: $(cat ${RESTMAPPER_ERROR_FILE})"
kube::log::status "\"kubectl get unknownresourcetype\" returns unexpected error or non-error: $(cat "${RESTMAPPER_ERROR_FILE}")"
exit 1
fi
rm "${RESTMAPPER_ERROR_FILE}"
@ -121,9 +121,9 @@ run_swagger_tests() {
# Verify schema
file="${KUBE_TEMP}/schema.json"
curl -s "http://127.0.0.1:${API_PORT}/openapi/v2" > "${file}"
[[ "$(grep "list of returned" "${file}")" ]]
[[ "$(grep "List of services" "${file}")" ]]
[[ "$(grep "Watch for changes to the described resources" "${file}")" ]]
grep -q "list of returned" "${file}"
grep -q "List of services" "${file}"
grep -q "Watch for changes to the described resources" "${file}"
set +o nounset
set +o errexit