| Martin Kopec | f62dbc1 | 2019-12-12 00:20:41 +0000 | [diff] [blame] | 1 | Tempest cleanup | 
|  | 2 | =============== | 
|  | 3 |  | 
|  | 4 | Documentation regarding tempest cleanup can be found at the following | 
|  | 5 | link: | 
|  | 6 | https://docs.openstack.org/tempest/latest/cleanup.html | 
|  | 7 |  | 
|  | 8 | When init_saved_state and dry_run variables are set to false, the role | 
|  | 9 | execution will run tempest cleanup which deletes resources not present in the | 
|  | 10 | saved_state.json file. | 
|  | 11 |  | 
|  | 12 | **Role Variables** | 
|  | 13 |  | 
|  | 14 | .. zuul:rolevar:: devstack_base_dir | 
|  | 15 | :default: /opt/stack | 
|  | 16 |  | 
|  | 17 | The devstack base directory. | 
|  | 18 |  | 
|  | 19 | .. zuul:rolevar:: init_saved_state | 
|  | 20 | :default: false | 
|  | 21 |  | 
|  | 22 | When true, tempest cleanup --init-saved-state will be executed which | 
|  | 23 | initializes the saved state of the OpenStack deployment and will output | 
|  | 24 | a saved_state.json file containing resources from the deployment that will | 
|  | 25 | be preserved from the cleanup command. This should be done prior to running | 
|  | 26 | Tempest tests. | 
|  | 27 |  | 
|  | 28 | .. zuul:rolevar:: dry_run | 
|  | 29 | :default: false | 
|  | 30 |  | 
|  | 31 | When true, tempest cleanup creates a report (./dry_run.json) of the | 
|  | 32 | resources that would be cleaned up if the role was ran with dry_run option | 
|  | 33 | set to false. | 
| Martin Kopec | 05c35eb | 2020-08-12 09:17:35 +0000 | [diff] [blame] | 34 |  | 
|  | 35 | .. zuul:rolevar:: run_tempest_fail_if_leaked_resources | 
|  | 36 | :default: false | 
|  | 37 |  | 
|  | 38 | When true, the role will fail if any leaked resources are detected. | 
|  | 39 | The detection is done via dry_run.json file which if contains any resources, | 
|  | 40 | some must have been leaked. This can be also used to verify that tempest | 
|  | 41 | cleanup was successful. | 
|  | 42 |  | 
| Luigi Dino Tamagnone | 9052dfc | 2023-04-09 15:24:45 +0000 | [diff] [blame] | 43 | .. zuul:rolevar:: run_tempest_cleanup_prefix | 
|  | 44 | :default: false | 
|  | 45 |  | 
|  | 46 | When true, tempest cleanup will be called with '--prefix tempest' to delete | 
|  | 47 | only resources with names that match the prefix. This option can be used | 
|  | 48 | together with dry_run. | 
| Martin Kopec | 05c35eb | 2020-08-12 09:17:35 +0000 | [diff] [blame] | 49 |  | 
| Martin Kopec | 1a9c40d | 2024-05-09 13:30:43 +0200 | [diff] [blame] | 50 | .. zuul:rolevar:: run_tempest_cleanup_resource_list | 
|  | 51 | :default: false | 
|  | 52 |  | 
|  | 53 | When true, tempest cleanup will be called with '--resource-list' to delete | 
|  | 54 | only resources listed in ./resource_list.json that is created if | 
|  | 55 | record_resources config option in the default section of tempest.conf file | 
|  | 56 | is enabled (set to True). The resource_list.json contains all resources | 
|  | 57 | created by Tempest during a Tempest run. | 
|  | 58 |  | 
| Martin Kopec | 05c35eb | 2020-08-12 09:17:35 +0000 | [diff] [blame] | 59 | Role usage | 
|  | 60 | ---------- | 
|  | 61 |  | 
|  | 62 | The role can be also used for verification that tempest tests don't leak any | 
|  | 63 | resources or to test that 'tempest cleanup' command deleted all leaked | 
|  | 64 | resources as expected. | 
|  | 65 | Either way the role needs to be run first with init_saved_state variable set | 
|  | 66 | to true prior any tempest tests got executed. | 
|  | 67 | Then, after tempest tests got executed this role needs to be run again with | 
|  | 68 | role variables set according to the desired outcome: | 
|  | 69 |  | 
|  | 70 | 1. to verify that tempest tests don't leak any resources | 
|  | 71 | run_tempest_dry_cleanup and run_tempest_fail_if_leaked_resources have to | 
|  | 72 | be set to true. | 
|  | 73 |  | 
|  | 74 | 2. to check that 'tempest cleanup' command deleted all the leaked resources | 
|  | 75 | run_tempest_cleanup and run_tempest_fail_if_leaked_resources have to be set | 
|  | 76 | to true. |