tests: Merge installed/ and fedora-str/ directories
Let's be opinionated now, and our installed/ test story *is* Ansible/STR. Merge `tests/fedora-str` into `tests/installed/`. Rework the nondestructive tests into a separate playbook run, and parallelize them for more efficiency. The destructive tests are also changed to use Ansible more. Add a higher level `run.sh` entrypoint and update the `README.md` with some useful tips. Closes: #1513 Approved by: jlebon
This commit is contained in:
1 parent
cb3360fca6
commit
5215f24e68
26 files changed
+217
-86
No files matched your search
+23
@@ -0,0 +1,23 @@
|
||||
#!/bin/bash
|
||||
|
||||
# Run test-basic.sh as root.
|
||||
# https://github.com/ostreedev/ostree/pull/1199
|
||||
|
||||
set -xeuo pipefail
|
||||
|
||||
dn=$(dirname $0)
|
||||
. ${dn}/../libinsttest.sh
|
||||
|
||||
date
|
||||
# These tests sort of bypass the installed-tests spec;
|
||||
# fixing that would require installing g-d-t-r, though
|
||||
# more ideally we architect things with a "control" container
|
||||
# distinct from the host.
|
||||
export G_TEST_SRCDIR=$(realpath $dn/../../..)
|
||||
|
||||
# Use /var/tmp to hopefully use XFS + O_TMPFILE etc.
|
||||
prepare_tmpdir /var/tmp
|
||||
trap _tmpdir_cleanup EXIT
|
||||
/usr/libexec/installed-tests/libostree/test-basic.sh
|
||||
/usr/libexec/installed-tests/libostree/test-basic-c
|
||||
date
|
||||
+41
@@ -0,0 +1,41 @@
|
||||
#!/bin/bash
|
||||
|
||||
# Tests of the "raw ostree" functionality using the host's ostree repo as uid 0.
|
||||
|
||||
set -xeuo pipefail
|
||||
|
||||
dn=$(dirname $0)
|
||||
. ${dn}/../libinsttest.sh
|
||||
|
||||
echo "1..1"
|
||||
date
|
||||
|
||||
prepare_tmpdir
|
||||
ostree --repo=repo init --mode=bare-user
|
||||
mkdir -p components/{dbus,systemd}/usr/{bin,lib}
|
||||
echo dbus binary > components/dbus/usr/bin/dbus-daemon
|
||||
chmod a+x components/dbus/usr/bin/dbus-daemon
|
||||
echo dbus lib > components/dbus/usr/lib/libdbus.so.1
|
||||
echo dbus helper > components/dbus/usr/lib/dbus-daemon-helper
|
||||
chmod a+x components/dbus/usr/lib/dbus-daemon-helper
|
||||
echo systemd binary > components/systemd/usr/bin/systemd
|
||||
chmod a+x components/systemd/usr/bin/systemd
|
||||
echo systemd lib > components/systemd/usr/lib/libsystemd.so.1
|
||||
|
||||
# Make the gid on dbus 81 like fedora, also ensure no xattrs
|
||||
ostree --repo=repo commit --no-xattrs -b component-dbus --owner-uid 0 --owner-gid 81 --tree=dir=components/dbus
|
||||
ostree --repo=repo commit --no-xattrs -b component-systemd --owner-uid 0 --owner-gid 0 --tree=dir=components/systemd
|
||||
rm rootfs -rf
|
||||
for component in dbus systemd; do
|
||||
ostree --repo=repo checkout -U -H component-${component} --union rootfs
|
||||
done
|
||||
echo 'some rootfs data' > rootfs/usr/lib/cache.txt
|
||||
# Commit using the host's selinux policy
|
||||
ostree --repo=repo commit --selinux-policy / -b rootfs --link-checkout-speedup --tree=dir=rootfs
|
||||
ostree --repo=repo ls rootfs /usr/bin/systemd >ls.txt
|
||||
assert_file_has_content ls.txt '^-007.. 0 0 .*/usr/bin/systemd'
|
||||
ostree --repo=repo ls -X rootfs /usr/lib/dbus-daemon-helper >ls.txt
|
||||
assert_file_has_content ls.txt '^-007.. 0 81 .*security.selinux.*/usr/lib/dbus-daemon-helper'
|
||||
assert_not_file_has_content ls.txt 'user.ostreemeta'
|
||||
echo "ok bare-user link-checkout-speedup with modified xattrs maintains uids"
|
||||
date
|
||||
@@ -0,0 +1,25 @@
|
||||
#!/bin/bash
|
||||
|
||||
# Test that initializing a bare-user repo on tmpfs fails
|
||||
# Maybe at some point this will be fixed in the kernel
|
||||
# but I doubt it'll be soon
|
||||
# https://www.spinics.net/lists/linux-mm/msg109775.html
|
||||
|
||||
set -xeuo pipefail
|
||||
|
||||
dn=$(dirname $0)
|
||||
. ${dn}/../libinsttest.sh
|
||||
|
||||
prepare_tmpdir
|
||||
trap _tmpdir_cleanup EXIT
|
||||
date
|
||||
|
||||
mkdir mnt
|
||||
mount -t tmpfs tmpfs mnt
|
||||
if ostree --repo=mnt/repo init --mode=bare-user 2>err.txt; then
|
||||
umount mnt
|
||||
assert_not_reached "bare-user on tmpfs worked?"
|
||||
fi
|
||||
umount mnt
|
||||
assert_file_has_content err.txt "Operation not supported"
|
||||
date
|
||||
+90
@@ -0,0 +1,90 @@
|
||||
#!/bin/bash
|
||||
#
|
||||
# Copyright (C) 2018 Red Hat, Inc.
|
||||
#
|
||||
# SPDX-License-Identifier: LGPL-2.0+
|
||||
#
|
||||
# This library is free software; you can redistribute it and/or
|
||||
# modify it under the terms of the GNU Lesser General Public
|
||||
# License as published by the Free Software Foundation; either
|
||||
# version 2 of the License, or (at your option) any later version.
|
||||
#
|
||||
# This library is distributed in the hope that it will be useful,
|
||||
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
# Lesser General Public License for more details.
|
||||
#
|
||||
# You should have received a copy of the GNU Lesser General Public
|
||||
# License along with this library; if not, write to the
|
||||
# Free Software Foundation, Inc., 59 Temple Place - Suite 330,
|
||||
# Boston, MA 02111-1307, USA.
|
||||
|
||||
set -xeuo pipefail
|
||||
|
||||
dn=$(dirname $0)
|
||||
. ${dn}/../libinsttest.sh
|
||||
|
||||
echo "1..1"
|
||||
date
|
||||
|
||||
# Use /var/tmp so we have O_TMPFILE etc.
|
||||
prepare_tmpdir /var/tmp
|
||||
trap _tmpdir_cleanup EXIT
|
||||
ostree --repo=repo init --mode=archive
|
||||
echo -e '[archive]\nzlib-level=1\n' >> repo/config
|
||||
|
||||
mkdir content
|
||||
cd content
|
||||
dd if=/dev/urandom of=bigobject bs=4k count=2560
|
||||
cp --reflink=auto bigobject bigobject2
|
||||
# Different metadata, same content
|
||||
chown bin:bin bigobject2
|
||||
cd ..
|
||||
ostree --repo=repo commit -b dupobjects --consume --selinux-policy=/ --tree=dir=content
|
||||
ostree --repo=repo summary -u
|
||||
|
||||
run_tmp_webserver $(pwd)/repo
|
||||
|
||||
origin=$(cat ${test_tmpdir}/httpd-address)
|
||||
|
||||
cleanup() {
|
||||
cd ${test_tmpdir}
|
||||
umount mnt || true
|
||||
test -n "${blkdev:-}" && losetup -d ${blkdev} || true
|
||||
}
|
||||
trap cleanup EXIT
|
||||
|
||||
mkdir mnt
|
||||
truncate -s 2G testblk.img
|
||||
if ! blkdev=$(losetup --find --show $(pwd)/testblk.img); then
|
||||
echo "ok # SKIP not run when cannot setup loop device"
|
||||
exit 0
|
||||
fi
|
||||
|
||||
# This filesystem must support reflinks
|
||||
mkfs.xfs -m reflink=1 ${blkdev}
|
||||
|
||||
mount ${blkdev} mnt
|
||||
cd mnt
|
||||
|
||||
# Test that reflink is really there (not just --reflink=auto)
|
||||
touch a
|
||||
cp --reflink a b
|
||||
mkdir repo
|
||||
ostree --repo=repo init
|
||||
ostree config --repo=repo set core.payload-link-threshold 0
|
||||
ostree --repo=repo remote add origin --set=gpg-verify=false ${origin}
|
||||
ostree --repo=repo pull --disable-static-deltas origin dupobjects
|
||||
find repo -type l -name '*.payload-link' >payload-links.txt
|
||||
assert_streq "$(wc -l < payload-links.txt)" "1"
|
||||
|
||||
# Disable logging for inner loop
|
||||
set +x
|
||||
cat payload-links.txt | while read i; do
|
||||
payload_checksum=$(basename $(dirname $i))$(basename $i .payload-link)
|
||||
payload_checksum_calculated=$(sha256sum $(readlink -f $i) | cut -d ' ' -f 1)
|
||||
assert_streq "${payload_checksum}" "${payload_checksum_calculated}"
|
||||
done
|
||||
set -x
|
||||
echo "ok pull creates .payload-link"
|
||||
date
|
||||
+27
@@ -0,0 +1,27 @@
|
||||
#!/bin/bash
|
||||
# Test min-free-space-percent using loopback devices
|
||||
|
||||
set -xeuo pipefail
|
||||
|
||||
dn=$(dirname $0)
|
||||
. ${dn}/../libinsttest.sh
|
||||
date
|
||||
|
||||
prepare_tmpdir
|
||||
trap _tmpdir_cleanup EXIT
|
||||
|
||||
cd ${test_tmpdir}
|
||||
truncate -s 20MB testblk.img
|
||||
blkdev=$(losetup --find --show $(pwd)/testblk.img)
|
||||
mkfs.xfs ${blkdev}
|
||||
mkdir mnt
|
||||
mount ${blkdev} mnt
|
||||
ostree --repo=mnt/repo init --mode=bare-user
|
||||
echo 'fsync=false' >> mnt/repo/config
|
||||
if ostree --repo=mnt/repo pull-local /ostree/repo ${host_commit} 2>err.txt; then
|
||||
fatal "succeeded in doing a pull with no free space"
|
||||
fi
|
||||
assert_file_has_content err.txt "min-free-space-percent"
|
||||
umount mnt
|
||||
losetup -d ${blkdev}
|
||||
date
|
||||
Executable
+49
@@ -0,0 +1,49 @@
|
||||
#!/bin/bash
|
||||
|
||||
# Using the host ostree, test HTTP pulls
|
||||
|
||||
set -xeuo pipefail
|
||||
|
||||
dn=$(dirname $0)
|
||||
. ${dn}/../libinsttest.sh
|
||||
date
|
||||
|
||||
prepare_tmpdir /var/tmp
|
||||
trap _tmpdir_cleanup EXIT
|
||||
|
||||
# Take the host's ostree, and make it archive
|
||||
mkdir repo
|
||||
ostree --repo=repo init --mode=archive
|
||||
echo -e '[archive]\nzlib-level=1\n' >> repo/config
|
||||
host_nonremoteref=$(echo ${host_refspec} | sed 's,[^:]*:,,')
|
||||
log_timestamps() {
|
||||
date
|
||||
"$@"
|
||||
date
|
||||
}
|
||||
log_timestamps ostree --repo=repo pull-local /ostree/repo ${host_commit}
|
||||
ostree --repo=repo refs ${host_commit} --create=${host_nonremoteref}
|
||||
|
||||
run_tmp_webserver $(pwd)/repo
|
||||
# Now test pulling via HTTP (no deltas) to a new bare-user repo
|
||||
ostree --repo=bare-repo init --mode=bare-user
|
||||
ostree --repo=bare-repo remote add origin --set=gpg-verify=false $(cat ${test_tmpdir}/httpd-address)
|
||||
log_timestamps ostree --repo=bare-repo pull --disable-static-deltas origin ${host_nonremoteref}
|
||||
|
||||
rm bare-repo repo -rf
|
||||
|
||||
# Try copying the host's repo across a mountpoint for direct
|
||||
# imports.
|
||||
cd ${test_tmpdir}
|
||||
mkdir tmpfs mnt
|
||||
mount --bind tmpfs mnt
|
||||
cd mnt
|
||||
ostree --repo=repo init --mode=bare
|
||||
log_timestamps ostree --repo=repo pull-local /ostree/repo ${host_commit}
|
||||
log_timestamps ostree --repo=repo fsck
|
||||
cd ..
|
||||
umount mnt
|
||||
|
||||
kill -TERM $(cat ${test_tmpdir}/httpd-pid)
|
||||
echo "ok"
|
||||
date
|
||||
+18
@@ -0,0 +1,18 @@
|
||||
#!/bin/bash
|
||||
|
||||
# Test that we didn't regress /etc/ostree/remotes.d handling
|
||||
|
||||
set -xeuo pipefail
|
||||
|
||||
dn=$(dirname $0)
|
||||
. ${dn}/../libinsttest.sh
|
||||
date
|
||||
|
||||
prepare_tmpdir
|
||||
trap _tmpdir_cleanup EXIT
|
||||
|
||||
ostree remote list > remotes.txt
|
||||
if ! test -s remotes.txt; then
|
||||
assert_not_reached "no ostree remotes"
|
||||
fi
|
||||
date
|
||||
@@ -0,0 +1 @@
|
||||
../libtest-core.sh
|
||||
Reference in new issue
Block a user