Add fetch-output and ensure-output-dirs tests
We've added two new base-job roles, let's also add integration tests. Depends-On: https://review.openstack.org/628734 Change-Id: I8b9b10983b2bc7bba37a19d2eb0d4107241d168c
This commit is contained in:
parent
7fdfe583a3
commit
d7eb4df0b0
@ -5,9 +5,11 @@
|
||||
|
||||
# Note: set-zuul-log-path-fact is tested by emit-job-header.yaml
|
||||
- include: emit-job-header.yaml
|
||||
- include: ensure-output-dirs.yaml
|
||||
- include: configure-unbound.yaml
|
||||
- include: use-cached-repos.yaml
|
||||
- include: mirror-info.yaml
|
||||
- include: configure-mirrors.yaml
|
||||
- include: fetch-zuul-cloner.yaml
|
||||
- include: validate-host.yaml
|
||||
- include: fetch-output.yaml
|
||||
|
32
tests/ensure-output-dirs.yaml
Normal file
32
tests/ensure-output-dirs.yaml
Normal file
@ -0,0 +1,32 @@
|
||||
- name: Test the ensure-output-dirs role
|
||||
hosts: all
|
||||
roles:
|
||||
- role: ensure-output-dirs
|
||||
post_tasks:
|
||||
- name: Check that log dir has been created
|
||||
file:
|
||||
path: "{{ zuul_output_dir }}/logs"
|
||||
state: directory
|
||||
register: log_directory
|
||||
|
||||
- name: Check that artifact dir has been created
|
||||
file:
|
||||
path: "{{ zuul_output_dir }}/artifacts"
|
||||
state: directory
|
||||
register: artifact_directory
|
||||
|
||||
- name: Check that doc dir has been created
|
||||
file:
|
||||
path: "{{ zuul_output_dir }}/docs"
|
||||
state: directory
|
||||
register: doc_directory
|
||||
|
||||
- name: Validate that directories were set correctly
|
||||
assert:
|
||||
that:
|
||||
- not log_directory | changed
|
||||
- log_directory | succeeded
|
||||
- not artifact_directory | changed
|
||||
- artifact_directory | succeeded
|
||||
- not doc_directory | changed
|
||||
- doc_directory | succeeded
|
46
tests/fetch-output.yaml
Normal file
46
tests/fetch-output.yaml
Normal file
@ -0,0 +1,46 @@
|
||||
- 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:
|
||||
- not local_log_content | changed
|
||||
- local_log_content | succeeded
|
||||
- not local_artifact_content | changed
|
||||
- local_artifact_content | succeeded
|
||||
- not local_doc_content | changed
|
||||
- local_doc_content | succeeded
|
@ -22,10 +22,12 @@
|
||||
- ^roles/configure-mirrors/.*
|
||||
- ^roles/configure-unbound/.*
|
||||
- ^roles/emit-job-header/.*
|
||||
- ^roles/ensure-output-dirs/.*
|
||||
- ^roles/fetch-zuul-cloner/.*
|
||||
- ^roles/mirror-info/.*
|
||||
- ^roles/set-zuul-log-path-fact/.*
|
||||
- ^roles/use-cached-repos/.*
|
||||
- ^roles/fetch-output/.*
|
||||
- ^roles/validate-host/.*
|
||||
- ^tests/.*
|
||||
|
||||
@ -100,7 +102,9 @@
|
||||
- ^roles/configure-mirrors/.*
|
||||
- ^roles/configure-unbound/.*
|
||||
- ^roles/emit-job-header/.*
|
||||
- ^roles/ensure-output-dirs/.*
|
||||
- ^roles/fetch-zuul-cloner/.*
|
||||
- ^roles/fetch-output/.*
|
||||
- ^roles/mirror-info/.*
|
||||
- ^roles/set-zuul-log-path-fact/.*
|
||||
- ^roles/use-cached-repos/.*
|
||||
|
Loading…
x
Reference in New Issue
Block a user