test: copy the structure config into the tool container instead of bind mounting

Works with a remote DOCKER_HOST as well.

Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
This commit is contained in:
Tobias KaupatandClaude Sonnet 5.5 committed 2026-10-18 10:39:18 +02:00
1 parent e4016ef8fe
commit 421006e90b
1 file changed
+10 -3
+10 -3
View File
@@ -134,11 +134,18 @@ run_structure() {
# Not installed locally: fall back to the official image. It needs the
# docker socket because it inspects and runs the image under test.
echo "container-structure-test not installed, using the official image"
docker run --rm \
# The config file is copied in with `docker cp` instead of bind mounted,
# so this also works when DOCKER_HOST points at a remote daemon.
local tool_cid tool_rc
tool_cid="$(docker create \
-v //var/run/docker.sock:/var/run/docker.sock \
-v "$(host_path "${SCRIPT_DIR}")":/test \
"$STRUCTURE_TEST_IMAGE" \
test --image "$IMAGE" --config /test/structure.yml || rc=1
test --image "$IMAGE" --config /structure.yml)" || { rc=1; return; }
docker cp "$(host_path "${SCRIPT_DIR}")/structure.yml" "${tool_cid}:/structure.yml" \
&& docker start -a "$tool_cid"
tool_rc=$?
docker rm -f "$tool_cid" >/dev/null 2>&1 || true
[ "$tool_rc" -eq 0 ] || rc=1
fi
}