Skip to content

Commit 08a2726

Browse files
committed
test(exec): add API tests for DetachKeys handling
Verify that POST /containers/{name}/exec correctly accepts an explicitly empty DetachKeys field and that GET /exec/{id}/json returns the stored value. Covers both the empty-string (disable detach) and non-empty cases. Signed-off-by: Devesh B <98201065+DeveshB-1@users.noreply.github.com>
1 parent 74fca34 commit 08a2726

1 file changed

Lines changed: 27 additions & 0 deletions

File tree

test/apiv2/20-containers.at

Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -913,4 +913,31 @@ t POST containers/create?platform=linux/amd64 \
913913
t POST containers/create?platform=linux/aarch64 \
914914
Image=$IMAGE \
915915
404
916+
917+
# 28405: exec create must honour DetachKeys:"" (explicitly disable detach).
918+
# Previously the JSON decoder could not distinguish an absent field from an
919+
# explicitly-empty one, so DetachKeys:"" was silently ignored.
920+
podman run -d --name exec-detach-keys-test $IMAGE top
921+
922+
# Explicitly empty DetachKeys disables detach - exec create must accept it.
923+
t POST containers/exec-detach-keys-test/exec \
924+
Cmd='["true"]' \
925+
DetachKeys='' \
926+
201 \
927+
.Id~[0-9a-f]\\{64\\}
928+
eid=$(jq -r '.Id' <<<"$output")
929+
t GET exec/$eid/json 200 .DetachKeys=''
930+
931+
# A non-empty DetachKeys must be stored and returned by inspect.
932+
t POST containers/exec-detach-keys-test/exec \
933+
Cmd='["true"]' \
934+
DetachKeys='ctrl-c' \
935+
201 \
936+
.Id~[0-9a-f]\\{64\\}
937+
eid=$(jq -r '.Id' <<<"$output")
938+
t GET exec/$eid/json 200 .DetachKeys='ctrl-c'
939+
940+
podman rm -f exec-detach-keys-test
941+
942+
916943
podman rmi -f $IMAGE

0 commit comments

Comments
 (0)