2019-09-12 18:46:42 +00:00
|
|
|
- hosts: all
|
|
|
|
pre_tasks:
|
|
|
|
# Run ensure-output-dirs now as it is not performed speculatively
|
2023-02-02 13:22:56 +11:00
|
|
|
- name: Run ensure-output-dirs
|
|
|
|
import_role:
|
2019-09-12 18:46:42 +00:00
|
|
|
name: ensure-output-dirs
|
|
|
|
|
|
|
|
- name: Create fake test directory
|
|
|
|
file:
|
|
|
|
path: "{{ zuul.project.src_dir }}/ztest"
|
|
|
|
state: directory
|
|
|
|
|
|
|
|
- name: Simplify tox config
|
|
|
|
copy:
|
|
|
|
content: "{{ item.content }}"
|
|
|
|
dest: "{{ zuul.project.src_dir }}/{{ item.dest }}"
|
|
|
|
with_items:
|
|
|
|
- content: |
|
2022-12-29 11:07:32 -08:00
|
|
|
[tox]
|
|
|
|
envlist = venv
|
|
|
|
|
2019-09-12 18:46:42 +00:00
|
|
|
[testenv]
|
|
|
|
sitepackages = True
|
|
|
|
usedevelop = True
|
|
|
|
deps = stestr
|
|
|
|
|
|
|
|
[testenv:venv]
|
|
|
|
commands = stestr run --test-path ./ztest/ {posargs}
|
|
|
|
dest: tox.ini
|
|
|
|
- content: |
|
|
|
|
import setuptools
|
2022-07-27 05:41:20 +10:00
|
|
|
setuptools.setup(py_modules=[])
|
2019-09-12 18:46:42 +00:00
|
|
|
dest: setup.py
|
|
|
|
- content: ""
|
|
|
|
dest: setup.cfg
|
|
|
|
- content: |
|
|
|
|
import unittest
|
|
|
|
class TestTestCase(unittest.TestCase):
|
|
|
|
def test_test(self):
|
|
|
|
assert True
|
|
|
|
dest: ztest/__init__.py
|
|
|
|
|
|
|
|
- name: Generate tox results
|
|
|
|
include_role:
|
|
|
|
name: "{{ item }}"
|
|
|
|
with_items:
|
|
|
|
- ensure-tox
|
|
|
|
- ensure-python
|
|
|
|
- tox
|
|
|
|
|
|
|
|
tasks:
|
2023-02-02 13:22:56 +11:00
|
|
|
- name: Run fetch-subunit-output
|
|
|
|
import_role:
|
2019-09-12 18:46:42 +00:00
|
|
|
name: fetch-subunit-output
|
|
|
|
|
2023-02-02 13:22:56 +11:00
|
|
|
- name: Run fetch-output
|
|
|
|
import_role:
|
2019-09-12 18:46:42 +00:00
|
|
|
name: fetch-output
|
|
|
|
when: zuul_use_fetch_output
|
|
|
|
|
|
|
|
post_tasks:
|
|
|
|
- name: Check for artifact on the test instance
|
|
|
|
stat:
|
|
|
|
path: "{{ ansible_user_dir }}/zuul-output/logs/testr_results.html"
|
|
|
|
register: _test_artifact
|
|
|
|
failed_when: not _test_artifact.stat.exists
|
|
|
|
when: zuul_use_fetch_output
|
|
|
|
|
|
|
|
- name: Check for artifact on the executor
|
|
|
|
stat:
|
|
|
|
path: "{{ zuul.executor.log_root }}/testr_results.html"
|
|
|
|
delegate_to: localhost
|
|
|
|
register: _executor_artifact
|
|
|
|
failed_when: not _executor_artifact.stat.exists
|