zuul-jobs/test-playbooks/base-test-roles/fetch-output.yaml
James E. Blair d6ae964f47 Avoid fstrings in test-prepare-workspace-git
Fstrings are not supported in python3.5 which is in use on Xenial.
We don't claim to support Xenial, but this is an easy regression
to avoid.

Also, add test jobs for this role so that we get feedback before
copying it to the prod roles.

Also, add a xenial test job to exercise it since we still have
Xenial nodes available.

Change-Id: Ifc773aa688adb1a01cfe691b3bdca0b3086658cd
2024-08-28 09:55:55 -07:00

47 lines
1.4 KiB
YAML

- name: Run the fetch-output role
hosts: all
pre_tasks:
# ensure-output-dirs is run before this
- name: Write test log file
copy:
dest: '{{ zuul_output_dir }}/{{ item }}/{{ inventory_hostname }}'
content: '{{ item }}'
loop:
- logs
- docs
- artifacts
roles:
- role: fetch-output
post_tasks:
- name: Check that logs have been pulled
delegate_to: localhost
file:
# log_path fact is set in fetch-output
path: "{{ log_path }}/{{ inventory_hostname }}"
state: file
register: local_log_content
- name: Check that artifacts have been pulled
delegate_to: localhost
file:
path: "{{ zuul.executor.work_root }}/artifacts/{{ inventory_hostname }}"
state: file
register: local_artifact_content
- name: Check that docs have been pulled
delegate_to: localhost
file:
path: "{{ zuul.executor.work_root }}/docs/{{ inventory_hostname }}"
state: file
register: local_doc_content
- name: Validate that files were pulled correctly
assert:
that:
- local_log_content is not changed
- local_log_content is succeeded
- local_artifact_content is not changed
- local_artifact_content is succeeded
- local_doc_content is not changed
- local_doc_content is succeeded