e2e: compare numbers numerically, not lexically
Thanks, bash, for supporting `<` and `>` and making them NOT mean the obvious thing. This shows up when you set RUNS=10: `[[ 2 < 10 ]]` is false `(( 2 < 10 ))` is true
This commit is contained in:
parent
c1b8617385
commit
f4d067c987
18
test_e2e.sh
18
test_e2e.sh
|
|
@ -33,7 +33,7 @@ function wait_for_file_exists() {
|
||||||
local file=$1
|
local file=$1
|
||||||
local ticks=$(($2*10)) # 100ms per tick
|
local ticks=$(($2*10)) # 100ms per tick
|
||||||
|
|
||||||
while [[ $ticks > 0 ]]; do
|
while (( $ticks > 0 )); do
|
||||||
if [[ -f "$file" ]]; then
|
if [[ -f "$file" ]]; then
|
||||||
break
|
break
|
||||||
fi
|
fi
|
||||||
|
|
@ -1629,7 +1629,7 @@ function e2e::exechook_fail_retry() {
|
||||||
|
|
||||||
# Check that exechook was called
|
# Check that exechook was called
|
||||||
RUNS=$(cat "$RUNLOG" | wc -l)
|
RUNS=$(cat "$RUNLOG" | wc -l)
|
||||||
if [[ "$RUNS" < 2 ]]; then
|
if (( "$RUNS" < 2 )); then
|
||||||
fail "exechook called $RUNS times, it should be at least 2"
|
fail "exechook called $RUNS times, it should be at least 2"
|
||||||
fi
|
fi
|
||||||
}
|
}
|
||||||
|
|
@ -1734,7 +1734,7 @@ function e2e::webhook_success() {
|
||||||
wait_for_sync "${MAXWAIT}"
|
wait_for_sync "${MAXWAIT}"
|
||||||
sleep 1 # webhooks are async
|
sleep 1 # webhooks are async
|
||||||
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 1 called $HITS times"
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
|
@ -1747,7 +1747,7 @@ function e2e::webhook_success() {
|
||||||
wait_for_sync "${MAXWAIT}"
|
wait_for_sync "${MAXWAIT}"
|
||||||
sleep 1 # webhooks are async
|
sleep 1 # webhooks are async
|
||||||
HITS=$(cat "$HITLOG" | wc -l)
|
HITS=$(cat "$HITLOG" | wc -l)
|
||||||
if [[ "$HITS" < 1 ]]; then
|
if (( "$HITS" < 1 )); then
|
||||||
fail "webhook 2 called $HITS times"
|
fail "webhook 2 called $HITS times"
|
||||||
fi
|
fi
|
||||||
}
|
}
|
||||||
|
|
@ -1785,7 +1785,7 @@ function e2e::webhook_fail_retry() {
|
||||||
wait_for_sync "${MAXWAIT}"
|
wait_for_sync "${MAXWAIT}"
|
||||||
sleep 1 # webhooks are async
|
sleep 1 # webhooks are async
|
||||||
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 1 called $HITS times"
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
|
@ -1802,7 +1802,7 @@ function e2e::webhook_fail_retry() {
|
||||||
')
|
')
|
||||||
sleep 2 # webhooks are async
|
sleep 2 # webhooks are async
|
||||||
HITS=$(cat "$HITLOG" | wc -l)
|
HITS=$(cat "$HITLOG" | wc -l)
|
||||||
if [[ "$HITS" < 1 ]]; then
|
if (( "$HITS" < 1 )); then
|
||||||
fail "webhook 2 called $HITS times"
|
fail "webhook 2 called $HITS times"
|
||||||
fi
|
fi
|
||||||
}
|
}
|
||||||
|
|
@ -1925,7 +1925,7 @@ function e2e::webhook_fire_and_forget() {
|
||||||
wait_for_sync "${MAXWAIT}"
|
wait_for_sync "${MAXWAIT}"
|
||||||
sleep 1 # webhooks are async
|
sleep 1 # webhooks are async
|
||||||
HITS=$(cat "$HITLOG" | wc -l)
|
HITS=$(cat "$HITLOG" | wc -l)
|
||||||
if [[ "$HITS" < 1 ]]; then
|
if (( "$HITS" < 1 )); then
|
||||||
fail "webhook called $HITS times"
|
fail "webhook called $HITS times"
|
||||||
fi
|
fi
|
||||||
}
|
}
|
||||||
|
|
@ -2846,13 +2846,13 @@ RUNS="${RUNS:-1}"
|
||||||
for t; do
|
for t; do
|
||||||
TEST_RET=0
|
TEST_RET=0
|
||||||
RUN=0
|
RUN=0
|
||||||
while [[ "${RUN}" < "${RUNS}" ]]; do
|
while (( "${RUN}" < "${RUNS}" )); do
|
||||||
clean_root
|
clean_root
|
||||||
clean_work
|
clean_work
|
||||||
init_repo
|
init_repo
|
||||||
|
|
||||||
sfx=""
|
sfx=""
|
||||||
if [[ "${RUNS}" > 1 ]]; then
|
if (( "${RUNS}" > 1 )); then
|
||||||
sfx=" ($((RUN+1))/${RUNS})"
|
sfx=" ($((RUN+1))/${RUNS})"
|
||||||
fi
|
fi
|
||||||
echo -n "testcase ${t}${sfx}: "
|
echo -n "testcase ${t}${sfx}: "
|
||||||
|
|
|
||||||
|
|
@ -934,13 +934,13 @@ RUNS="${RUNS:-1}"
|
||||||
for t; do
|
for t; do
|
||||||
TEST_RET=0
|
TEST_RET=0
|
||||||
RUN=0
|
RUN=0
|
||||||
while [[ "${RUN}" < "${RUNS}" ]]; do
|
while (( "${RUN}" < "${RUNS}" )); do
|
||||||
clean_workdir
|
clean_workdir
|
||||||
|
|
||||||
pushd "$WORKDIR" >/dev/null
|
pushd "$WORKDIR" >/dev/null
|
||||||
|
|
||||||
sfx=""
|
sfx=""
|
||||||
if [[ "${RUNS}" > 1 ]]; then
|
if (( "${RUNS}" > 1 )); then
|
||||||
sfx=" ($((RUN+1))/${RUNS})"
|
sfx=" ($((RUN+1))/${RUNS})"
|
||||||
fi
|
fi
|
||||||
echo -n "testcase ${t}${sfx}: "
|
echo -n "testcase ${t}${sfx}: "
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue