aboutsummaryrefslogtreecommitdiff
path: root/contrib/test/integration/results.yml
blob: c9a96abb1c1050b25233b376c5b29c190f8baae4 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
---
# vim-syntax: ansible

- hosts: '{{ hosts | default("all") }}'
  vars_files:
    - "{{ playbook_dir }}/vars.yml"
  vars:
    _result_filepaths: []  # do not use
    _dstfnbuff: []  # do not use
  tasks:
    - name: The crio_integration_filepath is required
      tags:
          - integration
      set_fact:
       _result_filepaths: "{{ _result_filepaths + [crio_integration_filepath] }}"

    - name: The crio_node_e2e_filepath is required
      tags:
          - e2e
      set_fact:
       _result_filepaths: "{{ _result_filepaths + [crio_node_e2e_filepath] }}"

    - name: Verify expectations
      assert:
        that:
          - 'result_dest_basedir | default(False, True)'
          - '_result_filepaths | default(False, True)'
          - '_dstfnbuff == []'
          - 'results_fetched is undefined'

    - name: Results directory exists
      file:
          path: "{{ result_dest_basedir }}"
          state: directory
      delegate_to: localhost

    - name: destination file paths are buffered for overwrite-checking and jUnit conversion
      set_fact:
          _dstfnbuff: >
              {{ _dstfnbuff |
                 union( [result_dest_basedir ~ "/" ~ inventory_hostname ~ "/" ~ item | basename] ) }}
      with_items: '{{ _result_filepaths }}'

    - name: Overwriting existing results assumed very very bad
      fail:
          msg: "Cowardly refusing to overwrite {{ item }}"
      when: item | exists
      delegate_to: localhost
      with_items: '{{ _dstfnbuff }}'

    # fetch module doesn't support directories
    - name: Retrieve results from all hosts
      synchronize:
          checksum: True  # Don't rely on date/time being in sync
          archive: False  # Don't bother with permissions or times
          copy_links: True  # We want files, not links to files
          recursive: True
          mode: pull
          dest: '{{ result_dest_basedir }}/{{ inventory_hostname }}/'  # must end in /
          src: '{{ item }}'
      register: results_fetched
      with_items: '{{ _result_filepaths }}'