Use rpmdb-normalize, add rootfs tests
I just saw the sqlite-shm corruption in https://gitlab.com/redhat/centos-stream/containers/bootc/-/merge_requests/437#note_2372766792 so let's just go ahead and turn on rpmdb_normalize which also aids the reproducibility of the rpmdb. While we're here let's also add a long overdue "unit test" for the rootfs. This operates as a container build that mounts the container-under-test as part of a multi-stage build. Signed-off-by: Colin Walters <walters@verbum.org>
This commit is contained in:
parent
d8e5834ce9
commit
e89565789c
6 changed files with 38 additions and 7 deletions
6
tests/rootfs/Dockerfile
Normal file
6
tests/rootfs/Dockerfile
Normal file
|
|
@ -0,0 +1,6 @@
|
|||
# This should always be replaced with podman build --from.
|
||||
FROM localhost/image-to-test as rootfs
|
||||
|
||||
FROM quay.io/centos/centos:stream10
|
||||
COPY . /src
|
||||
RUN --mount=type=bind,from=rootfs,target=/target-rootfs /src/run /target-rootfs
|
||||
4
tests/rootfs/README.md
Normal file
4
tests/rootfs/README.md
Normal file
|
|
@ -0,0 +1,4 @@
|
|||
# rootfs tests
|
||||
|
||||
This is a set of scripts that sanity check the target
|
||||
rootfs in a read-only fashion.
|
||||
7
tests/rootfs/cases/rpmdb
Executable file
7
tests/rootfs/cases/rpmdb
Executable file
|
|
@ -0,0 +1,7 @@
|
|||
#!/bin/bash
|
||||
set -xeuo pipefail
|
||||
for d in usr/share/rpm usr/lib/sysimage/rpm; do
|
||||
if test -d "$d"; then
|
||||
test '!' -f "$d/rpmdb.sqlite-shm"
|
||||
fi
|
||||
done
|
||||
13
tests/rootfs/run
Executable file
13
tests/rootfs/run
Executable file
|
|
@ -0,0 +1,13 @@
|
|||
#!/bin/bash
|
||||
set -euo pipefail
|
||||
srcdir=$(cd $(dirname $0) && pwd)
|
||||
rootfs=$1
|
||||
shift
|
||||
cd $rootfs
|
||||
for case in ${srcdir}/cases/*; do
|
||||
if test -x "$case"; then
|
||||
echo "Running $case"
|
||||
$case
|
||||
echo "ok $case"
|
||||
fi
|
||||
done
|
||||
Loading…
Add table
Add a link
Reference in a new issue