|
| 1 | +# (c) Copyright IBM Corp. 2024 |
| 2 | +# Apache License, Version 2.0 (see https://opensource.org/licenses/Apache-2.0) |
| 3 | +--- |
| 4 | +- name: Warm auxillary trace data set |
| 5 | + |
| 6 | + hosts: "all" |
| 7 | + gather_facts: false |
| 8 | + vars: |
| 9 | + region_dataset_path: "ANSIBIT.CICS.TESTS.{{ cics_test_area_absent }}" |
| 10 | + auxt_name: "DFHAUXT" |
| 11 | + buxt_name: "DFHBUXT" |
| 12 | + auxt_path: "{{ region_dataset_path }}.{{ auxt_name }}" |
| 13 | + buxt_path: "{{ region_dataset_path }}.{{ buxt_name }}" |
| 14 | + |
| 15 | + module_defaults: |
| 16 | + ibm.ibm_zos_cics.trace: |
| 17 | + region_data_sets: |
| 18 | + template: "{{ region_dataset_path }}.<< data_set_name >>" |
| 19 | + |
| 20 | + tasks: |
| 21 | + # ############################################################################# |
| 22 | + # ############################## Initial cleanup ############################## |
| 23 | + # ############################################################################# |
| 24 | + |
| 25 | + - name: Delete DFHAUXT Data Set if it exists |
| 26 | + environment: "{{ environment_vars }}" |
| 27 | + ibm.ibm_zos_core.zos_data_set: |
| 28 | + name: "{{ auxt_path }}" |
| 29 | + state: absent |
| 30 | + register: delete_result |
| 31 | + retries: 3 |
| 32 | + until: delete_result is not failed |
| 33 | + |
| 34 | + - name: Assert Delete Passed |
| 35 | + ansible.builtin.assert: |
| 36 | + that: |
| 37 | + - delete_result.failed == false |
| 38 | + |
| 39 | + - name: Delete DFHBUXT Data Set if it exists |
| 40 | + environment: "{{ environment_vars }}" |
| 41 | + ibm.ibm_zos_core.zos_data_set: |
| 42 | + name: "{{ buxt_path }}" |
| 43 | + state: absent |
| 44 | + register: delete_result |
| 45 | + retries: 3 |
| 46 | + until: delete_result is not failed |
| 47 | + |
| 48 | + - name: Assert Delete Passed |
| 49 | + ansible.builtin.assert: |
| 50 | + that: |
| 51 | + - delete_result.failed == false |
| 52 | + |
| 53 | + |
| 54 | + # ############################################################################# |
| 55 | + # ############################## Module Testing ############################### |
| 56 | + # ############################################################################# |
| 57 | + |
| 58 | + - name: Create DFHAUXT data set with warm (should fail) |
| 59 | + environment: "{{ environment_vars }}" |
| 60 | + ibm.ibm_zos_cics.trace: |
| 61 | + state: "warm" |
| 62 | + register: result |
| 63 | + ignore_errors: true |
| 64 | + |
| 65 | + - name: Debug |
| 66 | + ansible.builtin.debug: |
| 67 | + msg: "{{ result }}" |
| 68 | + |
| 69 | + - name: Assert DFHAUXT failed to create |
| 70 | + ansible.builtin.assert: |
| 71 | + that: |
| 72 | + - result.failed is true |
| 73 | + - result.changed is false |
| 74 | + - result.start_state.exists == false |
| 75 | + - result.end_state.exists == false |
| 76 | + - "'msg' in result" |
| 77 | + - "'Data set {{ auxt_path }} does not exist.' in result.msg" |
| 78 | + |
| 79 | + - name: Create DFHAUXT data set |
| 80 | + environment: "{{ environment_vars }}" |
| 81 | + ibm.ibm_zos_cics.trace: |
| 82 | + state: "initial" |
| 83 | + register: result |
| 84 | + |
| 85 | + - name: Debug |
| 86 | + ansible.builtin.debug: |
| 87 | + msg: "{{ result }}" |
| 88 | + |
| 89 | + - name: Assert DFHAUXT Created |
| 90 | + ansible.builtin.assert: |
| 91 | + that: |
| 92 | + - result.failed is false |
| 93 | + - result.changed is true |
| 94 | + |
| 95 | + - result.start_state.exists == false |
| 96 | + |
| 97 | + - result.end_state.exists == true |
| 98 | + |
| 99 | + - name: Create DFHAUXT data set with warm (should fail, empty) |
| 100 | + environment: "{{ environment_vars }}" |
| 101 | + ibm.ibm_zos_cics.trace: |
| 102 | + state: "warm" |
| 103 | + register: result |
| 104 | + ignore_errors: true |
| 105 | + |
| 106 | + - name: Debug |
| 107 | + ansible.builtin.debug: |
| 108 | + msg: "{{ result }}" |
| 109 | + |
| 110 | + - name: Assert DFHAUXT failed to create |
| 111 | + ansible.builtin.assert: |
| 112 | + that: |
| 113 | + - result.failed is true |
| 114 | + - result.changed is false |
| 115 | + - result.start_state.exists == true |
| 116 | + - result.end_state.exists == true |
| 117 | + - "'msg' in result" |
| 118 | + - "'Data set {{ auxt_path }} is empty.' in result.msg" |
| 119 | + |
| 120 | + - name: Copy a local file to a sequential data set |
| 121 | + environment: "{{ environment_vars }}" |
| 122 | + ibm.ibm_zos_core.zos_copy: |
| 123 | + src: "{{ playbook_dir }}/sample_trace.txt" |
| 124 | + dest: "{{ auxt_path }}" |
| 125 | + encoding: |
| 126 | + from: UTF-8 |
| 127 | + to: IBM-1047 |
| 128 | + register: result |
| 129 | + retries: 3 |
| 130 | + until: result is not failed |
| 131 | + delay: 5 |
| 132 | + |
| 133 | + - name: Create DFHAUXT data set with warm |
| 134 | + environment: "{{ environment_vars }}" |
| 135 | + ibm.ibm_zos_cics.trace: |
| 136 | + state: "warm" |
| 137 | + register: result |
| 138 | + |
| 139 | + - name: Debug |
| 140 | + ansible.builtin.debug: |
| 141 | + msg: "{{ result }}" |
| 142 | + |
| 143 | + - name: Assert DFHAUXT succeeded |
| 144 | + ansible.builtin.assert: |
| 145 | + that: |
| 146 | + - result.failed is false |
| 147 | + - result.changed is false |
| 148 | + - result.start_state.exists == true |
| 149 | + - result.end_state.exists == true |
| 150 | + |
| 151 | + # ############################################################################# |
| 152 | + # ################################## Cleanup ################################## |
| 153 | + # ############################################################################# |
| 154 | + |
| 155 | + - name: Delete DFHAUXT Data Set |
| 156 | + environment: "{{ environment_vars }}" |
| 157 | + ibm.ibm_zos_core.zos_data_set: |
| 158 | + name: "{{ auxt_path }}" |
| 159 | + state: absent |
| 160 | + register: delete_result |
| 161 | + retries: 3 |
| 162 | + until: delete_result is not failed |
| 163 | + |
| 164 | + - name: Assert Delete Passed |
| 165 | + ansible.builtin.assert: |
| 166 | + that: |
| 167 | + - delete_result.failed == false |
0 commit comments