Skip to content

Commit

Permalink
fix error reporting
Browse files Browse the repository at this point in the history
  • Loading branch information
hubertdeng123 committed Mar 7, 2024
1 parent ffabc9f commit 2ced8fb
Show file tree
Hide file tree
Showing 3 changed files with 17 additions and 41 deletions.
5 changes: 2 additions & 3 deletions .github/workflows/test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -69,6 +69,7 @@ jobs:
env:
COMPOSE_PROJECT_NAME: self-hosted-${{ strategy.job-index }}
SENTRY_DSN: https://[email protected]/6627632
REPORT_SELF_HOSTED_ISSUES: 1
steps:
- name: Checkout
uses: actions/checkout@v4
Expand All @@ -86,9 +87,7 @@ jobs:
sudo chmod +x "${{ matrix.compose_path }}/docker-compose"
- name: Install self-hosted
run: |
export REPORT_SELF_HOSTED_ISSUES=1
./install.sh
run: ./install.sh

- name: Integration Test
run: ./integration-test.sh --${{ matrix.test_type }}
Expand Down
30 changes: 1 addition & 29 deletions _integration-test/run.sh
Original file line number Diff line number Diff line change
@@ -1,41 +1,13 @@
#!/usr/bin/env bash
set -ex

source install/_lib.sh
source install/dc-detect-version.sh

echo "${_group}Setting up variables and helpers ..."
export SENTRY_TEST_HOST="${SENTRY_TEST_HOST:-http:https://localhost:9000}"
TEST_USER='[email protected]'
TEST_PASS='test123TEST'
COOKIE_FILE=$(mktemp)

# Courtesy of https://stackoverflow.com/a/2183063/90297
trap_with_arg() {
func="$1"
shift
for sig; do
trap "$func $sig "'$LINENO' "$sig"
done
}

DID_TEAR_DOWN=0
# the teardown function will be the exit point
teardown() {
if [ "$DID_TEAR_DOWN" -eq 1 ]; then
return 0
fi
DID_TEAR_DOWN=1

if [ "$1" != "EXIT" ]; then
echo "An error occurred, caught SIG$1 on line $2"
fi

echo "Tearing down ..."
rm $COOKIE_FILE
echo "Done."
}
trap_with_arg teardown ERR INT TERM EXIT
trap_with_arg cleanup ERR INT TERM EXIT
echo "${_endgroup}"

echo "${_group}Starting Sentry for tests ..."
Expand Down
23 changes: 14 additions & 9 deletions integration-test.sh
Original file line number Diff line number Diff line change
@@ -1,21 +1,25 @@
#!/usr/bin/env bash
set -ex

source install/_lib.sh
source install/detect-platform.sh
source install/dc-detect-version.sh
source install/error-handling.sh

echo "Reset customizations"
rm -f sentry/enhance-image.sh
rm -f sentry/requirements.txt
export REPORT_SELF_HOSTED_ISSUES=0

test_option="$1"
export MINIMIZE_DOWNTIME=0

if [[ "$test_option" == "--initial-install" ]]; then
echo "Testing initial install"
_integration-test/run.sh
_integration-test/ensure-customizations-not-present.sh
_integration-test/ensure-backup-restore-works.sh
source _integration-test/run.sh
source _integration-test/ensure-customizations-not-present.sh
source _integration-test/ensure-backup-restore-works.sh
elif [[ "$test_option" == "--customizations" ]]; then
echo "Testing customizations"
source install/dc-detect-version.sh
$dc up -d
echo "Making customizations"
cat <<EOT >sentry/enhance-image.sh
Expand All @@ -28,8 +32,9 @@ EOT
printf "python-ldap" >sentry/requirements.txt

echo "Testing in-place upgrade and customizations"
./install.sh --minimize-downtime
_integration-test/run.sh
_integration-test/ensure-customizations-work.sh
_integration-test/ensure-backup-restore-works.sh
export MINIMIZE_DOWNTIME=1
./install.sh
source _integration-test/run.sh
source _integration-test/ensure-customizations-work.sh
source _integration-test/ensure-backup-restore-works.sh
fi

0 comments on commit 2ced8fb

Please sign in to comment.