Skip to content

Instantly share code, notes, and snippets.

@willkg
Created January 17, 2024 21:13
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save willkg/75804596616cdd74c0cc3625fe85b9c7 to your computer and use it in GitHub Desktop.
Save willkg/75804596616cdd74c0cc3625fe85b9c7 to your computer and use it in GitHub Desktop.
#!/bin/bash
# This is built to test a problem where if a try symbol is uploaded, it doesn't
# invalidate the cache and then future download attempts suggest the symbol
# doesn't exist (404).
# using a upload try token:
#
# head (404), upload (should invalidate cache), head (should be 200)
#
# usage: 1758566_symtest.sh <TOKEN>
set -exo pipefail
# NOTE: make sure this has try upload permission
AUTH_TOKEN=$1
TECKENHOST=http://web:8000
ELIOTHOST=http://eliot:8000
FN=systemtests/symtest/symbols_20220311_205328.zip
# Wipe state
echo ""
echo ">>> reset storage"
python bin/s3_cli.py delete "${UPLOAD_DEFAULT_URL}"
python bin/s3_cli.py create "${UPLOAD_DEFAULT_URL}"
python bin/redis_cli.py clear
# Check stores
echo ""
echo ">>> storage state"
python bin/s3_cli.py list_objects "${UPLOAD_DEFAULT_URL}"
python bin/redis_cli.py list_keys
# See if the item exists
echo ">>> should be a 404"
curl --head "${TECKENHOST}/try/XUL/32B8F67BF1D339FE8E404CC9F72D56BD0/XUL.sym"
echo ">>> should be unsymbolicated (found_modules=false)"
curl --compressed "${ELIOTHOST}/symbolicate/v5" -d '{"jobs":[{"memoryMap":[["XUL","32B8F67BF1D339FE8E404CC9F72D56BD0"]],"stacks":[[[0, 384823]]]}]}'
echo ""
sleep 5s
# echo ">>> storage state"
python bin/s3_cli.py list_objects "${UPLOAD_DEFAULT_URL}"
python bin/redis_cli.py list_keys
# Upload the file
echo ""
echo ">>> upload the file"
python systemtests/bin/upload-symbols.py --expect-code=201 --auth-token="${AUTH_TOKEN}" --base-url="${TECKENHOST}" "${FN}"
sleep 5s
echo ""
echo ">>> storage state"
python bin/s3_cli.py list_objects "${UPLOAD_DEFAULT_URL}"
python bin/redis_cli.py list_keys
# See if the item exists
echo ""
echo ">>> test cache"
echo ">>> should be a 200"
curl --head "${TECKENHOST}/try/XUL/32B8F67BF1D339FE8E404CC9F72D56BD0/XUL.sym"
echo ">>> should be symbolicated (found_modules=true)"
curl --compressed "${ELIOTHOST}/symbolicate/v5" -d '{"jobs":[{"memoryMap":[["XUL","32B8F67BF1D339FE8E404CC9F72D56BD0"]],"stacks":[[[0, 384823]]]}]}'
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment