Skip tests for production environment

Allow tests for production in cases:
- Tests that do CRUD for tlds
    * pre-created testing TLDs

- Tests that use TLDs for creating zones
    * list of TLDs is empty
    * pre-created testing TLDs

Related-Prod: PRODX-29973
Change-Id: Ifcaa5115ad4e279ad70e7feb44b82a34e10d2a71
diff --git a/designate_tempest_plugin/tests/base.py b/designate_tempest_plugin/tests/base.py
index 7a34419..3cbd4ca 100644
--- a/designate_tempest_plugin/tests/base.py
+++ b/designate_tempest_plugin/tests/base.py
@@ -197,6 +197,18 @@
             skip_msg = ("%s skipped as designate v2 API is not available"
                         % cls.__name__)
             raise cls.skipException(skip_msg)
+        # Allow testing for production env in cases:
+        # Tests that do CRUD for tlds:
+        #    - env has pre-created testing TLDs
+        # Tests that use TLDs for creating zones:
+        #    - env has empty list of TLDs
+        #    - env has pre-created testing TLDs
+        if CONF.production:
+            if CONF.dns.existing_tlds and not set([CONF.dns.tld_suffix,
+                    "arpa", "in-addr.arpa"]).issubset(CONF.dns.existing_tlds):
+                raise cls.skipException(
+                    "Skip on production environment because it doesn't "
+                    "match TLD configuration.")
 
 
 class BaseDnsAdminTest(BaseDnsTest):