From 17053d69e57d0131e795ba6f35c6ed7d77ba8bcf Mon Sep 17 00:00:00 2001 From: Luigi Dino Tamagnone Date: Tue, 3 Oct 2023 14:05:25 +0000 Subject: [PATCH] Adding tempest prefix option in tempest.conf Adding a new config option in tempest.conf as the prefix for the random name resources with this new option all the resources created by tempest will have the prefix defined by resource_name_prefix option in tempest.conf. If not defined the default is tempest. Tempest cleanup CLI will then use this config option to cleanup only the resources that match the prefix. Make sure this prefix does not match with the resource name you do not want Tempest cleanup CLI to delete. This is a patch created after the conversation on https://review.opendev.org/c/openstack/tempest/+/879923?tab=comments Related-Bug: #1945082 Change-Id: I663a6307a5aa63299d20a304188efe6d29aea9d3 --- ...rce_name_prefix-config-option-26e0b7cfeffc48f9.yaml | 10 ++++++++++ tempest/config.py | 7 +++++++ 2 files changed, 17 insertions(+) create mode 100644 releasenotes/notes/Add-resource_name_prefix-config-option-26e0b7cfeffc48f9.yaml diff --git a/releasenotes/notes/Add-resource_name_prefix-config-option-26e0b7cfeffc48f9.yaml b/releasenotes/notes/Add-resource_name_prefix-config-option-26e0b7cfeffc48f9.yaml new file mode 100644 index 0000000000..0824c66ea0 --- /dev/null +++ b/releasenotes/notes/Add-resource_name_prefix-config-option-26e0b7cfeffc48f9.yaml @@ -0,0 +1,10 @@ +--- +features: + - | + A new config option in the default section, resource_name_prefix, + is added to allow users to customize the name (specifically the prefix) + of the resources created by Tempest during a test run. By default it is + set to tempest. + Tempest cleanup CLI will then use this config option to cleanup only the + resources that match the prefix. Make sure this prefix does not match with + the resource name you do not want Tempest cleanup CLI to delete. diff --git a/tempest/config.py b/tempest/config.py index 7978755aea..699e271496 100644 --- a/tempest/config.py +++ b/tempest/config.py @@ -1350,6 +1350,13 @@ A test can be run as follows: $ stestr run --pdb TEST_ID or $ python -m testtools.run TEST_ID"""), + cfg.StrOpt('resource_name_prefix', + default='tempest', + help="Define the prefix name for the resources created by " + "tempest. Tempest cleanup CLI will use this config option " + "to cleanup only the resources that match the prefix. " + "Make sure this prefix does not match with the resource " + "name you do not want Tempest cleanup CLI to delete."), ] _opts = [