Stabilizing “PTR record” tests suite and adding new test cases
Stabilizing
1) The same TLD is used by default for all tests
2) Adding waiters for set/unset PTR records
New test cases
1) test_show_floatingip_ptr_impersonate_another_project
2) test_list_floatingip_ptr_all_projects
3) test_set_floatingip_ptr_not_existing_fip_id
4) test_set_floatingip_ptr_huge_size_description
5) test_set_floatingip_ptr_invalid_name
Note:
This tests also includes refactoring of the existing tests.
Negative logic is now removed from positive test cases and
implemented separatly in DesignatePtrRecordNegative class.
Change-Id: I64483c3d8e1ae44db7712b3e463ae4ea239a613a
diff --git a/designate_tempest_plugin/data_utils.py b/designate_tempest_plugin/data_utils.py
index 2f61d97..98db929 100644
--- a/designate_tempest_plugin/data_utils.py
+++ b/designate_tempest_plugin/data_utils.py
@@ -12,6 +12,7 @@
# License for the specific language governing permissions and limitations
# under the License.
import random
+from string import ascii_lowercase
import netaddr
from oslo_log import log as logging
@@ -34,7 +35,7 @@
return an.format(netaddr.ipv6_compact)
-def rand_zone_name(name='', prefix=None, suffix='.com.'):
+def rand_zone_name(name='', prefix='rand', suffix='.com.'):
"""Generate a random zone name
:param str name: The name that you want to include
:param prefix: the exact text to start the string. Defaults to "rand"
@@ -259,3 +260,22 @@
func = globals()["rand_{}_recordset".format(record_type.lower())]
return func(zone_name)
+
+
+def rand_string(size):
+ """Create random string of ASCII chars by size
+
+ :param int size - length os the string to be create
+ :return - random creates string of ASCII lover characters
+ """
+ return ''.join(random.choice(ascii_lowercase) for _ in range(size))
+
+
+def rand_domain_name(tld=None):
+ """Create random valid domain name
+
+ :param tld (optional) - TLD that will be used to random domain name
+ :return - valid domain name, for example: paka.zbabun.iuh
+ """
+ domain_tld = tld or rand_string(3)
+ return rand_string(4) + '.' + rand_string(6) + '.' + domain_tld + '.'