Martin Kopec | f62dbc1 | 2019-12-12 00:20:41 +0000 | [diff] [blame] | 1 | - when: init_saved_state |
| 2 | block: |
| 3 | - name: Run tempest cleanup init-saved-state |
| 4 | become: yes |
| 5 | become_user: tempest |
Martin Kopec | a857880 | 2020-04-07 08:19:14 +0000 | [diff] [blame] | 6 | command: tox -evenv-tempest -- tempest cleanup --init-saved-state --debug |
Martin Kopec | f62dbc1 | 2019-12-12 00:20:41 +0000 | [diff] [blame] | 7 | args: |
| 8 | chdir: "{{ devstack_base_dir }}/tempest" |
| 9 | |
| 10 | - name: Cat saved_state.json |
| 11 | command: cat "{{ devstack_base_dir }}/tempest/saved_state.json" |
| 12 | |
| 13 | - when: dry_run |
| 14 | block: |
Martin Kopec | 05c35eb | 2020-08-12 09:17:35 +0000 | [diff] [blame] | 15 | - import_tasks: dry_run.yaml |
Martin Kopec | f62dbc1 | 2019-12-12 00:20:41 +0000 | [diff] [blame] | 16 | |
| 17 | - name: Cat dry_run.json |
| 18 | command: cat "{{ devstack_base_dir }}/tempest/dry_run.json" |
| 19 | |
Martin Kopec | 05c35eb | 2020-08-12 09:17:35 +0000 | [diff] [blame] | 20 | - when: |
| 21 | - not dry_run |
| 22 | - not init_saved_state |
| 23 | block: |
| 24 | - name: Run tempest cleanup |
| 25 | become: yes |
| 26 | become_user: tempest |
| 27 | command: tox -evenv-tempest -- tempest cleanup --debug |
| 28 | args: |
| 29 | chdir: "{{ devstack_base_dir }}/tempest" |
| 30 | |
| 31 | - when: |
| 32 | - run_tempest_fail_if_leaked_resources |
| 33 | - not init_saved_state |
| 34 | block: |
| 35 | # let's run dry run again, if haven't already, to check no leftover |
| 36 | # resources were left behind after the cleanup in the previous task |
| 37 | - import_tasks: dry_run.yaml |
| 38 | when: not dry_run |
| 39 | |
| 40 | - name: Fail if any resources are leaked |
| 41 | become: yes |
| 42 | become_user: tempest |
| 43 | shell: | |
| 44 | python3 roles/tempest-cleanup/tasks/dry_run_checker.py --file {{ devstack_base_dir }}/tempest/dry_run.json --is-empty |
| 45 | args: |
| 46 | chdir: "{{ devstack_base_dir }}/tempest" |