e2e cleanup
Fix some whitespace and names. Make command-line and flag handling a bit cleaner.
This commit is contained in:
parent
d8bd262b87
commit
9eed6946b7
58
test_e2e.sh
58
test_e2e.sh
|
|
@ -125,19 +125,6 @@ mkdir -p "$DOT_SSH"
|
||||||
ssh-keygen -f "$DOT_SSH/id_test" -P "" >/dev/null
|
ssh-keygen -f "$DOT_SSH/id_test" -P "" >/dev/null
|
||||||
cat "$DOT_SSH/id_test.pub" > "$DOT_SSH/authorized_keys"
|
cat "$DOT_SSH/id_test.pub" > "$DOT_SSH/authorized_keys"
|
||||||
|
|
||||||
function finish() {
|
|
||||||
r=$?
|
|
||||||
trap "" INT EXIT
|
|
||||||
if [[ $r != 0 ]]; then
|
|
||||||
echo
|
|
||||||
echo "the directory $DIR was not removed as it contains"\
|
|
||||||
"log files useful for debugging"
|
|
||||||
fi
|
|
||||||
remove_containers
|
|
||||||
exit $r
|
|
||||||
}
|
|
||||||
trap finish INT EXIT
|
|
||||||
|
|
||||||
SLOW_GIT_CLONE=/slow_git_clone.sh
|
SLOW_GIT_CLONE=/slow_git_clone.sh
|
||||||
SLOW_GIT_FETCH=/slow_git_fetch.sh
|
SLOW_GIT_FETCH=/slow_git_fetch.sh
|
||||||
ASKPASS_GIT=/askpass_git.sh
|
ASKPASS_GIT=/askpass_git.sh
|
||||||
|
|
@ -1109,6 +1096,7 @@ function e2e::exechook_success_once() {
|
||||||
##############################################
|
##############################################
|
||||||
function e2e::exechook_fail_once() {
|
function e2e::exechook_fail_once() {
|
||||||
cat /dev/null > "$RUNLOG"
|
cat /dev/null > "$RUNLOG"
|
||||||
|
|
||||||
# First sync - return a failure to ensure that we try again
|
# First sync - return a failure to ensure that we try again
|
||||||
echo "$FUNCNAME 1" > "$REPO"/file
|
echo "$FUNCNAME 1" > "$REPO"/file
|
||||||
git -C "$REPO" commit -qam "$FUNCNAME 1"
|
git -C "$REPO" commit -qam "$FUNCNAME 1"
|
||||||
|
|
@ -1127,8 +1115,8 @@ function e2e::exechook_fail_once() {
|
||||||
# Check that exechook was called
|
# Check that exechook was called
|
||||||
sleep 2
|
sleep 2
|
||||||
RUNS=$(cat "$RUNLOG" | wc -l)
|
RUNS=$(cat "$RUNLOG" | wc -l)
|
||||||
if [[ "$RUNS" < 1 ]]; then
|
if [[ "$RUNS" != 1 ]]; then
|
||||||
fail "exechook called $RUNS times, it should be at least 1"
|
fail "exechook called $RUNS times, it should be at exactly 1"
|
||||||
fi
|
fi
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -1258,8 +1246,8 @@ function e2e::webhook_success_once() {
|
||||||
# check that basic call works
|
# check that basic call works
|
||||||
sleep 2
|
sleep 2
|
||||||
HITS=$(cat "$HITLOG" | wc -l)
|
HITS=$(cat "$HITLOG" | wc -l)
|
||||||
if [[ "$HITS" < 1 ]]; then
|
if [[ "$HITS" != 1 ]]; then
|
||||||
fail "webhook 1 called $HITS times"
|
fail "webhook called $HITS times"
|
||||||
fi
|
fi
|
||||||
|
|
||||||
docker_kill "$CTR"
|
docker_kill "$CTR"
|
||||||
|
|
@ -1295,8 +1283,8 @@ function e2e::webhook_fail_retry_once() {
|
||||||
# Check that webhook was called
|
# Check that webhook was called
|
||||||
sleep 2
|
sleep 2
|
||||||
HITS=$(cat "$HITLOG" | wc -l)
|
HITS=$(cat "$HITLOG" | wc -l)
|
||||||
if [[ "$HITS" < 1 ]]; then
|
if [[ "$HITS" != 1 ]]; then
|
||||||
fail "webhook 1 called $HITS times"
|
fail "webhook called $HITS times"
|
||||||
fi
|
fi
|
||||||
docker_kill "$CTR"
|
docker_kill "$CTR"
|
||||||
}
|
}
|
||||||
|
|
@ -1807,14 +1795,29 @@ function list_tests() {
|
||||||
# Figure out which, if any, tests to run.
|
# Figure out which, if any, tests to run.
|
||||||
tests=($(list_tests))
|
tests=($(list_tests))
|
||||||
|
|
||||||
# Use -? to just list tests.
|
function print_tests() {
|
||||||
if [[ "$#" == 1 && "$1" == "-?" ]]; then
|
|
||||||
echo "available tests:"
|
echo "available tests:"
|
||||||
for t in "${tests[@]}"; do
|
for t in "${tests[@]}"; do
|
||||||
echo " $t"
|
echo " $t"
|
||||||
done
|
done
|
||||||
|
}
|
||||||
|
|
||||||
|
for t; do
|
||||||
|
# Use -? to list known tests.
|
||||||
|
if [[ "${t}" == "-?" ]]; then
|
||||||
|
print_tests
|
||||||
exit 0
|
exit 0
|
||||||
fi
|
fi
|
||||||
|
# Make sure we know this test.
|
||||||
|
if [[ " ${tests[*]} " =~ " ${t} " ]]; then
|
||||||
|
continue
|
||||||
|
fi
|
||||||
|
# Not a known test or flag.
|
||||||
|
echo "ERROR: unknown test or flag: '${t}'"
|
||||||
|
echo
|
||||||
|
print_tests
|
||||||
|
exit 1
|
||||||
|
done
|
||||||
|
|
||||||
# If no tests specified, run them all.
|
# If no tests specified, run them all.
|
||||||
if [[ "$#" == 0 ]]; then
|
if [[ "$#" == 0 ]]; then
|
||||||
|
|
@ -1825,6 +1828,19 @@ fi
|
||||||
make container REGISTRY=e2e VERSION=$(make -s version)
|
make container REGISTRY=e2e VERSION=$(make -s version)
|
||||||
make test-tools REGISTRY=e2e
|
make test-tools REGISTRY=e2e
|
||||||
|
|
||||||
|
function finish() {
|
||||||
|
r=$?
|
||||||
|
trap "" INT EXIT
|
||||||
|
if [[ $r != 0 ]]; then
|
||||||
|
echo
|
||||||
|
echo "the directory $DIR was not removed as it contains"\
|
||||||
|
"log files useful for debugging"
|
||||||
|
fi
|
||||||
|
remove_containers
|
||||||
|
exit $r
|
||||||
|
}
|
||||||
|
trap finish INT EXIT
|
||||||
|
|
||||||
echo
|
echo
|
||||||
echo "test root is $DIR"
|
echo "test root is $DIR"
|
||||||
echo
|
echo
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue