Skip to content

Commit 18e02ec

Browse files
author
Christer Barreholm
committed
Refined test that calls wrapper
Still not perfect, since it's not calling the interactive cli and won't catch issues such as wrong uid
1 parent 130d086 commit 18e02ec

2 files changed

Lines changed: 15 additions & 9 deletions

File tree

bin/claude

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,7 @@ while [[ $# -gt 0 ]]; do
2323
--init-script FILE Execute initialization script
2424
--apk-packages LIST Install additional Alpine packages (comma or space separated)
2525
--podman-arg ARG Pass additional argument to podman
26+
--version Show the Claude Code version in the image
2627
--help Display this help message
2728
EOT
2829
exit 0
@@ -52,6 +53,15 @@ while [[ $# -gt 0 ]]; do
5253
PODMAN_ARGS="$PODMAN_ARGS $2"
5354
shift 2
5455
;;
56+
--version)
57+
podman run \
58+
--rm \
59+
--user claude \
60+
--userns=keep-id:uid=1001,gid=1001 \
61+
$PODMAN_ARGS \
62+
"$IMAGE" --version
63+
exit 0
64+
;;
5565
*)
5666
break
5767
;;

tests/test-image.sh

Lines changed: 5 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -50,18 +50,14 @@ test_claude_uid() {
5050
run_test "Claude user has UID 1000" \
5151
test_claude_uid
5252

53-
# 5. Claude responds through full wrapper invocation (catches silent hangs)
54-
test_wrapper_invocation() {
53+
# 5. Wrapper script starts claude and it responds
54+
test_wrapper() {
5555
local output
56-
output=$(timeout 30 podman run \
57-
--rm \
58-
--user claude \
59-
--userns=keep-id:uid=1000,gid=1000 \
60-
"$IMAGE" --version 2>&1)
56+
output=$(timeout 30 ./bin/claude --local --version 2>&1)
6157
echo "$output" | grep -qE '^[0-9]+\.[0-9]+\.[0-9]+'
6258
}
63-
run_test "Claude responds through full wrapper invocation" \
64-
test_wrapper_invocation
59+
run_test "Wrapper script starts claude" \
60+
test_wrapper
6561

6662
# Summary
6763
echo ""

0 commit comments

Comments
 (0)