rpm-ostree/tests/tests.yml

86 lines
2.8 KiB
YAML
Raw Normal View History

---
- hosts: localhost
gather_facts: yes
vars:
artifacts: "{{ lookup('env', 'TEST_ARTIFACTS')|default('./artifacts', true) }}"
subjects: "{{ lookup('env', 'TEST_SUBJECTS')}}"
tags:
- atomic
tasks:
- name: Prepare an SSH config
set_fact:
ssh_config: "Host vmcheck\n\tUser {{ ansible_ssh_user }}\n\tPort {{ ansible_ssh_port }}\n\tHostName {{ ansible_ssh_host }}\n\tIdentityFile {{ ansible_ssh_private_key_file }}\n\tUserKnownHostsFile /dev/null\n\tStrictHostKeyChecking no\n"
- name: Add executor host
add_host:
name: executor
ansible_connection: local
ansible_ssh_host: 127.0.0.1
ansible_ssh_connection: local
# XXX: move to standard-test-roles, e.g. standard-test-get-source
- name: Extract and run tests
delegate_to: executor
block:
- name: Gather facts
setup:
delegate_facts: True
- name: Install requirements
package: name={{item}} state=present # XXX: state=latest
with_items:
- fedpkg
# The dist doesn't actually matter here
- name: Download and extract sources
command: fedpkg --dist=master prep
args:
chdir: "{{playbook_dir}}/.."
- name: Get source directory from environment
shell: "rpm -q --specfile {{playbook_dir}}/../rpm-ostree.spec --qf '{{playbook_dir}}/../%{NAME}-%{VERSION}\n' | head -n1"
register: srcdir
- name: Write out SSH config
copy:
content: "{{ ssh_config }}"
dest: "{{srcdir.stdout}}/ssh-config"
- set_fact:
vmssh: ssh -F {{srcdir.stdout}}/ssh-config vmcheck
# XXX: need to upstream this
- name: create and rebase onto vmcheck
command: "{{vmssh}} rpm-ostree status --json"
register: status
- set_fact:
status_json: "{{ status.stdout | from_json }}"
- command: "{{vmssh}} ostree refs {{ status_json['deployments'][0]['origin'] }} --create vmcheck"
- command: "{{vmssh}} rpm-ostree rebase :vmcheck"
# XXX: use ans_reboot.yml from a-h-t
- shell: "{{vmssh}} shutdown -r now"
ignore_errors: true
- name: Run Tests
block:
- name: Run vmcheck
command: tests/vmcheck/multitest.py vmcheck
# XXX: consider making vmcheck become an installed test
environment:
VMTESTS: 1
SKIP_VMOVERLAY: 1
TESTS: basic layering-basic
topsrcdir: "{{srcdir.stdout}}"
commondir: "{{srcdir.stdout}}/tests/common"
args:
chdir: "{{srcdir.stdout}}"
always:
- name: fetch vmcheck results
synchronize:
src: "{{srcdir.stdout}}/vmcheck/"
dest: "{{artifacts}}/vmcheck"
mode: pull
delete: yes