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
diff --git a/roles/tempest-cleanup/tasks/main.yaml b/roles/tempest-cleanup/tasks/main.yaml
index 7ef4928..1e1c1a7 100644
--- a/roles/tempest-cleanup/tasks/main.yaml
+++ b/roles/tempest-cleanup/tasks/main.yaml
@@ -27,7 +27,9 @@
command: tox -evenv-tempest -- tempest cleanup --debug
args:
chdir: "{{ devstack_base_dir }}/tempest"
- when: not run_tempest_cleanup_prefix
+ 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
@@ -37,6 +39,18 @@
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