zuul-jobs/test-playbooks/base-test-roles/prepare-workspace-git.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

38 lines
1.3 KiB
YAML

- name: Test the test-prepare-workspace-git role
hosts: all
pre_tasks:
- name: Delete remote source directory to start with clean state
file:
state: absent
path: "{{ ansible_user_dir }}/{{ item.value.src_dir }}"
with_dict: "{{ zuul.projects }}"
roles:
- role: test-prepare-workspace-git
post_tasks:
# opendev/base-jobs is in 'required-projects'.
# Also check that the project being tested is being prepared.
# We're checking them explicitly rather than with_items on zuul.projects
# in case there is a regression which would take an item out.
- name: Check that opendev/base-jobs was prepared
stat:
path: "{{ ansible_user_dir }}/src/opendev.org/opendev/base-jobs"
register: base_jobs
- name: Check that zuul/project-config was prepared
stat:
path: "{{ ansible_user_dir }}/src/opendev.org/zuul/project-config"
register: project_config
- name: Check this project was prepared
stat:
path: "{{ ansible_user_dir }}/src/{{ zuul.project.canonical_name }}"
register: self_config
- name: Validate that required projects have been prepared
assert:
that:
- base_jobs.stat.exists
- project_config.stat.exists
- self_config.stat.exists