mirror of
https://github.com/getsentry/self-hosted.git
synced 2025-12-08 19:46:14 +00:00
Add a partial test for geoip (#902)
This commit is contained in:
parent
a868b09044
commit
88f90e046e
1
.github/workflows/test.yml
vendored
1
.github/workflows/test.yml
vendored
@ -44,6 +44,7 @@ jobs:
|
||||
run: |
|
||||
./create-docker-volumes-test.sh
|
||||
./relay-credentials-test.sh
|
||||
./geoip-test.sh
|
||||
|
||||
- name: Inspect failure
|
||||
if: failure()
|
||||
|
||||
@ -14,19 +14,17 @@ teardown() {
|
||||
}
|
||||
|
||||
setup() {
|
||||
# Clone the local repo into a temp dir, and propagate local changes.
|
||||
|
||||
# FWIW `git clone --local` breaks for me because it depends on hard-linking,
|
||||
# which doesn't work across devices, and I happen to have my workspace and
|
||||
# tmp on separate devices.
|
||||
# Clone the local repo into a temp dir. FWIW `git clone --local` breaks for
|
||||
# me because it depends on hard-linking, which doesn't work across devices,
|
||||
# and I happen to have my workspace and /tmp on separate devices.
|
||||
git clone --depth=1 "file://$(pwd)" "$_SANDBOX"
|
||||
|
||||
# Now propagate any local changes from the working copy to the sandbox. This
|
||||
# provides a pretty nice dev experience: edit the files in the working copy,
|
||||
# then run `DEBUG=1 some-test.sh` to leave the sandbox up for interactive
|
||||
# dev/debugging.
|
||||
git status --porcelain | while read line; do
|
||||
|
||||
# $line here is something like `M some-script.sh`. By propagating working
|
||||
# copy changes to the sandbox, we can provide a pretty nice dev experience:
|
||||
# edit the files in the working copy, then run `DEBUG=1 some-test.sh` to
|
||||
# leave the sandbox up for interactive dev/debugging.
|
||||
# $line here is something like `M some-script.sh`.
|
||||
|
||||
local filepath="$(cut -f2 -d' ' <(echo $line))"
|
||||
local filestatus="$(cut -f1 -d' ' <(echo $line))"
|
||||
|
||||
16
install/geoip-test.sh
Executable file
16
install/geoip-test.sh
Executable file
@ -0,0 +1,16 @@
|
||||
#!/usr/bin/env bash
|
||||
source "$(dirname $0)/_test_setup.sh"
|
||||
|
||||
mmdb="geoip/GeoLite2-City.mmdb"
|
||||
|
||||
# Starts with no mmdb, ends up with empty.
|
||||
test ! -f $mmdb
|
||||
./install/geoip.sh
|
||||
diff -rub $mmdb $mmdb.empty
|
||||
|
||||
# Doesn't clobber existing, though.
|
||||
echo GARBAGE > $mmdb
|
||||
./install/geoip.sh
|
||||
test "$(cat $mmdb)" = "GARBAGE"
|
||||
|
||||
report_success
|
||||
Loading…
x
Reference in New Issue
Block a user