Files
Martin Kopec 1a9c40d469 Enable tempest cleanup with record_resources in jobs
This enables tempest cleanup with record_resources in the tempest-all job
to create a list of all the resources created during the tempest run.
Then the list will be used to run 'tempest cleanup' to clean only
the resources in the list.

Also, enable the dry cleanup with record_resources in tempest-extra-tests
job.

Change-Id: Ia64a1c09d4b5e9815ff5926161d550b56433ec64
2024-05-20 13:05:15 +00:00

70 lines
2.2 KiB
YAML

- when: init_saved_state
block:
- name: Run tempest cleanup init-saved-state
become: yes
become_user: tempest
command: tox -evenv-tempest -- tempest cleanup --init-saved-state --debug
args:
chdir: "{{ devstack_base_dir }}/tempest"
- name: Cat saved_state.json
command: cat "{{ devstack_base_dir }}/tempest/saved_state.json"
- when: dry_run
block:
- import_tasks: dry_run.yaml
- name: Cat dry_run.json
command: cat "{{ devstack_base_dir }}/tempest/dry_run.json"
- when:
- not dry_run
- not init_saved_state
block:
- name: Run tempest cleanup
become: yes
become_user: tempest
command: tox -evenv-tempest -- tempest cleanup --debug
args:
chdir: "{{ devstack_base_dir }}/tempest"
when:
- not run_tempest_cleanup_prefix
- run_tempest_cleanup_resource_list is not defined or not run_tempest_cleanup_resource_list
- name: Run tempest cleanup with tempest prefix
become: yes
become_user: tempest
command: tox -evenv-tempest -- tempest cleanup --debug --prefix tempest
args:
chdir: "{{ devstack_base_dir }}/tempest"
when: run_tempest_cleanup_prefix
- name: Cat resource_list.json
command: cat "{{ devstack_base_dir }}/tempest/resource_list.json"
when: run_tempest_cleanup_resource_list
- name: Run tempest cleanup with tempest resource list
become: yes
become_user: tempest
command: tox -evenv-tempest -- tempest cleanup --debug --resource-list
args:
chdir: "{{ devstack_base_dir }}/tempest"
when: run_tempest_cleanup_resource_list
- when:
- run_tempest_fail_if_leaked_resources
- not init_saved_state
block:
# let's run dry run again, if haven't already, to check no leftover
# resources were left behind after the cleanup in the previous task
- import_tasks: dry_run.yaml
when: not dry_run
- name: Fail if any resources are leaked
become: yes
become_user: tempest
shell: |
python3 roles/tempest-cleanup/tasks/dry_run_checker.py --file {{ devstack_base_dir }}/tempest/dry_run.json --is-empty
args:
chdir: "{{ devstack_base_dir }}/tempest"