Skip to content

Commit

Permalink
pasta udp tests: new bytecheck helper
Browse files Browse the repository at this point in the history
...for debugging #24147, because "md5sum mismatch" is not
the best way to troubleshoot bytestream differences.

Because socat is run on the container, we need to build
a new testimage (20241009).

Signed-off-by: Ed Santiago <[email protected]>
  • Loading branch information
edsantiago committed Oct 10, 2024
1 parent 22f552a commit 3b6a5c2
Show file tree
Hide file tree
Showing 9 changed files with 42 additions and 11 deletions.
1 change: 1 addition & 0 deletions test/NEW-IMAGES
Original file line number Diff line number Diff line change
Expand Up @@ -12,3 +12,4 @@
#
# Format is one FQIN per line. Enumerate them below:
#
quay.io/libpod/testimage:20241009
2 changes: 1 addition & 1 deletion test/apiv2/test-apiv2
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ ME=$(basename $0)
PODMAN_TEST_IMAGE_REGISTRY=${PODMAN_TEST_IMAGE_REGISTRY:-"quay.io"}
PODMAN_TEST_IMAGE_USER=${PODMAN_TEST_IMAGE_USER:-"libpod"}
PODMAN_TEST_IMAGE_NAME=${PODMAN_TEST_IMAGE_NAME:-"testimage"}
PODMAN_TEST_IMAGE_TAG=${PODMAN_TEST_IMAGE_TAG:-"20240123"}
PODMAN_TEST_IMAGE_TAG=${PODMAN_TEST_IMAGE_TAG:-"20241009"}
PODMAN_TEST_IMAGE_FQN="$PODMAN_TEST_IMAGE_REGISTRY/$PODMAN_TEST_IMAGE_USER/$PODMAN_TEST_IMAGE_NAME:$PODMAN_TEST_IMAGE_TAG"

IMAGE=$PODMAN_TEST_IMAGE_FQN
Expand Down
2 changes: 1 addition & 1 deletion test/e2e/config_amd64.go
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ var (
NGINX_IMAGE = "quay.io/libpod/alpine_nginx:latest" //nolint:revive,stylecheck
BB_GLIBC = "docker.io/library/busybox:glibc" //nolint:revive,stylecheck
REGISTRY_IMAGE = "quay.io/libpod/registry:2.8.2" //nolint:revive,stylecheck
CITEST_IMAGE = "quay.io/libpod/testimage:20240123" //nolint:revive,stylecheck
CITEST_IMAGE = "quay.io/libpod/testimage:20241009" //nolint:revive,stylecheck
SYSTEMD_IMAGE = "quay.io/libpod/systemd-image:20240124" //nolint:revive,stylecheck
CIRROS_IMAGE = "quay.io/libpod/cirros:latest" //nolint:revive,stylecheck
)
2 changes: 1 addition & 1 deletion test/e2e/config_arm64.go
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ var (
NGINX_IMAGE = "quay.io/lsm5/alpine_nginx-aarch64:latest" //nolint:revive,stylecheck
BB_GLIBC = "docker.io/library/busybox:glibc" //nolint:revive,stylecheck
REGISTRY_IMAGE = "quay.io/libpod/registry:2.8.2" //nolint:revive,stylecheck
CITEST_IMAGE = "quay.io/libpod/testimage:20240123" //nolint:revive,stylecheck
CITEST_IMAGE = "quay.io/libpod/testimage:20241009" //nolint:revive,stylecheck
SYSTEMD_IMAGE = "quay.io/libpod/systemd-image:20240124" //nolint:revive,stylecheck
CIRROS_IMAGE = "quay.io/libpod/cirros:latest" //nolint:revive,stylecheck
)
2 changes: 1 addition & 1 deletion test/e2e/config_ppc64le.go
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,6 @@ var (
CACHE_IMAGES = []string{ALPINE, BB, fedoraMinimal, NGINX_IMAGE, REDIS_IMAGE, INFRA_IMAGE, CITEST_IMAGE}
NGINX_IMAGE = "quay.io/libpod/alpine_nginx-ppc64le:latest"
BB_GLIBC = "docker.io/ppc64le/busybox:glibc"
CITEST_IMAGE = "quay.io/libpod/testimage:20240123"
CITEST_IMAGE = "quay.io/libpod/testimage:20241009"
REGISTRY_IMAGE string
)
4 changes: 2 additions & 2 deletions test/system/320-system-df.bats
Original file line number Diff line number Diff line change
Expand Up @@ -45,9 +45,9 @@ function setup_file() {
local results="$output"

# FIXME! This needs to be fiddled with every time we bump testimage.
local size=11
local size=12
if [[ "$(uname -m)" = "aarch64" ]]; then
size=13
size=14
fi

# FIXME: we can't check exact RawSize or Size because every CI system
Expand Down
9 changes: 7 additions & 2 deletions test/system/505-networking-pasta.bats
Original file line number Diff line number Diff line change
Expand Up @@ -174,10 +174,14 @@ function pasta_test_do() {
fi

# socat options for second <address> in server ("STDOUT" or "EXEC"),
local recvhelper=
if [ "${bytes}" = "1" ]; then
recv="STDOUT"
else
recv="EXEC:md5sum"
# To ease debugging in case of problems, use a helper that
# gives us byte count, hash, and first/last few bytes
recvhelper=/home/podman/bytecheck
recv="EXEC:$recvhelper"
fi

# and port forwarding configuration for Podman and pasta.
Expand All @@ -202,7 +206,8 @@ function pasta_test_do() {
# Fill in file for data transfer tests, and expected output strings
if [ "${bytes}" != "1" ]; then
dd if=/dev/urandom bs=${bytes} count=1 of="${XFER_FILE}"
local expect="$(cat "${XFER_FILE}" | md5sum)"
run_podman run -i --rm $IMAGE $recvhelper < ${XFER_FILE}
local expect="$output"
else
printf "x" > "${XFER_FILE}"
local expect="$(for i in $(seq ${seq}); do printf "x"; done)"
Expand Down
29 changes: 27 additions & 2 deletions test/system/build-testimage
Original file line number Diff line number Diff line change
Expand Up @@ -79,6 +79,31 @@ fi
EOF
chmod 755 healthcheck

# Another helper; used in pasta tests for comparing bytestream data
cat >bytecheck <<'EOF'
#!/bin/sh
#
# Helper script for comparing bytestream data. Shows data size,
# md5sum, and first/last eight bytes. Because plain md5sum is
# not very helpful in identifying where things went wrong.
#
# Reads stream from stdin, writes summary to stdout
#
tmpfile=`mktemp bytecheck.XXXXXXX`
cat >$tmpfile
size=`stat -c %s $tmpfile`
hash=`md5sum <$tmpfile`
odl=`head -c8 $tmpfile | od -An -tx1`
odr=`tail -c8 $tmpfile | od -An -tx1`
rm -f $tmpfile
echo size=$size hash=$hash head=$odl tail=$odr
EOF
chmod 755 bytecheck

# alpine because it's small and light and reliable
# - check for updates @ https://hub.docker.com/_/alpine
# busybox-extras provides httpd needed in 500-networking.bats
Expand All @@ -94,9 +119,9 @@ chmod 755 healthcheck
#
cat >Containerfile1 <<EOF
ARG REPO=please-override-repo
FROM docker.io/\${REPO}/alpine:3.19.0
FROM docker.io/\${REPO}/alpine:3.20.3
RUN apk add busybox-extras iproute2 socat
ADD testimage-id healthcheck pause /home/podman/
ADD testimage-id healthcheck pause bytecheck /home/podman/
RUN rm -f /var/cache/apk/*
EOF

Expand Down
2 changes: 1 addition & 1 deletion test/system/helpers.bash
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ PODMAN_RUNTIME=
PODMAN_TEST_IMAGE_REGISTRY=${PODMAN_TEST_IMAGE_REGISTRY:-"quay.io"}
PODMAN_TEST_IMAGE_USER=${PODMAN_TEST_IMAGE_USER:-"libpod"}
PODMAN_TEST_IMAGE_NAME=${PODMAN_TEST_IMAGE_NAME:-"testimage"}
PODMAN_TEST_IMAGE_TAG=${PODMAN_TEST_IMAGE_TAG:-"20240123"}
PODMAN_TEST_IMAGE_TAG=${PODMAN_TEST_IMAGE_TAG:-"20241009"}
PODMAN_TEST_IMAGE_FQN="$PODMAN_TEST_IMAGE_REGISTRY/$PODMAN_TEST_IMAGE_USER/$PODMAN_TEST_IMAGE_NAME:$PODMAN_TEST_IMAGE_TAG"

# Larger image containing systemd tools.
Expand Down

0 comments on commit 3b6a5c2

Please sign in to comment.