Add API version check capabilities
This patch adds a method that allows us to get the current Designate API version under test for use in test classes to skip tests against new features introduced in a specific API version.
This patch also centralizes the "primary" zones client to be instantiated once and updates the tests to use a standardized name for the client.
Finally, it adds a missing requirement of oslo.serialization to requirements.txt.
Change-Id: I240911c0ab9b9bad7851268865d6a8e867627673
diff --git a/designate_tempest_plugin/tests/base.py b/designate_tempest_plugin/tests/base.py
index 24156d8..26f1f03 100644
--- a/designate_tempest_plugin/tests/base.py
+++ b/designate_tempest_plugin/tests/base.py
@@ -103,6 +103,17 @@
build_interval=CONF.dns.build_interval,
build_timeout=CONF.dns.build_timeout,
)
+ # Most tests need a "primary" zones client and we need it for the
+ # API version check, so create one instance here.
+ cls.zones_client = cls.os_primary.dns_v2.ZonesClient()
+
+ @classmethod
+ def resource_setup(cls):
+ """Setup resources needed by the tests."""
+ super(BaseDnsTest, cls).resource_setup()
+
+ # The credential does not matter here.
+ cls.api_version = cls.zones_client.get_max_api_version()
def assertExpected(self, expected, actual, excluded_keys):
for key, value in expected.items():