@@ -31,12 +31,16 @@ t GET libpod/containers/json?all=true 200 \
31
31
.[0].ExitCode=0 \
32
32
.[0].IsInfra=false
33
33
34
- # Test compat API for Network Settings
34
+ # Test compat API for Network Settings (.Network is N/A when rootless)
35
+ network_expect=
36
+ if root; then
37
+ network_expect=' .[0].NetworkSettings.Networks.podman.NetworkID=podman'
38
+ fi
35
39
t GET /containers/json? all=true 200 \
36
40
length=1 \
37
41
.[0].Id~[0-9a-f]\\ {64\\ } \
38
42
.[0].Image=$IMAGE \
39
- .[0].NetworkSettings.Networks.podman.NetworkID=podman
43
+ $network_expect
40
44
41
45
# Make sure `limit` works.
42
46
t GET libpod/containers/json? limit=1 200 \
@@ -68,9 +72,9 @@ t POST libpod/containers/create?name=test_noargs Image=${IMAGE} 201 \
68
72
.Id~[0-9a-f]\\ {64\\ }
69
73
cid=$( jq -r ' .Id' <<< " $output" )
70
74
# Prior to the fix in #6835, this would fail 500 "args must not be empty"
71
- t POST libpod/containers/${cid} /start ' ' 204
75
+ t POST libpod/containers/${cid} /start 204
72
76
# Container should exit almost immediately. Wait for it, confirm successful run
73
- t POST " libpod/containers/${cid} /wait?condition=stopped&condition=exited" ' ' 200 ' 0'
77
+ t POST " libpod/containers/${cid} /wait?condition=stopped&condition=exited" 200 ' 0'
74
78
t GET libpod/containers/${cid} /json 200 \
75
79
.Id=$cid \
76
80
.State.Status~\\\( exited\\\| stopped\\\) \
@@ -85,15 +89,15 @@ t GET libpod/containers/json?all=true 200 \
85
89
cid=$( jq -r ' .[0].Id' <<< " $output" )
86
90
87
91
# No such container
88
- t POST " libpod/commit?container=nonesuch" ' ' 404
92
+ t POST " libpod/commit?container=nonesuch" 404
89
93
90
94
# Comment can only be used with docker format, not OCI
91
95
cparam=" repo=newrepo&comment=foo&author=bob"
92
- t POST " libpod/commit?container=$CNAME &$cparam " ' ' 500 \
96
+ t POST " libpod/commit?container=$CNAME &$cparam " 500 \
93
97
.cause=" messages are only compatible with the docker image format (-f docker)"
94
98
95
99
# Commit a new image from the container
96
- t POST " libpod/commit?container=$CNAME " ' ' 200 \
100
+ t POST " libpod/commit?container=$CNAME " 200 \
97
101
.Id~[0-9a-f]\\ {64\\ }
98
102
iid=$( jq -r ' .Id' <<< " $output" )
99
103
t GET libpod/images/$iid /json 200 \
@@ -103,23 +107,23 @@ t GET libpod/images/$iid/json 200 \
103
107
104
108
# Commit a new image w/o tag
105
109
cparam=" repo=newrepo&comment=foo&author=bob&format=docker"
106
- t POST " libpod/commit?container=$CNAME &$cparam " ' ' 200
110
+ t POST " libpod/commit?container=$CNAME &$cparam " 200
107
111
t GET libpod/images/newrepo:latest/json 200 \
108
112
.RepoTags[0]=localhost/newrepo:latest \
109
113
.Author=bob \
110
114
.Comment=foo
111
115
112
116
# Commit a new image w/ specified tag and author
113
117
cparam=" repo=newrepo&tag=v1&author=alice"
114
- t POST " libpod/commit?container=$cid &$cparam &pause=false" ' ' 200
118
+ t POST " libpod/commit?container=$cid &$cparam &pause=false" 200
115
119
t GET libpod/images/newrepo:v1/json 200 \
116
120
.RepoTags[0]=localhost/newrepo:v1 \
117
121
.Author=alice
118
122
119
123
# Commit a new image w/ full parameters
120
124
cparam=" repo=newrepo&tag=v2&comment=bar&author=eric"
121
125
cparam=" $cparam &format=docker&changes=CMD=/bin/foo"
122
- t POST " libpod/commit?container=${cid: 0: 12} &$cparam &pause=true" ' ' 200
126
+ t POST " libpod/commit?container=${cid: 0: 12} &$cparam &pause=true" 200
123
127
t GET libpod/images/newrepo:v2/json 200 \
124
128
.RepoTags[0]=localhost/newrepo:v2 \
125
129
.Author=eric \
@@ -143,7 +147,7 @@ cpid_file=$(jq -r '.ConmonPidFile' <<<"$output")
143
147
userdata_path=$( dirname $cpid_file )
144
148
145
149
# Initializing the container
146
- t POST libpod/containers/myctr/init ' ' 204
150
+ t POST libpod/containers/myctr/init 204
147
151
148
152
# Check configuration after initializing
149
153
t GET libpod/containers/myctr/json 200 \
@@ -167,7 +171,11 @@ t DELETE libpod/containers/bogus 404
167
171
168
172
# test apiv2 create container with correct entrypoint and cmd
169
173
# --data '{"Image":"quay.io/libpod/alpine_labels:latest","Entrypoint":["echo"],"Cmd":["param1","param2"]}'
170
- t POST containers/create ' "Image":"' $IMAGE ' ","Entrypoint":["echo"],"Cmd":["param1","param2"]' 201 \
174
+ t POST containers/create \
175
+ Image=$IMAGE \
176
+ Entrypoint=' ["echo"]' \
177
+ Cmd=' ["param1","param2"]' \
178
+ 201 \
171
179
.Id~[0-9a-f]\\ {64\\ }
172
180
cid=$( jq -r ' .Id' <<< " $output" )
173
181
t GET containers/$cid /json 200 \
@@ -180,7 +188,10 @@ t GET containers/$cid/json 200 \
180
188
t DELETE containers/$cid 204
181
189
182
190
# test only set the entrypoint, Cmd should be []
183
- t POST containers/create ' "Image":"' $IMAGE ' ","Entrypoint":["echo","param1"]' 201 \
191
+ t POST containers/create \
192
+ Image=$IMAGE \
193
+ Entrypoint=' ["echo","param1"]' \
194
+ 201 \
184
195
.Id~[0-9a-f]\\ {64\\ }
185
196
cid=$( jq -r ' .Id' <<< " $output" )
186
197
t GET containers/$cid /json 200 \
@@ -191,14 +202,14 @@ t GET containers/$cid/json 200 \
191
202
.Args[0]=" param1"
192
203
193
204
# create a running container for after
194
- t POST containers/create ' " Image":" ' $IMAGE ' "," Entrypoint": ["top"]' 201 \
205
+ t POST containers/create Image= $IMAGE Entrypoint= ' ["top"]' 201 \
195
206
.Id~[0-9a-f]\\ {64\\ }
196
207
cid_top=$( jq -r ' .Id' <<< " $output" )
197
208
t GET containers/${cid_top} /json 200 \
198
209
.Config.Entrypoint[0]=" top" \
199
210
.Config.Cmd=' []' \
200
211
.Path=" top"
201
- t POST containers/${cid_top} /start ' ' 204
212
+ t POST containers/${cid_top} /start 204
202
213
# make sure the container is running
203
214
t GET containers/${cid_top} /json 200 \
204
215
.State.Status=" running"
@@ -220,13 +231,17 @@ t GET containers/json?filters='{"id":["'${cid}'","'${cid_top}'"],"status":["runn
220
231
length=1 \
221
232
.[0].Id=${cid_top}
222
233
223
- t POST containers/${cid_top} /stop " " 204
234
+ t POST containers/${cid_top} /stop 204
224
235
225
236
t DELETE containers/$cid 204
226
237
t DELETE containers/$cid_top 204
227
238
228
239
# test the WORKDIR and StopSignal
229
- t POST containers/create ' "Image":"' $ENV_WORKDIR_IMG ' ","WorkingDir":"/dataDir","StopSignal":"9"' 201 \
240
+ t POST containers/create \
241
+ Image=$ENV_WORKDIR_IMG \
242
+ WorkingDir=/dataDir \
243
+ StopSignal=9 \
244
+ 201 \
230
245
.Id~[0-9a-f]\\ {64\\ }
231
246
cid=$( jq -r ' .Id' <<< " $output" )
232
247
t GET containers/$cid /json 200 \
@@ -247,7 +262,7 @@ t DELETE images/${MultiTagName}?force=true 200
247
262
# vim: filetype=sh
248
263
249
264
# Test Volumes field adds an anonymous volume
250
- t POST containers/create ' " Image":" ' $IMAGE ' "," Volumes": {"/test":{}}' 201 \
265
+ t POST containers/create Image= $IMAGE Volumes= ' {"/test":{}}' 201 \
251
266
.Id~[0-9a-f]\\ {64\\ }
252
267
cid=$( jq -r ' .Id' <<< " $output" )
253
268
t GET containers/$cid /json 200 \
@@ -266,7 +281,7 @@ t GET containers/json 200 \
266
281
podman stop bar
267
282
268
283
# Test CPU limit (NanoCPUs)
269
- t POST containers/create ' " Image":" ' $IMAGE ' "," HostConfig": {"NanoCpus":500000}' 201 \
284
+ t POST containers/create Image= $IMAGE HostConfig= ' {"NanoCpus":500000}' 201 \
270
285
.Id~[0-9a-f]\\ {64\\ }
271
286
cid=$( jq -r ' .Id' <<< " $output" )
272
287
t GET containers/$cid /json 200 \
0 commit comments