ansible-role-refstack-client/tasks/post-tasks.yaml
Martin Kopec f448d8c15d Run add-ons tests as well
Run tests of all target programs we have.
The patch enables required services in devstack (environment
the tests are executed on in Zuul) and implements a logic when
share config options which can be discovered only by using admin
credentials are passed to the second tempestconf execution
(with demo creds) so that they are set in tempest.conf used to run
refstack-client.

Change-Id: I79b7611f47d7d67d439e24c2427ee59870732172
2021-04-11 08:11:18 +00:00

87 lines
2.9 KiB
YAML

---
# The task finds the latest result file in case there are more of them
# e.g. refstack-client was already executed in the current env
- name: Find the test result json file
find:
path: "{{ refstack_client_source }}/.tempest/.stestr"
patterns: '*.json'
register: ls_out
- when: upload_results | bool
block:
# refstack doesn't allow annonymous results uploading anymore, therefore
# this task copies user's key to the target machine (if needed) so that it
# can be used in the following task which uploads the result to the user's
# refstack account
- name: Copy private key
copy:
src: "{{ private_key_path_src }}"
dest: "{{ private_key_path }}"
mode: '0600'
when:
- private_key_path is defined
- private_key_path_src is defined
- name: Upload results with signature
shell: |
set -ex
source .venv/bin/activate
refstack-client upload -y "{{ ls_out.files[-(item[0] | int + 1) | int].path }}" \
--url {{ server }} \
-i {{ private_key_path }}
register: upload_out
args:
chdir: "{{ refstack_client_source }}"
executable: /bin/bash
with_indexed_items: "{{ refstack_target_programs }}"
when:
- private_key_path is defined
- debug:
msg: "{{ upload_out }}"
# this becomes handy when the role is executed on a remote node from
# an executor node (e.g. a Jenkins job) when the below artifacts might be
# needed for a further processing (e.g. part of log collection of the job)
- when: download_artifacts | bool
block:
- name: Download results file in .json
fetch:
src: "{{ ls_out.files[-(item[0] | int + 1) | int].path }}"
dest: "{{ dest_dir }}/test_results{{ (item[0] | int + 1) | int }}.json"
flat: true
with_indexed_items: "{{ refstack_target_programs }}"
- name: Download results file in subunit
fetch:
src: "{{ ls_out.files[-(item[0] | int + 1) | int].path | splitext | first }}"
dest: "{{ dest_dir }}/test_results_subunit {{ (item[0] | int + 1) | int }}"
flat: true
with_indexed_items: "{{ refstack_target_programs }}"
- name: Dump output of upload command
copy:
content: "{{ upload_out }}"
dest: "{{ dest_dir }}/upload_output.txt"
mode: '0644'
delegate_to: localhost
when: upload_results | bool
- name: Download tempest_admin.conf file
fetch:
src: "{{ path_to_admin_tempest_config }}"
dest: "{{ dest_dir }}/tempest_admin.conf"
flat: true
- name: Download tempest.conf file
fetch:
src: "{{ path_to_tempest_config }}"
dest: "{{ dest_dir }}/tempest.conf"
flat: true
- name: Download accounts.yaml file
fetch:
src: "{{ path_to_accounts_file }}"
dest: "{{ dest_dir }}/accounts.yaml"
flat: true