tests/inst: Add destructive test framework

This adds infrastructure to the Rust test suite for destructive
tests, and adds a new `transactionality` test which runs
rpm-ostree in a loop (along with `ostree-finalize-staged`) and
repeatedly uses either `kill -9`, `reboot` and  `reboot -ff`.

The main goal here is to flush out any "logic errors".

So far I've validated that this passes a lot of cycles
using
```
$ kola run --qemu-image=fastbuild-fedora-coreos-ostree-qemu.qcow2 ext.ostree.destructive-rs.transactionality --debug --multiply 8 --parallel 4
```
a number of times.
This commit is contained in:
Colin Walters committed 2020-08-17 14:34:04 +00:00
1 parent ab95c0264c
commit 1101c02c2a
15 files changed
+1079 -86

No files matched your search

+1
View File
@@ -0,0 +1 @@
destructive-list.txt
+4 -2
View File
@@ -7,9 +7,11 @@ KOLA_TESTDIR = $(DESTDIR)/usr/lib/coreos-assembler/tests/kola/ostree/
all:
for x in $(LIBSCRIPTS); do bash -n "$${x}"; done
(cd ../inst && cargo build --release)
(cd ../inst && cargo run --release -- list-destructive) > destructive-list.txt
install: all
install:
install -D -m 0644 -t $(KOLA_TESTDIR) $(LIBSCRIPTS)
for x in $(TESTDIRS); do rsync -rlv ./$${x} $(KOLA_TESTDIR)/; done
install -D -m 0755 -t $(KOLA_TESTDIR)/nondestructive-rs ../inst/target/release/ostree-test
install -D -m 0644 destructive-stamp.ign $(KOLA_TESTDIR)/destructive-rs/config.ign
./install-wrappers.sh destructive-list.txt $(KOLA_TESTDIR)/destructive-rs
+17
View File
@@ -0,0 +1,17 @@
{
"ignition": {
"version": "3.0.0"
},
"storage": {
"files": [
{
"path": "/etc/ostree-destructive-test-ok",
"filesystem": "root",
"mode": 420,
"contents": {
"source": "data:text/plain;base64,"
}
}
]
}
}
+17
View File
@@ -0,0 +1,17 @@
#!/bin/bash
set -xeuo pipefail
# Generates a kola test for each destructive test in the binary
list=$1
shift
testdir=$1
shift
ln -Tsf ../nondestructive-rs ${testdir}/data
while read line; do
cat >${testdir}/${line} << EOF
#!/bin/bash
set -xeuo pipefail
dn=\$(dirname $0)
exec \${KOLA_EXT_DATA}/ostree-test run-destructive ${line}
EOF
chmod a+x "${testdir}/${line}"
done < "${list}"