-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
ci: add shellcheck differential checks
Enables linting the various shell scripts using shellcheck. Signed-off-by: Andy Sadler <[email protected]>
- Loading branch information
Showing
2 changed files
with
21 additions
and
14 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,50 +1,53 @@ | ||
#!/usr/bin/env bash | ||
#!/bin/bash | ||
|
||
set -o pipefail | ||
|
||
usage() { | ||
echo "$0 usage:" | ||
grep " .)\ #" $0 | sed -e "s/^\s\+\([a-z]\).*)\ # \(.*\)$/\t-\1: \2/g" | ||
grep " .)\ #" "$0" | sed -e "s/^\s\+\([a-z]\).*)\ # \(.*\)$/\t-\1: \2/g" | ||
exit 0 | ||
} | ||
|
||
while getopts ":j:n:h" arg; do | ||
case $arg in | ||
case ${arg} in | ||
j) # set number of jobs to use to run tests (may cause test instability!) | ||
jobs=${OPTARG} | ||
;; | ||
n) # set the namespace to run tests in | ||
TEST_NAMESPACE=${OPTARG} | ||
TEST_NAMESPACE="${OPTARG}" | ||
;; | ||
h) # display help | ||
usage | ||
exit 0 | ||
;; | ||
*) | ||
usage | ||
;; | ||
esac | ||
done | ||
|
||
OUTPUT_DIR=test-output | ||
if [ -f test-tmp-dir ]; then | ||
OUTPUT_DIR=$(cat test-tmp-dir) | ||
if [[ -f test-tmp-dir ]]; then | ||
OUTPUT_DIR="$(cat test-tmp-dir)" | ||
fi | ||
[ -d "${OUTPUT_DIR}" ] || mkdir -p "${OUTPUT_DIR}" | ||
[[ -d "${OUTPUT_DIR}" ]] || mkdir -p "${OUTPUT_DIR}" | ||
|
||
PYTHON_VENV_DIR="${OUTPUT_DIR}/venv" | ||
|
||
mkdir -p "${OUTPUT_DIR}" | ||
|
||
if [ -z $TEST_NAMESPACE ]; then | ||
if [[ -z "${TEST_NAMESPACE}" ]]; then | ||
TEST_NAMESPACE="servicebindings-cts" | ||
fi | ||
|
||
TEST_ACCEPTANCE_OUTPUT_DIR="${OUTPUT_DIR}"/results | ||
|
||
if [ $(kubectl get namespace ${TEST_NAMESPACE} > /dev/null; echo $?) -eq '0' ]; then | ||
kubectl delete namespace ${TEST_NAMESPACE} | ||
fi | ||
# shellcheck disable=SC2261 | ||
kubectl get namespace "${TEST_NAMESPACE}" 2&>/dev/null > /dev/null || kubectl delete namespace "${TEST_NAMESPACE}" | ||
|
||
if [ -z $jobs ]; then | ||
if [[ -z "${jobs}" ]]; then | ||
jobs=1 | ||
fi | ||
|
||
echo "Running acceptance tests" | ||
|
||
FEATURES_PATH=features TEST_NAMESPACE=${TEST_NAMESPACE} "${PYTHON_VENV_DIR}/bin/behavex" -o ${TEST_ACCEPTANCE_OUTPUT_DIR} --capture --capture-stderr --parallel-processes ${jobs} --parallel-scheme scenario | ||
FEATURES_PATH=features TEST_NAMESPACE="${TEST_NAMESPACE}" "${PYTHON_VENV_DIR}/bin/behavex" -o "${TEST_ACCEPTANCE_OUTPUT_DIR}" --capture --capture-stderr --parallel-processes "${jobs}" --parallel-scheme scenario |