fix: docker entrypoint handle correctly passing a single argument as a string

This commit is contained in:
adrian
2025-09-10 09:15:30 +02:00
committed by Adrian Benavides
parent 580a8822a5
commit b1db641c31
3 changed files with 34 additions and 15 deletions

View File

@@ -2,11 +2,22 @@
set -e
if [ "$#" -lt 1 ]; then
echo "Usage: $0 test1 [test2 ...]"
exit 1
echo "Usage: $0 protocol1[=filter] [protocol2 ...] or \"$0 'protocol1[=filter] protocol2'\""
exit 1
fi
for test in "$@"; do
echo "Running test: /app/substreams/$test"
tycho-protocol-sdk --package-path "/app/substreams/$test" --db-url "$DATABASE_URL"
if [ "$#" -eq 1 ] && [[ "$1" == *" "* ]]; then
IFS=' ' read -r -a args <<< "$1"
else
args=("$@")
fi
for test in "${args[@]}"; do
protocol="${test%%=*}"
filter="${test#*=}"
if [[ "$test" == *"="* ]]; then
tycho-protocol-sdk --package-path "/app/substreams/$protocol" --db-url "$DATABASE_URL" --match-test "$filter"
else
tycho-protocol-sdk --package-path "/app/substreams/$protocol" --db-url "$DATABASE_URL"
fi
done