Skip to content

Commit

Permalink
Fix a few rpmdb tests relying on test-image system rpmdb
Browse files Browse the repository at this point in the history
Relying on the system db causes all sorts of headaches and
irregularities that we're better off not having.
  • Loading branch information
pmatilai committed Jan 17, 2025
1 parent 6e2ff3e commit 34e8d9c
Showing 1 changed file with 8 additions and 6 deletions.
14 changes: 8 additions & 6 deletions tests/rpmdb.at
Original file line number Diff line number Diff line change
Expand Up @@ -58,16 +58,14 @@ RPMTEST_CLEANUP

AT_SETUP([rpm -qa 3])
AT_KEYWORDS([rpmdb query])
RPMTEST_SETUP
RPMDB_INIT

RPMTEST_CHECK([
runroot rpm -U --nodeps --ignorearch --ignoreos --nosignature \
/data/RPMS/foo-1.0-1.noarch.rpm \
/data/RPMS/hello-2.0-1.x86_64-signed.rpm

# Assert that there are at least 3 packages in the rpmdb (we are using that of
# the test image here so that is pretty much guaranteed).
runroot rpm -qa | wc -l | xargs test 2 -lt || exit 1
runroot rpm -qa | wc -l | xargs test 2 -eq || exit 1

runroot rpm -qa foo hello | sort
],
Expand All @@ -83,7 +81,10 @@ AT_KEYWORDS([rpmdb])

# This needs to run *without* RPMDB_INIT to test behavior on read-only mount
RPMTEST_CHECK([
rpmdb --exportdb > rdonly.list
# XXX FIXME: should not use system rpmdb for anything, but there's a
# mystery failure here if pointed to /data/misc which should be equally
# read-only at this point.
rpmdb --exportdb --dbpath /usr/lib/sysimage/rpm > rdonly.list
test -s rdonly.list
],
[0],
Expand All @@ -100,7 +101,8 @@ runroot rpm -U /data/RPMS/hlinktest-1.0-1.noarch.rpm

RPMTEST_CHECK([
# Need to pass the dbpath explicitly since we're not going through run/runroot
runroot_other /sbin/runuser -u nobody -- rpmdb --dbpath /var/lib/rpm --exportdb > hdr.list
dbpath=$(rpm --eval "%_dbpath")
runroot_other /sbin/runuser -u nobody -- rpmdb --dbpath ${dbpath} --exportdb > hdr.list
],
[0],
[],
Expand Down

0 comments on commit 34e8d9c

Please sign in to comment.