Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
37 changes: 15 additions & 22 deletions nodeadm/test/e2e/cases/aws-api-connection-timeout/run.sh
Original file line number Diff line number Diff line change
Expand Up @@ -16,28 +16,21 @@ mock::kubelet 1.29.0
DEFAULT_MAX_ATTEMPTS=3
CONNECTION_TIMEOUT=30

# ensure the max retry attempts can be overridden with the standard env var
# we have to test with values that are different from the default
MAX_ATTEMPTS_VALUES=(1 2)

for MAX_ATTEMPTS_VALUE in "${MAX_ATTEMPTS_VALUES[@]}"; do
if [ "$MAX_ATTEMPTS_VALUE" = "$DEFAULT_MAX_ATTEMPTS" ]; then
echo "We can't test with a value ($MAX_ATTEMPTS_VALUE) that is the same as the default!"
exit 1
fi
echo "testing with MAX_ATTEMPTS=${MAX_ATTEMPTS_VALUE}"
START=$(date +%s)
AWS_MAX_ATTEMPTS=${MAX_ATTEMPTS_VALUE} nodeadm init --development --skip run --config-source file://config.yaml || true
END=$(date +%s)
SECONDS_ELAPSED=$((END - START))
LOWER_BOUND=$((MAX_ATTEMPTS_VALUE * CONNECTION_TIMEOUT))
UPPER_BOUND=$((LOWER_BOUND + 5))
echo "MAX_ATTEMPTS=${MAX_ATTEMPTS_VALUE} SECONDS_ELAPSED=${SECONDS_ELAPSED}, LOWER_BOUND=${LOWER_BOUND}, UPPER_BOUND=${UPPER_BOUND}"
if ! ((SECONDS_ELAPSED >= LOWER_BOUND && SECONDS_ELAPSED <= UPPER_BOUND)); then
echo "The observed AWS SDK retry behavior did not fall within the expected range!"
exit 1
fi
done
# This must be different from either our default of 30 or the aws default of 3.
MAX_ATTEMPTS_VALUE=1

echo "testing with MAX_ATTEMPTS=${MAX_ATTEMPTS_VALUE}"
START=$(date +%s)
AWS_MAX_ATTEMPTS=${MAX_ATTEMPTS_VALUE} nodeadm init --development --skip run --config-source file://config.yaml || true
END=$(date +%s)
SECONDS_ELAPSED=$((END - START))
LOWER_BOUND=$((MAX_ATTEMPTS_VALUE * CONNECTION_TIMEOUT))
UPPER_BOUND=$((LOWER_BOUND + 5))
echo "MAX_ATTEMPTS=${MAX_ATTEMPTS_VALUE} SECONDS_ELAPSED=${SECONDS_ELAPSED}, LOWER_BOUND=${LOWER_BOUND}, UPPER_BOUND=${UPPER_BOUND}"
if ! ((SECONDS_ELAPSED >= LOWER_BOUND && SECONDS_ELAPSED <= UPPER_BOUND)); then
echo "The observed AWS SDK retry behavior did not fall within the expected range!"
exit 1
fi

# now, we need to make sure that if no override is specified,
# we use our increased number of attempts instead of the default
Expand Down
10 changes: 8 additions & 2 deletions nodeadm/test/e2e/run.sh
Original file line number Diff line number Diff line change
Expand Up @@ -61,10 +61,16 @@ function runTest() {
local logfile
logfile=$(mktemp)

local start_time
start_time=$(date +%s)
if docker exec "$containerd_id" ./run.sh > "$logfile" 2>&1; then
echo "passed! ✅"
local elapsed
elapsed=$(($(date +%s) - start_time))
echo "passed! ✅ (${elapsed}s)"
else
echo "failed! ❌"
local elapsed
elapsed=$(($(date +%s) - start_time))
echo "failed! ❌ (${elapsed}s)"
cat "$logfile"
FAILED="true"
fi
Expand Down
Loading