Improve tempest-cleanup ansible role
The patch implements a new flag which will fail a job when any
resources were leaked - that can be used for verification that
tests are cleaning their resources after they are finished.
Change-Id: I212cdce9713c80491153b0bbdb313e75c1f96f1d
diff --git a/roles/tempest-cleanup/README.rst b/roles/tempest-cleanup/README.rst
index 70719ca..d1fad90 100644
--- a/roles/tempest-cleanup/README.rst
+++ b/roles/tempest-cleanup/README.rst
@@ -31,3 +31,31 @@
When true, tempest cleanup creates a report (./dry_run.json) of the
resources that would be cleaned up if the role was ran with dry_run option
set to false.
+
+.. zuul:rolevar:: run_tempest_fail_if_leaked_resources
+ :default: false
+
+ When true, the role will fail if any leaked resources are detected.
+ The detection is done via dry_run.json file which if contains any resources,
+ some must have been leaked. This can be also used to verify that tempest
+ cleanup was successful.
+
+
+Role usage
+----------
+
+The role can be also used for verification that tempest tests don't leak any
+resources or to test that 'tempest cleanup' command deleted all leaked
+resources as expected.
+Either way the role needs to be run first with init_saved_state variable set
+to true prior any tempest tests got executed.
+Then, after tempest tests got executed this role needs to be run again with
+role variables set according to the desired outcome:
+
+1. to verify that tempest tests don't leak any resources
+ run_tempest_dry_cleanup and run_tempest_fail_if_leaked_resources have to
+ be set to true.
+
+2. to check that 'tempest cleanup' command deleted all the leaked resources
+ run_tempest_cleanup and run_tempest_fail_if_leaked_resources have to be set
+ to true.