Skip to content

Commit a1a3651

Browse files
committed
Only run host and/or monitoring tests if present, this allows for staged
merging of different SCT branches.
1 parent 3d8b43d commit a1a3651

File tree

1 file changed

+13
-3
lines changed

1 file changed

+13
-3
lines changed

etc/kayobe/ansible/stackhpc-cloud-tests.yml

Lines changed: 13 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,8 @@
1010
# stackhpc_cloud_tests_version so this is only used if running "locally".
1111
sct_version: "main"
1212
# TODO: REMOVE THIS
13-
sct_version_override: "docker-selinux"
13+
#sct_version_override: "docker-selinux"
14+
sct_version_override: "prometheus-alerts"
1415
sct_timeout: 30
1516
results_path_local: "{{ lookup('env', 'HOME') }}/sct-results"
1617
tasks:
@@ -76,6 +77,10 @@
7677

7778
# Monitoring tests should run once, executed on the host in the
7879
# tempest_runner group.
80+
- name: Check for StackHPC Cloud monitoring tests
81+
ansible.builtin.stat:
82+
path: "{{ repo_tmpdir.path }}/stackhpc_cloud_tests/monitoring"
83+
register: stackhpc_cloud_monitoring_tests
7984
- name: Run StackHPC Cloud monitoring tests
8085
ansible.builtin.command:
8186
cmd: >
@@ -118,13 +123,17 @@
118123
sct_prometheus_password: "{{ kolla_passwords.prometheus_password }}"
119124
failed_when: monitoring_results.rc not in [0, 1]
120125
register: monitoring_results
121-
when: "'tempest_runner' in group_names"
126+
when: "'tempest_runner' in group_names and stackhpc_cloud_monitoring_tests.stat.exists"
122127

123128
# Host tests should run on every host in the overcloud group.
124129
# TODO: Use TestInfra's native Ansible or SSH connection plugins for
125130
# remote test execution? That would place all results in a single file
126131
# and allow us to execute all tests from a single host.
127132
# https://testinfra.readthedocs.io/en/latest/backends.html#connection-backends
133+
- name: Check for StackHPC Cloud monitoring tests
134+
ansible.builtin.stat:
135+
path: "{{ repo_tmpdir.path }}/stackhpc_cloud_tests/host"
136+
register: stackhpc_cloud_host_tests
128137
- name: Run StackHPC Cloud host tests
129138
ansible.builtin.command:
130139
cmd: >
@@ -147,14 +156,15 @@
147156
sct_selinux_state: "{{ selinux_state }}"
148157
failed_when: host_results.rc not in [0, 1]
149158
register: host_results
150-
when: "'overcloud' in group_names"
151159
# Some host checks may need to run as root
152160
become: true
161+
when: "'overcloud' in group_names and stackhpc_cloud_host_tests.stat.exists"
153162
# Host test results will be owned by root - we need to read and delete them
154163
- name: Change permissions on SCT host test results
155164
ansible.builtin.command:
156165
cmd: chmod 666 {{ results_tmpdir.path }}/host-{{ inventory_hostname }}.html
157166
become: true
167+
when: "'overcloud' in group_names and stackhpc_cloud_host_tests.stat.exists"
158168

159169
always:
160170
- name: Synchronize results

0 commit comments

Comments
 (0)