Skip to content

Commit 257bccc

Browse files
authored
fix: test.sh should use the variable $_group (#921)
1 parent dd5a7d4 commit 257bccc

File tree

2 files changed

+16
-14
lines changed

2 files changed

+16
-14
lines changed

install/_lib.sh

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ test "${DEBUG:-}" && set -x
55
log_file="sentry_install_log-`date +'%Y-%m-%d_%H-%M-%S'`.txt"
66
exec &> >(tee -a "$log_file")
77

8-
# Work from the onpremise root, no matter which script is called from where.
8+
# Work from /install/ for install.sh, project root otherwise
99
if [[ "$(basename $0)" = "install.sh" ]]; then
1010
cd "$(dirname $0)/install/"
1111
else

test.sh

Lines changed: 15 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,9 @@
11
#!/usr/bin/env bash
22
set -e
33

4-
echo "::group::Setting up variables and helpers ..."
4+
source "$(dirname $0)/install/_lib.sh"
5+
6+
echo "${_group}Setting up variables and helpers ..."
57
export SENTRY_TEST_HOST="${SENTRY_TEST_HOST:-http://localhost:9000}"
68
TEST_USER='[email protected]'
79
TEST_PASS='test123TEST'
@@ -32,17 +34,17 @@ cleanup () {
3234
echo "Done."
3335
}
3436
trap_with_arg cleanup ERR INT TERM EXIT
35-
echo "::endgroup::"
37+
echo "${_endgroup}"
3638

37-
echo "::group::Starting Sentry for tests ..."
39+
echo "${_group}Starting Sentry for tests ..."
3840
# Disable beacon for e2e tests
3941
echo 'SENTRY_BEACON=False' >> sentry/sentry.conf.py
40-
docker-compose run --rm web createuser --superuser --email $TEST_USER --password $TEST_PASS || true
41-
docker-compose up -d
42+
$dcr web createuser --superuser --email $TEST_USER --password $TEST_PASS || true
43+
$dc up -d
4244
printf "Waiting for Sentry to be up"; timeout 60 bash -c 'until $(curl -Isf -o /dev/null $SENTRY_TEST_HOST); do printf '.'; sleep 0.5; done'
43-
echo "::endgroup::"
45+
echo "${_endgroup}"
4446

45-
echo "::group::Running tests ..."
47+
echo "${_group}Running tests ..."
4648
get_csrf_token () { awk '$6 == "sc" { print $7 }' $COOKIE_FILE; }
4749
sentry_api_request () { curl -s -H 'Accept: application/json; charset=utf-8' -H "Referer: $SENTRY_TEST_HOST" -H 'Content-Type: application/json' -H "X-CSRFToken: $(get_csrf_token)" -b "$COOKIE_FILE" -c "$COOKIE_FILE" "$SENTRY_TEST_HOST/api/0/$1" ${@:2}; }
4850

@@ -75,9 +77,9 @@ do
7577
echo "$LOGIN_RESPONSE" | grep "$i[,}]" >& /dev/null
7678
echo "Pass."
7779
done
78-
echo "::endgroup::"
80+
echo "${_endgroup}"
7981

80-
echo "::group::Running moar tests !!!"
82+
echo "${_group}Running moar tests !!!"
8183
# Set up initial/required settings (InstallWizard request)
8284
sentry_api_request "internal/options/?query=is:required" -X PUT --data '{"mail.use-tls":false,"mail.username":"","mail.port":25,"system.admin-email":"[email protected]","mail.password":"","mail.from":"root@localhost","system.url-prefix":"'"$SENTRY_TEST_HOST"'","auth.allow-registration":false,"beacon.anonymous":true}' > /dev/null
8385

@@ -112,8 +114,8 @@ do
112114
echo "$EVENT_RESPONSE" | grep "$i[,}]" >& /dev/null
113115
echo "Pass."
114116
done
115-
echo "::endgroup::"
117+
echo "${_endgroup}"
116118

117-
echo "::group::Ensure cleanup crons are working ..."
118-
docker-compose ps | grep -q -- "-cleanup_.\+[[:space:]]\+Up[[:space:]]\+"
119-
echo "::endgroup::"
119+
echo "${_group}Ensure cleanup crons are working ..."
120+
$dc ps | grep -q -- "-cleanup_.\+[[:space:]]\+Up[[:space:]]\+"
121+
echo "${_endgroup}"

0 commit comments

Comments
 (0)