на оценку 4
Skeleton contracts / contracts (pull_request) Canceled after 0s

This commit is contained in:
2026-11-22 23:33:11 +03:00
parent 20afc2c790
commit cc41f601e3
207 changed files with 22098 additions and 120 deletions
+41
View File
@@ -0,0 +1,41 @@
#!/bin/sh
set -eu
: "${TARGET_INSTANCE_ID:?test provides target API instance alias}"
project_root=$(CDPATH='' cd -- "$(dirname -- "$0")/.." && pwd)
cd "$project_root"
env_file=${ENV_FILE:-.env}
matched_container=
compose() {
if [ -f "$env_file" ]; then
docker compose --env-file "$env_file" "$@"
else
docker compose "$@"
fi
}
for container_id in $(compose ps -a -q api); do
instance_id=$(docker exec "$container_id" cat /tmp/instance-id 2>/dev/null || true)
if [ "$instance_id" = "$TARGET_INSTANCE_ID" ]; then
if [ -n "$matched_container" ]; then
printf '%s\n' "multiple API containers match instance $TARGET_INSTANCE_ID" >&2
exit 1
fi
matched_container=$container_id
fi
done
if [ -z "$matched_container" ]; then
printf '%s\n' "API instance not found: $TARGET_INSTANCE_ID" >&2
exit 1
fi
# A manual docker stop suppresses the container restart policy until the next
# explicit start, so the selected replica remains down for the whole test.
docker stop --time 5 "$matched_container" >/dev/null
printf '%s\n' "stopped API instance $TARGET_INSTANCE_ID"