Skip to content

Commit 0af4ce4

Browse files
test: Fix auto update tests for podman-remote
Signed-off-by: Stefan Nienhuis <stefan@nienhuisdevelopment.com>
1 parent 00fd05e commit 0af4ce4

File tree

1 file changed

+44
-7
lines changed

1 file changed

+44
-7
lines changed

test/system/255-auto-update.bats

Lines changed: 44 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -92,7 +92,14 @@ function generate_service() {
9292

9393
run_podman create $extraArgs --name $cname $label $target_img $command
9494

95-
(cd $UNIT_DIR; run_podman generate systemd --new --files --name $requires $cname)
95+
# podman-remote will give warning saying the generated units should be placed on the remote system
96+
if ! is_remote; then
97+
(cd $UNIT_DIR; run_podman generate systemd --new --files --name $requires $cname)
98+
else
99+
100+
(cd $UNIT_DIR; run_podman 0+w generate systemd --new --files --name $requires $cname)
101+
fi
102+
96103
echo "container-$cname" >> $SNAME_FILE
97104
run_podman rm -t 0 -f $cname
98105

@@ -164,7 +171,13 @@ function _confirm_update() {
164171
archive=$PODMAN_TMPDIR/archive.tar
165172
run_podman save -o $archive $IMAGE
166173
run_podman 125 create --label io.containers.autoupdate=registry docker-archive:$archive
167-
is "$output" ".*Error: auto updates require the docker image transport but image is of transport \"docker-archive\""
174+
175+
# Remote gives different error message
176+
if ! is_remote; then
177+
is "$output" ".*Error: auto updates require the docker image transport but image is of transport \"docker-archive\""
178+
else
179+
is "$output" ".*Error: unsupported transport docker-archive in \"docker-archive:$archive\": only docker transport is supported"
180+
fi
168181

169182
run_podman rmi $shortname
170183
}
@@ -199,7 +212,12 @@ function _confirm_update() {
199212

200213
since=$(date --iso-8601=seconds)
201214
run_podman auto-update --rollback=false --format "{{.Unit}},{{.Image}},{{.Updated}},{{.Policy}}"
202-
is "$output" "Trying to pull.*" "Image is updated."
215+
216+
# Trying to pull is not logged for podman-remote
217+
if ! is_remote; then
218+
is "$output" "Trying to pull.*" "Image is updated."
219+
fi
220+
203221
is "$output" ".*container-$ctr_parent.service,quay.io/libpod/alpine:latest,true,registry.*" "Image is updated."
204222
run_podman events --filter type=system --since $since --stream=false
205223
is "$output" ".* system auto-update"
@@ -238,7 +256,12 @@ function _confirm_update() {
238256
containerID="$output"
239257

240258
run_podman auto-update --format "{{.Unit}},{{.Image}},{{.Updated}},{{.Policy}}"
241-
is "$output" "Trying to pull.*" "Image is updated."
259+
260+
# Trying to pull is not logged for podman-remote
261+
if ! is_remote; then
262+
is "$output" "Trying to pull.*" "Image is updated."
263+
fi
264+
242265
is "$output" ".*container-$cname.service,$image:latest,rolled back,registry.*" "Image has been rolled back."
243266

244267
run_podman container inspect --format "{{.Image}}" $cname
@@ -385,8 +408,11 @@ EOF
385408
update_log=$output
386409
assert "$update_log" =~ '.*Error: auto-updating container "[0-9a-f]{64}": invalid auto-update policy.*' "invalid policy setup"
387410

388-
local n_updated=$(grep -c 'Trying to pull' <<<"$update_log")
389-
is "$n_updated" "2" "Number of images updated from registry."
411+
# Trying to pull is not logged for podman-remote
412+
if ! is_remote; then
413+
local n_updated=$(grep -c 'Trying to pull' <<<"$update_log")
414+
is "$n_updated" "2" "Number of images updated from registry."
415+
fi
390416

391417
for cname in "${!expect_update[@]}"; do
392418
is "$update_log" ".*$cname.*" "container with auto-update policy image updated"
@@ -472,6 +498,8 @@ EOF
472498
}
473499

474500
@test "podman-kube@.service template with rollback" {
501+
skip_if_remote "tests depend on podman kube play --service-container which does not work with podman-remote"
502+
475503
# sdnotify fails with runc 1.0.0-3-dev2 on Ubuntu. Let's just
476504
# assume that we work only with crun, nothing else.
477505
# [copied from 260-sdnotify.bats]
@@ -586,7 +614,16 @@ EOF
586614

587615
# cd into the unit dir to generate the two files.
588616
pushd "$UNIT_DIR"
589-
run_podman generate systemd --name --new --files $podname
617+
618+
# podman-remote will give warning saying the generated units should be placed on the remote system
619+
if ! is_remote; then
620+
run_podman generate systemd --name --new --files $podname
621+
else
622+
623+
run_podman 0+w generate systemd --name --new --files $podname
624+
fi
625+
626+
590627
is "$output" ".*$podunit.*"
591628
is "$output" ".*$ctrunit.*"
592629
popd

0 commit comments

Comments
 (0)