ci: Rework installed tests to use Fedora Standard Test interface

Reusing the way `standard-test-roles` has support for booting
a qcow2 actually gets us to the "VM-in-container" flow.  Plus
Ansible over shell script is sometimes nicer.

https://fedoraproject.org/wiki/CI/Tests#Testing_an_Atomic_Host

It's better than what we were doing before for installed tests,
and moreover using Ansible more broadly for testing is going
to align us better with Fedora's CI.

As part of this I split off a "libpaprci" which I intend to maintain
as a "copylib" for a little bit between ostree/rpm-ostree, and then
we'll figure out how to expand from there (maybe some of the patterns
get "baked in" to PAPR for example).

Note the `FAH27-insttests` context moves to the top since it's now
of primary importance, and I expect that we start expanding it.

Closes: #1462
Approved by: jlebon
This commit is contained in:
Colin Walters authored and Atomic Bot committed 2018-03-08 20:51:42 +00:00
1 parent 3b7044f45e
commit 6e9d00dbeb
20 files changed
+361 -172

No files matched your search

+2
View File
@@ -0,0 +1,2 @@
This directory holds tests that use the
[Fedora Standard Test Interface](https://fedoraproject.org/wiki/CI/Standard_Test_Interface).
+31
View File
@@ -0,0 +1,31 @@
---
- hosts: localhost
tags:
- atomic
remote_user: root
tasks:
- command: ostree --version
changed_when: False
register: ostree_orig_version
- set_fact:
ostree_orig_version_yaml: "{{ ostree_orig_version.stdout | from_yaml }}"
- name: Copy locally built RPMs
synchronize: src=x86_64/ dest=/root/x86_64/ archive=yes
- shell: ostree admin unlock || true
# Install the RPMs we already have. For the test suite we use rpm2cpio
# since it depends on libsoup, but we're not using that yet for the sysinstalled tests
- shell: >
/usr/bin/rpm -Fvh /root/x86_64/*.rpm && \
cd / && rpm2cpio /root/x86_64/ostree-tests-2*.rpm | cpio -div
- command: ostree --version
register: ostree_new_version
- set_fact:
ostree_new_version_yaml: "{{ ostree_new_version.stdout | from_yaml }}"
- name: "Fail if we didn't change the ostree version"
when: ostree_orig_version_yaml['libostree']['Git'] == ostree_new_version_yaml['libostree']['Git']
fail:
msg: "Failed to change ostree version"
# Next copy all of the tests/ directory
- name: Copy test data
synchronize: src=../../ dest=/root/tests/ archive=yes
+8
View File
@@ -0,0 +1,8 @@
#!/usr/bin/bash
set -xeuo pipefail
dn=$(dirname $0)
. ${dn}/../../ci/libpaprci/libbuild.sh
pkg_upgrade
pkg_install git rsync openssh-clients ansible standard-test-roles
+25
View File
@@ -0,0 +1,25 @@
#!/usr/bin/bash
set -xeuo pipefail
dn=$(cd $(dirname $0) && pwd)
cd ${dn}
# https://fedoraproject.org/wiki/CI/Tests
if test -z "${TEST_SUBJECTS:-}"; then
cat <<EOF
error: TEST_SUBJECTS must be set; e.g.:
curl -Lo fedora-atomic-host.qcow2 'https://getfedora.org/atomic_qcow2_latest'
export TEST_SUBJECTS=\$(pwd)/fedora-atomic-host.qcow2
If you're doing interactive development, we recommend caching the qcow2
somewhere persistent.
EOF
exit 1
fi
ls -al ${TEST_SUBJECTS}
export ANSIBLE_INVENTORY=${ANSIBLE_INVENTORY:-$(test -e inventory && echo inventory || echo /usr/share/ansible/inventory)}
ls -al /dev/kvm
ansible-playbook --tags=atomic tests.yml
+20
View File
@@ -0,0 +1,20 @@
---
- hosts: localhost
tags:
- atomic
remote_user: root
tasks:
# Down the line perhaps do each log file separately?
- name: Run sysinstalled tests
shell: /root/tests/installed/run.sh &> /root/installed-tests.log
register: sysinstalled_result
failed_when: False
- name: Fetch sysinstalled results
fetch:
src: /root/installed-tests.log
dest: artifacts/installed-tests.log
flat: yes
- name: Assert that sysinstalled tests succeeded
when: sysinstalled_result.rc != 0
fail:
msg: "sysinstalled tests failed"
+2
View File
@@ -0,0 +1,2 @@
- include: overlay-git.yml
- include: sysinstall-tests.yml
-10
View File
@@ -1,10 +0,0 @@
#!/bin/bash
set -xeuo pipefail
# If we're using devmapper, expand the root
if lvm lvs atomicos/docker-pool &>/dev/null; then
systemctl stop docker
lvm lvremove -f atomicos/docker-pool
fi
lvm lvextend -r -l +100%FREE atomicos/root
ostree admin unlock
rsync -rlv ./ostree/insttree/usr/ /usr/