mirror of
https://github.com/containers/podman.git
synced 2025-08-06 11:32:07 +08:00

Podman 1.4.1 had problems with builds with a RUN command that tried to to a privliged command. This adds a gating test for that situation. Signed-off-by: TomSweeneyRedHat <tsweeney@redhat.com>
36 lines
884 B
Bash
36 lines
884 B
Bash
#!/usr/bin/env bats -*- bats -*-
|
|
#
|
|
# Tests for podman build
|
|
#
|
|
|
|
load helpers
|
|
|
|
@test "podman build - basic test" {
|
|
if [[ "$PODMAN" =~ -remote ]]; then
|
|
if [ "$(id -u)" -ne 0 ]; then
|
|
skip "unreliable with podman-remote and rootless; #2972"
|
|
fi
|
|
fi
|
|
|
|
rand_filename=$(random_string 20)
|
|
rand_content=$(random_string 50)
|
|
|
|
tmpdir=$PODMAN_TMPDIR/build-test
|
|
run mkdir -p $tmpdir || die "Could not mkdir $tmpdir"
|
|
dockerfile=$tmpdir/Dockerfile
|
|
cat >$dockerfile <<EOF
|
|
FROM $IMAGE
|
|
RUN apk add nginx
|
|
RUN echo $rand_content > /$rand_filename
|
|
EOF
|
|
|
|
run_podman build -t build_test --format=docker $tmpdir
|
|
is "$output" ".*STEP 4: COMMIT" "COMMIT seen in log"
|
|
|
|
run_podman run --rm build_test cat /$rand_filename
|
|
is "$output" "$rand_content" "reading generated file in image"
|
|
|
|
run_podman rmi build_test
|
|
}
|
|
# vim: filetype=sh
|