mirror of
https://github.com/containers/podman.git
synced 2025-06-25 03:52:15 +08:00
@ -6,7 +6,7 @@ podman pull $IMAGE &>/dev/null
|
|||||||
tmpfs_name="/mytmpfs"
|
tmpfs_name="/mytmpfs"
|
||||||
t POST containers/create?name=hostconfig_test \
|
t POST containers/create?name=hostconfig_test \
|
||||||
Image=$IMAGE \
|
Image=$IMAGE \
|
||||||
Cmd='["df"]' \
|
Cmd='["df","-P","'$tmpfs_name'"]' \
|
||||||
HostConfig='{"Binds":["/tmp/doesnotexist:/test1"]' \
|
HostConfig='{"Binds":["/tmp/doesnotexist:/test1"]' \
|
||||||
TmpFs="{\"$tmpfs_name\":\"rw\"}}" \
|
TmpFs="{\"$tmpfs_name\":\"rw\"}}" \
|
||||||
201 \
|
201 \
|
||||||
@ -22,5 +22,10 @@ t POST containers/${cid}/start 204
|
|||||||
t POST containers/${cid}/wait 200
|
t POST containers/${cid}/wait 200
|
||||||
t GET containers/${cid}/logs?stdout=true 200
|
t GET containers/${cid}/logs?stdout=true 200
|
||||||
|
|
||||||
like "$(<$WORKDIR/curl.result.out)" ".* ${tmpfs_name}" \
|
# /logs returns application/octet-stream, which our test helper saves in
|
||||||
|
# an outfile rather than returning in $output. That's why we can't test
|
||||||
|
# this directly in the /logs test above; instead, we rely on knowing the
|
||||||
|
# path to the stored results. The 'tr' is needed because there may be
|
||||||
|
# null bytes in the outfile.
|
||||||
|
like "$(tr -d \\0 <$WORKDIR/curl.result.out)" ".* ${tmpfs_name}" \
|
||||||
"'df' output includes tmpfs name"
|
"'df' output includes tmpfs name"
|
||||||
|
@ -370,6 +370,7 @@ load helpers
|
|||||||
is "${lines[0]}" "${randomcontent[0]}" "eval symlink - created container"
|
is "${lines[0]}" "${randomcontent[0]}" "eval symlink - created container"
|
||||||
is "${lines[1]}" "${randomcontent[1]}" "eval symlink - created container"
|
is "${lines[1]}" "${randomcontent[1]}" "eval symlink - created container"
|
||||||
run_podman rm -f cpcontainer
|
run_podman rm -f cpcontainer
|
||||||
|
run_podman rmi $cpimage
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -241,11 +241,21 @@ EOF
|
|||||||
build_arg_implicit+="=$arg_implicit_value"
|
build_arg_implicit+="=$arg_implicit_value"
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
# FIXME FIXME FIXME: 2021-03-15: workaround for #9567 (slow ubuntu 2004):
|
||||||
|
# we're seeing lots of timeouts in CI. Until/unless #9567 gets fixed,
|
||||||
|
# let's get CI passing by extending the timeout when remote on ubuntu
|
||||||
|
local localtimeout=${PODMAN_TIMEOUT}
|
||||||
|
if is_remote; then
|
||||||
|
if grep -qi ubuntu /etc/os-release; then
|
||||||
|
localtimeout=$(( 2 * $localtimeout ))
|
||||||
|
fi
|
||||||
|
fi
|
||||||
|
|
||||||
# cd to the dir, so we test relative paths (important for podman-remote)
|
# cd to the dir, so we test relative paths (important for podman-remote)
|
||||||
cd $PODMAN_TMPDIR
|
cd $PODMAN_TMPDIR
|
||||||
export arg_explicit="THIS SHOULD BE OVERRIDDEN BY COMMAND LINE!"
|
export arg_explicit="THIS SHOULD BE OVERRIDDEN BY COMMAND LINE!"
|
||||||
export arg_implicit=${arg_implicit_value}
|
export arg_implicit=${arg_implicit_value}
|
||||||
run_podman ${MOUNTS_CONF} build \
|
PODMAN_TIMEOUT=$localtimeout run_podman ${MOUNTS_CONF} build \
|
||||||
--build-arg arg_explicit=${arg_explicit_value} \
|
--build-arg arg_explicit=${arg_explicit_value} \
|
||||||
$build_arg_implicit \
|
$build_arg_implicit \
|
||||||
--dns-search $nosuchdomain \
|
--dns-search $nosuchdomain \
|
||||||
@ -594,34 +604,46 @@ EOF
|
|||||||
run_podman rmi -a --force
|
run_podman rmi -a --force
|
||||||
}
|
}
|
||||||
|
|
||||||
|
# Caveat lector: this test was mostly copy-pasted from buildah in #9275.
|
||||||
|
# It's not entirely clear what it's testing, or if the 'mount' section is
|
||||||
|
# necessary.
|
||||||
@test "build with copy-from referencing the base image" {
|
@test "build with copy-from referencing the base image" {
|
||||||
skip_if_rootless "cannot mount as rootless"
|
target=derived
|
||||||
target=busybox-derived
|
target_mt=derived-mt
|
||||||
target_mt=busybox-mt-derived
|
|
||||||
tmpdir=$PODMAN_TMPDIR/build-test
|
tmpdir=$PODMAN_TMPDIR/build-test
|
||||||
mkdir -p $tmpdir
|
mkdir -p $tmpdir
|
||||||
|
|
||||||
containerfile1=$tmpdir/Containerfile1
|
containerfile1=$tmpdir/Containerfile1
|
||||||
cat >$containerfile1 <<EOF
|
cat >$containerfile1 <<EOF
|
||||||
FROM quay.io/libpod/busybox AS build
|
FROM $IMAGE AS build
|
||||||
RUN rm -f /bin/paste
|
RUN rm -f /etc/issue
|
||||||
USER 1001
|
USER 1001
|
||||||
COPY --from=quay.io/libpod/busybox /bin/paste /test/
|
COPY --from=$IMAGE /etc/issue /test/
|
||||||
EOF
|
EOF
|
||||||
|
|
||||||
containerfile2=$tmpdir/Containerfile2
|
containerfile2=$tmpdir/Containerfile2
|
||||||
cat >$containerfile2 <<EOF
|
cat >$containerfile2 <<EOF
|
||||||
FROM quay.io/libpod/busybox AS test
|
FROM $IMAGE AS test
|
||||||
RUN rm -f /bin/nl
|
RUN rm -f /etc/alpine-release
|
||||||
FROM quay.io/libpod/alpine AS final
|
FROM quay.io/libpod/alpine AS final
|
||||||
COPY --from=quay.io/libpod/busybox /bin/nl /test/
|
COPY --from=$IMAGE /etc/alpine-release /test/
|
||||||
EOF
|
EOF
|
||||||
run_podman build -t ${target} -f ${containerfile1} ${tmpdir}
|
|
||||||
run_podman build --jobs 4 -t ${target} -f ${containerfile1} ${tmpdir}
|
|
||||||
|
|
||||||
run_podman build -t ${target} -f ${containerfile2} ${tmpdir}
|
# Before the build, $IMAGE's base image should not be present
|
||||||
|
local base_image=quay.io/libpod/alpine:latest
|
||||||
|
run_podman 1 image exists $base_image
|
||||||
|
|
||||||
|
run_podman build --jobs 1 -t ${target} -f ${containerfile2} ${tmpdir}
|
||||||
run_podman build --no-cache --jobs 4 -t ${target_mt} -f ${containerfile2} ${tmpdir}
|
run_podman build --no-cache --jobs 4 -t ${target_mt} -f ${containerfile2} ${tmpdir}
|
||||||
|
|
||||||
|
# After the build, the base image should exist
|
||||||
|
run_podman image exists $base_image
|
||||||
|
|
||||||
# (can only test locally; podman-remote has no image mount command)
|
# (can only test locally; podman-remote has no image mount command)
|
||||||
if ! is_remote; then
|
# (can also only test as root; mounting under rootless podman is too hard)
|
||||||
|
# We perform the test as a conditional, not a 'skip', because there's
|
||||||
|
# value in testing the above 'build' commands even remote & rootless.
|
||||||
|
if ! is_remote && ! is_rootless; then
|
||||||
run_podman image mount ${target}
|
run_podman image mount ${target}
|
||||||
root_single_job=$output
|
root_single_job=$output
|
||||||
|
|
||||||
@ -629,8 +651,21 @@ EOF
|
|||||||
root_multi_job=$output
|
root_multi_job=$output
|
||||||
|
|
||||||
# Check that both the version with --jobs 1 and --jobs=N have the same number of files
|
# Check that both the version with --jobs 1 and --jobs=N have the same number of files
|
||||||
test $(find $root_single_job -type f | wc -l) = $(find $root_multi_job -type f | wc -l)
|
nfiles_single=$(find $root_single_job -type f | wc -l)
|
||||||
|
nfiles_multi=$(find $root_multi_job -type f | wc -l)
|
||||||
|
run_podman image umount ${target_mt}
|
||||||
|
run_podman image umount ${target}
|
||||||
|
|
||||||
|
is "$nfiles_single" "$nfiles_multi" \
|
||||||
|
"Number of files (--jobs=1) == (--jobs=4)"
|
||||||
|
|
||||||
|
# Make sure the number is reasonable
|
||||||
|
test "$nfiles_single" -gt 50
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
# Clean up
|
||||||
|
run_podman rmi ${target_mt} ${target} ${base_image}
|
||||||
|
run_podman image prune -f
|
||||||
}
|
}
|
||||||
|
|
||||||
@test "podman build --logfile test" {
|
@test "podman build --logfile test" {
|
||||||
|
@ -31,6 +31,9 @@ verify_iid_and_name() {
|
|||||||
invalid=$PODMAN_TMPDIR/invalid
|
invalid=$PODMAN_TMPDIR/invalid
|
||||||
echo "I am an invalid file and should cause a podman-load error" > $invalid
|
echo "I am an invalid file and should cause a podman-load error" > $invalid
|
||||||
run_podman 125 load -i $invalid
|
run_podman 125 load -i $invalid
|
||||||
|
# podman and podman-remote emit different messages; this is a common string
|
||||||
|
is "$output" ".*error pulling image: unable to pull .*" \
|
||||||
|
"load -i INVALID fails with expected diagnostic"
|
||||||
}
|
}
|
||||||
|
|
||||||
@test "podman save to pipe and load" {
|
@test "podman save to pipe and load" {
|
||||||
|
@ -5,6 +5,20 @@
|
|||||||
|
|
||||||
load helpers
|
load helpers
|
||||||
|
|
||||||
|
# This is a long ugly way to clean up pods and remove the pause image
|
||||||
|
function teardown() {
|
||||||
|
run_podman pod rm -f -a
|
||||||
|
run_podman rm -f -a
|
||||||
|
run_podman image list --format '{{.ID}} {{.Repository}}'
|
||||||
|
while read id name; do
|
||||||
|
if [[ "$name" =~ /pause ]]; then
|
||||||
|
run_podman rmi $id
|
||||||
|
fi
|
||||||
|
done <<<"$output"
|
||||||
|
|
||||||
|
basic_teardown
|
||||||
|
}
|
||||||
|
|
||||||
testYaml="
|
testYaml="
|
||||||
apiVersion: v1
|
apiVersion: v1
|
||||||
kind: Pod
|
kind: Pod
|
||||||
@ -24,7 +38,7 @@ spec:
|
|||||||
value: xterm
|
value: xterm
|
||||||
- name: container
|
- name: container
|
||||||
value: podman
|
value: podman
|
||||||
image: quay.io/libpod/alpine:latest
|
image: $IMAGE
|
||||||
name: test
|
name: test
|
||||||
resources: {}
|
resources: {}
|
||||||
securityContext:
|
securityContext:
|
||||||
|
Reference in New Issue
Block a user