Skip to content

Commit

Permalink
test: skip slow test in run_all_tests.
Browse files Browse the repository at this point in the history
Instead of setting up the whole environment before skipping the test.
  • Loading branch information
Adirelle committed May 11, 2024
1 parent 4575a68 commit b4c19d9
Show file tree
Hide file tree
Showing 13 changed files with 25 additions and 37 deletions.
7 changes: 0 additions & 7 deletions e2e/assert.sh
Original file line number Diff line number Diff line change
Expand Up @@ -83,13 +83,6 @@ assert_matches() {
fi
}

skip_slow_test() {
if [[ -z ${TEST_ALL:-} ]]; then
title="skipped test" warn "slow tests are disabled"
exit 0
fi
}

require_cmd() {
if ! type -p "$1" >/dev/null; then
title="skipped test" warn "the required command '$1' was not found in the PATH ($PATH)"
Expand Down
13 changes: 0 additions & 13 deletions e2e/forge/test_cargo

This file was deleted.

8 changes: 8 additions & 0 deletions e2e/forge/test_cargo_binstall
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
# shellcheck shell=bash
require_cmd cargo

export MISE_CARGO_BINSTALL=1

assert "mise x cargo:eza@0.17.0 -- eza -v" "eza - A modern, maintained replacement for ls
v0.17.0 [+git]
https://github.com/eza-community/eza"
7 changes: 7 additions & 0 deletions e2e/forge/test_cargo_compile_slow
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
# shellcheck shell=bash
require_cmd cargo

export MISE_CARGO_BINSTALL=0
assert " mise x cargo:eza@0.17.0 -- eza -v" "eza - A modern, maintained replacement for ls
v0.17.0 [+git]
https://github.com/eza-community/eza"
Original file line number Diff line number Diff line change
@@ -1,5 +1,3 @@
# shellcheck shell=bash

skip_slow_test

assert_contains "mise x erlang@24.3.4.9 -- erl -eval 'erlang:display(erlang:system_info(otp_release)), halt().' -noshell" "24"
4 changes: 0 additions & 4 deletions e2e/plugins/core/test_java
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,3 @@ cat <<EOF >.java-version
EOF
assert_contains "mise x java -- java -version 2>&1" "openjdk version \"17.0.2\""
rm .java-version

skip_slow_test

mise i java@corretto-8
3 changes: 3 additions & 0 deletions e2e/plugins/core/test_java_correto_slow
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
# shellcheck shell=bash

mise i java@corretto-8
Original file line number Diff line number Diff line change
@@ -1,7 +1,5 @@
# shellcheck shell=bash

skip_slow_test

export POETRY_HOME=".poetry"

eval "$(mise activate bash)"
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,4 @@
# shellcheck shell=bash

skip_slow_test

export MISE_ALL_COMPILE=1
assert "mise x python@3.12.3 -- python --version" "Python 3.12.3"
Original file line number Diff line number Diff line change
@@ -1,7 +1,5 @@
# shellcheck shell=bash

skip_slow_test

export MISE_RUBY_DEFAULT_PACKAGES_FILE="$HOME/.default-gems"
export MISE_RUBY_INSTALL=1

Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,5 @@
# shellcheck shell=bash

skip_slow_test

export MISE_RUBY_DEFAULT_PACKAGES_FILE="$HOME/.default-gems"
export MISE_RUBY_VERBOSE_INSTALL=1

Expand Down
2 changes: 0 additions & 2 deletions e2e/plugins/test_neovim → e2e/plugins/test_neovim_slow
Original file line number Diff line number Diff line change
@@ -1,6 +1,4 @@
# shellcheck shell=bash

skip_slow_test

mise i neovim@ref:master
assert_contains "mise x neovim@ref:master -- nvim --version" "NVIM v0."
8 changes: 7 additions & 1 deletion e2e/run_all_tests
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ source "$SCRIPT_DIR/style.sh"

FILES="$(find "$SCRIPT_DIR" -name 'test_*' -type f -printf '%P\n' | sort)"
test_count=0
skipped_count=0
status=0

if [ -n "${GITHUB_STEP_SUMMARY:-}" ]; then
Expand All @@ -25,11 +26,16 @@ for f in $FILES; do
continue
fi
fi
if [[ ${TEST_ALL:-0} != 1 && $f = *_slow ]]; then
title="skipped test: $f" file="e2e/$f" warn "slow tests are disabled"
skipped_count=$((skipped_count + 1))
continue
fi
if ! "$ROOT/e2e/run_test" "$f"; then
status=1
fi
test_count=$((test_count + 1))
done

echo "E2E: ran $test_count tests" >&2
echo "E2E: ran $test_count tests, skipped $skipped_count tests" >&2
exit $status

0 comments on commit b4c19d9

Please sign in to comment.