Skip to content

Commit

Permalink
chore: skip install_tests when no internet connection
Browse files Browse the repository at this point in the history
  • Loading branch information
Chemaclass committed Nov 9, 2024
1 parent dedf8de commit 8e7b385
Show file tree
Hide file tree
Showing 2 changed files with 37 additions and 1 deletion.
6 changes: 6 additions & 0 deletions tests/acceptance/bashunit_upgrade_test.sh
Original file line number Diff line number Diff line change
@@ -1,4 +1,6 @@
#!/bin/bash
set -uo pipefail
set +e

TMP_DIR="tmp"
TMP_BIN="$TMP_DIR/bashunit"
Expand All @@ -9,6 +11,10 @@ function set_up_before_script() {
ACTIVE_INTERNET=$?
}

function tear_down_after_script() {
set -e
}

function set_up() {
./build.sh "$TMP_DIR" >/dev/null
LATEST_VERSION="$(helpers::get_latest_tag)"
Expand Down
32 changes: 31 additions & 1 deletion tests/acceptance/install_test.sh
Original file line number Diff line number Diff line change
@@ -1,10 +1,20 @@
#!/bin/bash
set -euo pipefail
# shellcheck disable=SC2317
set -uo pipefail
set +e

ACTIVE_INTERNET=0

function set_up_before_script() {
env::active_internet_connection
ACTIVE_INTERNET=$?
TEST_ENV_FILE="./tests/acceptance/fixtures/.env.default"
}

function tear_down_after_script() {
set -e
}

function set_up() {
rm -f ./lib/bashunit
rm -f ./deps/bashunit
Expand All @@ -16,6 +26,11 @@ function tear_down() {
}

function test_install_downloads_the_latest_version() {
if [[ "$ACTIVE_INTERNET" -eq 1 ]]; then
skip "no internet connection"
return
fi

local installed_bashunit="./lib/bashunit"
local output

Expand All @@ -31,6 +46,11 @@ function test_install_downloads_the_latest_version() {
}

function test_install_downloads_in_given_folder() {
if [[ "$ACTIVE_INTERNET" -eq 1 ]]; then
skip "no internet connection"
return
fi

local installed_bashunit="./deps/bashunit"
local output

Expand All @@ -46,6 +66,11 @@ function test_install_downloads_in_given_folder() {
}

function test_install_downloads_the_given_version() {
if [[ "$ACTIVE_INTERNET" -eq 1 ]]; then
skip "no internet connection"
return
fi

local installed_bashunit="./lib/bashunit"
local output

Expand All @@ -63,6 +88,11 @@ function test_install_downloads_the_given_version() {
}

function test_install_downloads_the_non_stable_beta_version() {
if [[ "$ACTIVE_INTERNET" -eq 1 ]]; then
skip "no internet connection"
return
fi

mock date echo "2023-11-13"
mock tput echo ""
local installed_bashunit="./deps/bashunit"
Expand Down

0 comments on commit 8e7b385

Please sign in to comment.