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
18 changes: 13 additions & 5 deletions tests/acceptance/bashunit_upgrade_test.sh
Original file line number Diff line number Diff line change
Expand Up @@ -69,11 +69,19 @@ function test_upgrade_when_a_new_version_found() {
fi

local output
output="$($TMP_BIN upgrade 2>/dev/null)"

if [[ -z "$output" ]]; then
bashunit::skip "upgrade produced no output (transient network failure)" && return
fi
output="$($TMP_BIN upgrade 2>&1)"

# Real-network test: skip on the non-regression outcomes (no output, tag/download
# failure, or a no-op when latest already equals the built version) so a flaky
# network doesn't fail CI; a genuine upgrade regression still hits the asserts.
case "$output" in
'' | \
*"Failed to resolve latest"* | \
*"Failed to download"* | \
*"You are already on latest version"*)
bashunit::skip "upgrade could not run (transient network/env)" && return
;;
esac

assert_contains "> Upgrading bashunit to latest version" "$output"
assert_contains "> bashunit upgraded successfully to latest version $LATEST_VERSION" "$output"
Expand Down
10 changes: 10 additions & 0 deletions tests/acceptance/install_test.sh
Original file line number Diff line number Diff line change
Expand Up @@ -145,6 +145,11 @@ function test_install_verifies_checksum_when_enabled() {
if [ ! -f "./tmp_install/bashunit" ]; then
bashunit::skip "transient download failure" && return
fi
case "$output" in
*"Skipping checksum verification"*)
bashunit::skip "checksum asset unreachable (transient network/env)" && return
;;
esac
assert_contains "Checksum verified" "$output"
assert_file_exists "./tmp_install/bashunit"
assert_same "$(printf "\e[1m\e[32mbashunit\e[0m - 0.37.0")" \
Expand All @@ -168,6 +173,11 @@ function test_install_verifies_checksum_by_default() {
if [ ! -f "./tmp_install/bashunit" ]; then
bashunit::skip "transient download failure" && return
fi
case "$output" in
*"Skipping checksum verification"*)
bashunit::skip "checksum asset unreachable (transient network/env)" && return
;;
esac
assert_contains "Checksum verified" "$output"
assert_file_exists "./tmp_install/bashunit"
}
Expand Down
Loading