tests/str: Rework invocation

Let's make our `run.sh` generically support any playbook. This is prep for
writing further tests in Ansible. Along with that, rework the Ansible so that
`tests.yml` is a playbook, and then the other bits are just task lists. It's
easier to read.

I also started to add a `use_git_build` variable with the idea that we'll be
able to run these same tests against an upstream image by setting that variable
off.

Closes: #1493
Approved by: jlebon
This commit is contained in:
Colin Walters 2018-03-09 13:26:07 -05:00 committed by Atomic Bot
parent 5b3f79d4bb
commit 10fb74025d
5 changed files with 57 additions and 57 deletions

View File

@ -15,7 +15,7 @@ tests:
- ./tests/fedora-str/provision.sh
# TODO: enhance papr to have caching, a bit like https://docs.travis-ci.com/user/caching/
- curl -Lo fedora-atomic-host.qcow2 https://getfedora.org/atomic_qcow2_latest
- env "TEST_SUBJECTS=$(pwd)/fedora-atomic-host.qcow2" ./tests/fedora-str/run.sh
- env "TEST_SUBJECTS=$(pwd)/fedora-atomic-host.qcow2" ./tests/fedora-str/playbook-run.sh tests/fedora-str/tests.yml
artifacts:
- tests/fedora-str/artifacts/fedora-atomic-host.qcow2.log

View File

@ -1,9 +1,5 @@
---
- hosts: localhost
tags:
- atomic
remote_user: root
tasks:
# Run "admin unlock" and add locally built RPMs, then
# copy the whole tests/ directory into the VM.
- command: ostree --version
changed_when: False
register: ostree_orig_version

View File

@ -1,9 +1,8 @@
#!/usr/bin/bash
# A thin wrapper for ansible-playbook which has a nice check for
# TEST_SUBJECTS being set.
set -xeuo pipefail
dn=$(cd $(dirname $0) && pwd)
cd ${dn}
# https://fedoraproject.org/wiki/CI/Tests
if test -z "${TEST_SUBJECTS:-}"; then
cat <<EOF
@ -22,4 +21,4 @@ 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
exec ansible-playbook --tags=atomic "$@"

View File

@ -1,9 +1,6 @@
---
- hosts: localhost
tags:
- atomic
remote_user: root
tasks:
# Run the system installed tests
- import_tasks: overlay-git.yml
when: use_git_build
# Down the line perhaps do each log file separately?
- name: Run sysinstalled tests
shell: /root/tests/installed/run.sh &> /root/installed-tests.log

View File

@ -1,2 +1,10 @@
- include: overlay-git.yml
- include: sysinstall-tests.yml
# This entrypoint right now just runs the sysinstalled-tests.
---
- hosts: localhost
tags:
- atomic
remote_user: root
vars:
use_git_build: True
tasks:
- import_tasks: sysinstall-tests.yml