Skip to content

Commit

Permalink
make tests pass
Browse files Browse the repository at this point in the history
Signed-off-by: Ed Santiago <[email protected]>
  • Loading branch information
edsantiago committed Jun 11, 2024
1 parent ccc3940 commit 78d2d8d
Show file tree
Hide file tree
Showing 8 changed files with 20 additions and 52 deletions.
2 changes: 1 addition & 1 deletion .cirrus.yml
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ env:
DEBIAN_NAME: "debian-13"

# Image identifiers
IMAGE_SUFFIX: "c20240611t100000z-f40f39d13"
IMAGE_SUFFIX: "c20240611t193000z-f40f39d13"
FEDORA_CACHE_IMAGE_NAME: "fedora-${IMAGE_SUFFIX}"
PRIOR_FEDORA_CACHE_IMAGE_NAME: "prior-fedora-${IMAGE_SUFFIX}"
DEBIAN_CACHE_IMAGE_NAME: "debian-${IMAGE_SUFFIX}"
Expand Down
10 changes: 6 additions & 4 deletions tests/bud.bats
Original file line number Diff line number Diff line change
Expand Up @@ -4577,9 +4577,11 @@ EOM
}

@test "bud copy chown with newuser" {
_prefetch quay.io/fedora/fedora
_prefetch $SAFEIMAGE
# Regression test for https://github.com/containers/buildah/issues/2192
run_buildah build $WITH_POLICY_JSON -t testctr -f $BUDFILES/copy-chown/Containerfile.chown_user $BUDFILES/copy-chown
run_buildah build $WITH_POLICY_JSON -t testctr \
--build-arg SAFEIMAGE=$SAFEIMAGE \
-f $BUDFILES/copy-chown/Containerfile.chown_user $BUDFILES/copy-chown
expect_output --substring "myuser:myuser"
}

Expand Down Expand Up @@ -6325,10 +6327,10 @@ _EOF
expect_output --substring "world"
}

@test "bud-verify-if-we-dont-clean-prexisting-path" {
@test "bud-verify-if-we-dont-clean-preexisting-path" {
skip_if_no_runtime
skip_if_in_container
_prefetch alpine debian
_prefetch alpine ubuntu
run_buildah 1 build -t testbud $WITH_POLICY_JSON --secret id=secret-foo,src=$BUDFILES/verify-cleanup/secret1.txt -f $BUDFILES/verify-cleanup/Dockerfile $BUDFILES/verify-cleanup/
expect_output --substring "hello"
expect_output --substring "secrettext"
Expand Down
5 changes: 3 additions & 2 deletions tests/bud/copy-chown/Containerfile.chown_user
Original file line number Diff line number Diff line change
@@ -1,7 +1,8 @@
FROM quay.io/fedora/fedora
ARG SAFEIMAGE
FROM $SAFEIMAGE

ENV MYUSER=myuser
RUN useradd --create-home --home /"${MYUSER}" "${MYUSER}"
RUN adduser -D -h /"${MYUSER}" "${MYUSER}"
COPY --chown="${MYUSER}" ./copychown.txt /somewhere

RUN stat -c "%U:%G" /somewhere
2 changes: 1 addition & 1 deletion tests/bud/verify-cleanup/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ FROM alpine as builder
RUN mkdir subdir
COPY hey .

FROM debian
FROM ubuntu
RUN --mount=type=bind,source=.,dst=/tmp,z \
--mount=type=tmpfs,dst=/var/tmp \
cat /tmp/hey
Expand Down
29 changes: 0 additions & 29 deletions tests/digest.bats
Original file line number Diff line number Diff line change
Expand Up @@ -29,35 +29,6 @@ fromreftest() {
rm -fr ${pushdir}
}

@test "from-by-digest-s1" {
skip_if_rootless_environment
fromreftest quay.io/libpod/testdigest_v2s1@sha256:816563225d7baae4782653efc9410579341754fe32cbe20f7600b39fc37d8ec7
}

@test "from-by-digest-s1-a-discarded-layer" {
skip_if_rootless_environment
IMG=quay.io/libpod/testdigest_v2s1_with_dups@sha256:2c619fffbed29d8677e246798333e7d1b288333cb61c020575f6372c76fdbb52

fromreftest ${IMG}

# Verify that image meets our expectations (duplicate layers)
# Surprisingly, we do this after fromreftest, not before, because fromreftest
# has to pull the image for us.
#
# Check that the first and second .fsLayers and .history elements are dups
local manifest=$(imgtype -expected-manifest-type '*' -show-manifest ${IMG})
for element in fsLayers history; do
local first=$(jq ".${element}[0]" <<<"$manifest")
local second=$(jq ".${element}[1]" <<<"$manifest")
expect_output --from="$second" "$first" "${IMG}: .${element}[1] == [0]"
done
}

@test "from-by-tag-s1" {
skip_if_rootless_environment
fromreftest quay.io/libpod/testdigest_v2s1:20200210
}

@test "from-by-digest-s2" {
skip_if_rootless_environment
fromreftest quay.io/libpod/testdigest_v2s2@sha256:755f4d90b3716e2bf57060d249e2cd61c9ac089b1233465c5c2cb2d7ee550fdb
Expand Down
2 changes: 1 addition & 1 deletion tests/helpers.bash
Original file line number Diff line number Diff line change
Expand Up @@ -676,7 +676,7 @@ function stop_git_daemon() {
function start_registry() {
local testuser="${1:-testuser}"
local testpassword="${2:-testpassword}"
local REGISTRY_IMAGE=quay.io/libpod/registry:2.8
local REGISTRY_IMAGE=quay.io/libpod/registry:2.8.2
local config='
version: 0.1
log:
Expand Down
11 changes: 1 addition & 10 deletions tests/registries.conf
Original file line number Diff line number Diff line change
Expand Up @@ -15,14 +15,5 @@ insecure=true

[[registry]]
prefix="docker.io/library"
location="127.0.0.1:60333"
location="127.0.0.1:60333/libpod"
insecure=true

# 2021-03-23 these are used in buildah system tests, but not (yet?)
# listed in the global shortnames.conf.
[aliases]
busybox="docker.io/library/busybox"
ubuntu="docker.io/library/ubuntu"
php="docker.io/library/php"
alpine="docker.io/library/alpine"
debian="docker.io/library/debian"
11 changes: 7 additions & 4 deletions tests/run.bats
Original file line number Diff line number Diff line change
Expand Up @@ -657,11 +657,14 @@ function configure_and_check_user() {
skip_if_in_container

${OCI} --version
_prefetch debian
# We use ubuntu image because it has no /etc/hosts file. This
# allows the fake_host test below to be an equality check,
# not a substring check.
_prefetch ubuntu

local hostname=h-$(random_string)

run_buildah from --quiet --pull=false $WITH_POLICY_JSON debian
run_buildah from --quiet --pull=false $WITH_POLICY_JSON ubuntu
cid=$output
run_buildah 125 run --network=bogus $cid cat /etc/hosts
expect_output --substring "unable to find network with name or ID bogus: network not found"
Expand Down Expand Up @@ -699,7 +702,7 @@ function configure_and_check_user() {
expect_output --substring ""
run_buildah rm -a

run_buildah from --quiet --pull=false $WITH_POLICY_JSON debian
run_buildah from --quiet --pull=false $WITH_POLICY_JSON ubuntu
cid=$output
run_buildah run --network=host --hostname $hostname $cid cat /etc/hosts
assert "$output" =~ "$ip[[:blank:]]$hostname"
Expand All @@ -715,7 +718,7 @@ function configure_and_check_user() {
assert "$output" =~ "$ip[[:blank:]]$hostname"
run_buildah rm -a

run_buildah from --quiet --pull=false $WITH_POLICY_JSON debian
run_buildah from --quiet --pull=false $WITH_POLICY_JSON ubuntu
cid=$output
run_buildah run --network=none $cid sh -c 'echo "110.110.110.0 fake_host" >> /etc/hosts; cat /etc/hosts'
expect_output "110.110.110.0 fake_host"
Expand Down

0 comments on commit 78d2d8d

Please sign in to comment.