-
-
Notifications
You must be signed in to change notification settings - Fork 5
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
fix: Make disabled tests run again (#163)
- Enable disabled tests ⚓ - Split windows tests and disable some (todo, because they hang?) ⚓ - Remove obsolete code in test ⚓
- Loading branch information
Showing
13 changed files
with
196 additions
and
79 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,36 @@ | ||
#!/usr/bin/env bash | ||
# Test: | ||
# Run install.sh script. | ||
# shellcheck disable=SC2015 | ||
|
||
set -u | ||
|
||
TEST_DIR=$(cd "$(dirname "$0")/.." && pwd) | ||
# shellcheck disable=SC1091 | ||
|
||
. "$TEST_DIR/general.sh" | ||
|
||
init_step | ||
|
||
if [ -n "${GH_COVERAGE_DIR:-}" ]; then | ||
echo "Test cannot run for coverage." | ||
exit 249 | ||
fi | ||
|
||
# Install with current script the version 2.10.0 on the `main` branch. | ||
"$GH_SCRIPTS/install.sh" --version 2.10.0 || { | ||
echo "Could not download install.sh from 'main' and install." | ||
exit 1 | ||
} | ||
|
||
# Enable this once pre-release is out on main. | ||
# # Update to version 3 and greater, which should fail due to guard. | ||
# OUT=$("$GH_INSTALL_BIN_DIR/cli" update --use-pre-release --yes) | ||
# # shellcheck disable=SC2181 | ||
# if [ $? -eq 0 ] || ! echo "$OUT" | grep -iE "Too much changed. Please uninstall this version"; then | ||
# echo "Install should fail because update from v2 to v3 is guarded." | ||
# exit 1 | ||
# fi | ||
|
||
# Uninstall right away again. | ||
"$GH_INSTALL_BIN_DIR"/cli uninstaller || exit 1 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,68 @@ | ||
#!/usr/bin/env bash | ||
# Test: | ||
# Test package-manager enabled build with run-wrappers not using githooks.runner | ||
|
||
TEST_DIR=$(cd "$(dirname "$0")/.." && pwd) | ||
# shellcheck disable=SC1091 | ||
. "$TEST_DIR/general.sh" | ||
|
||
if [ -n "$GH_ON_WINDOWS" ]; then | ||
echo "On windows somehow this test gets stuck (?)." | ||
exit 249 | ||
fi | ||
|
||
init_step | ||
|
||
# Use the 3.1.0 prod build with package-manager enabled and download mocked. | ||
git -C "$GH_TEST_REPO" reset --hard v3.1.0 >/dev/null 2>&1 || exit 1 | ||
|
||
# run the default install | ||
"$GH_TEST_BIN/githooks-cli" installer \ | ||
"${EXTRA_INSTALL_ARGS[@]}" \ | ||
--clone-url "file://$GH_TEST_REPO" \ | ||
--clone-branch "test-package-manager" || exit 1 | ||
|
||
# Test run-wrappers with pure binaries in the path. | ||
# Put binaries into the path to find them. | ||
export PATH="$GH_TEST_BIN:$PATH" | ||
if [ -z "$GH_COVERAGE_DIR" ]; then | ||
# Coverage build will not run this because its wrapped... | ||
githooks-cli --version || { | ||
echo "! Binaries not in path." | ||
exit 1 | ||
} | ||
fi | ||
|
||
# Overwrite runner, it should not be needed. | ||
git config --global --unset githooks.runner | ||
|
||
# We need this CLI at the right place for further tests. | ||
[ ! -f ~/.githooks/bin/githooks-cli ] || { | ||
echo "! githooks-cli should not exist in default location" | ||
exit 1 | ||
} | ||
# Install it into the default location for the test functions... | ||
mkdir ~/.githooks/bin && | ||
cp "$(which githooks-cli)" ~/.githooks/bin/ || exit 1 | ||
|
||
# Test the the runner works. | ||
mkdir -p "$GH_TEST_TMP/test147" && | ||
cd "$GH_TEST_TMP/test147" && | ||
mkdir -p .githooks/pre-commit && | ||
echo "echo 'Hook-1' >> '$GH_TEST_TMP/test'" >.githooks/pre-commit/test1 && | ||
git init && | ||
install_hooks_if_not_centralized || exit 1 | ||
|
||
if ! is_centralized_tests; then | ||
check_local_install | ||
else | ||
check_centralized_install | ||
fi | ||
|
||
git hooks trust | ||
git commit --allow-empty -m "Test hook" || exit 1 | ||
|
||
if [ ! -f "$GH_TEST_TMP/test" ]; then | ||
echo "! Hook did not run." | ||
exit 1 | ||
fi |
Oops, something went wrong.