3
0
mirror of https://github.com/larvit/adf-codec.git synced 2026-11-19 06:35:44 +01:00

5d: the review's image swap, teardown trap and fixture-name assertions

This commit is contained in:
2026-09-04 10:57:35 +02:00
parent ac7d7de2ec
commit 3d76f254d0
6 changed files with 60 additions and 42 deletions
+6 -5
View File
@@ -1,20 +1,21 @@
bun_image=oven/bun:1.4.0-alpine
deno_image=denoland/deno:2.9.6
firefox_image=instrumentisto/geckodriver:149.0.2
firefox_image=selenium/standalone-firefox:153.0.4
floor_image=node:18.20.8-alpine3.21
node_image=node:24.19.0-alpine3.24
in_image() {
local image=$1 entrypoint=$2
shift 2
docker run --rm -u "$(id -u):$(id -g)" -e HOME=/tmp ${network:+--network "$network"} -v "$PWD:/app" -w /app --entrypoint "$entrypoint" "$image" "$@"
docker run --rm -u "$(id -u):$(id -g)" -e HOME=/tmp ${in_image_network:+--network "$in_image_network"} -v "$PWD:/app" -w /app --entrypoint "$entrypoint" "$image" "$@"
}
with_firefox() {
local container network status=0
local container in_image_network status=0
container=$(docker run -d --rm "$firefox_image")
network="container:$container"
# The id is baked in: the trap fires after this function's locals are gone.
trap "docker rm -f $container >/dev/null 2>&1" EXIT INT TERM
in_image_network="container:$container"
"$@" || status=$?
docker rm -f "$container" >/dev/null
return $status
}