tests: minor syntax cleanups for legibility

Split ssh_config and long commands over multiple lines. Other minor
cleanups and syntax consistency fixes.
This commit is contained in:
Jonathan Lebon 2017-08-24 15:31:05 -04:00
parent 1459e66ac5
commit cae2408d4f

View File

@ -10,7 +10,14 @@
tasks: tasks:
- name: Prepare an SSH config - name: Prepare an SSH config
set_fact: 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" ssh_config: |
Host vmcheck
User {{ansible_ssh_user}}
Port {{ansible_ssh_port}}
HostName {{ansible_ssh_host}}
IdentityFile {{ansible_ssh_private_key_file}}
UserKnownHostsFile /dev/null
StrictHostKeyChecking no
- name: Add executor host - name: Add executor host
add_host: add_host:
@ -28,30 +35,34 @@
delegate_facts: True delegate_facts: True
- name: Install requirements - name: Install requirements
package: name={{item}} state=present # XXX: state=latest package: name={{item}} state=present
with_items: with_items:
- fedpkg - fedpkg
# The dist doesn't actually matter here # The dist doesn't actually matter here, it's just so we don't barf on
# private branches.
- name: Download and extract sources - name: Download and extract sources
command: fedpkg --dist=master prep command: fedpkg --dist=master prep
args: args:
chdir: "{{playbook_dir}}/.." chdir: "{{playbook_dir}}/.."
- name: Get source directory from environment - name: Get source directory from environment
shell: "rpm -q --specfile {{playbook_dir}}/../rpm-ostree.spec --qf '{{playbook_dir}}/../%{NAME}-%{VERSION}\n' | head -n1" shell: rpm -q --specfile {{playbook_dir}}/../rpm-ostree.spec
register: srcdir --qf '{{playbook_dir}}/../%{NAME}-%{VERSION}\n' | head -n1
register: srcdir_query
- set_fact:
srcdir: "{{srcdir_query.stdout}}"
- name: Write out SSH config - name: Write out SSH config
copy: copy:
content: "{{ssh_config}}" content: "{{ssh_config}}"
dest: "{{srcdir.stdout}}/ssh-config" dest: "{{srcdir}}/ssh-config"
- set_fact: - set_fact:
vmssh: ssh -F {{srcdir.stdout}}/ssh-config vmcheck vmssh: ssh -F {{srcdir}}/ssh-config vmcheck
# XXX: need to upstream this - name: Get rpm-ostree status
- name: create and rebase onto vmcheck
command: "{{vmssh}} rpm-ostree status --json" command: "{{vmssh}} rpm-ostree status --json"
register: status register: status
- set_fact: - set_fact:
@ -62,24 +73,23 @@
- shell: "{{vmssh}} shutdown -r now" - shell: "{{vmssh}} shutdown -r now"
ignore_errors: true ignore_errors: true
- name: Run Tests
block:
- name: Run vmcheck - name: Run vmcheck
block:
- name: Start test
command: tests/vmcheck/multitest.py vmcheck command: tests/vmcheck/multitest.py vmcheck
# XXX: consider making vmcheck become an installed test # XXX: consider making vmcheck become an installed test
environment: environment:
VMTESTS: 1 VMTESTS: 1
SKIP_VMOVERLAY: 1 TESTS: basic
TESTS: basic layering-basic topsrcdir: "{{srcdir}}"
topsrcdir: "{{srcdir.stdout}}" commondir: "{{srcdir}}/tests/common"
commondir: "{{srcdir.stdout}}/tests/common"
args: args:
chdir: "{{srcdir.stdout}}" chdir: "{{srcdir}}"
always: always:
- name: fetch vmcheck results - name: fetch vmcheck results
synchronize: synchronize:
src: "{{srcdir.stdout}}/vmcheck/" src: "{{srcdir}}/vmcheck/"
dest: "{{artifacts}}/vmcheck" dest: "{{artifacts}}/vmcheck"
mode: pull mode: pull
delete: yes delete: yes