Place tempest microversions test module in proper place
Recent update to Tempest plugin was moving existing test modules to different
place. And module 'test_microversions' was missed and not moved.
Change-Id: Id19fdb64f12b59c36118c097e2ca7136646c76b3
Depends-On: Ie9ea9f6d25a13f8cd8f0ccbc73f6fa75cca35e0b
Closes-Bug: #1493009
diff --git a/manila_tempest_tests/config.py b/manila_tempest_tests/config.py
index caa4589..2c5e809 100644
--- a/manila_tempest_tests/config.py
+++ b/manila_tempest_tests/config.py
@@ -36,7 +36,7 @@
help="The minimum api microversion is configured to be the "
"value of the minimum microversion supported by Manila."),
cfg.StrOpt("max_api_microversion",
- default="1.5",
+ default="1.6",
help="The maximum api microversion is configured to be the "
"value of the latest microversion supported by Manila."),
cfg.StrOpt("region",
diff --git a/manila_tempest_tests/tests/api/test_microversions.py b/manila_tempest_tests/tests/api/test_microversions.py
new file mode 100644
index 0000000..2984b04
--- /dev/null
+++ b/manila_tempest_tests/tests/api/test_microversions.py
@@ -0,0 +1,109 @@
+# Copyright 2015 Goutham Pacha Ravi
+# All Rights Reserved.
+#
+# Licensed under the Apache License, Version 2.0 (the "License"); you may
+# not use this file except in compliance with the License. You may obtain
+# a copy of the License at
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
+# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
+# License for the specific language governing permissions and limitations
+# under the License.
+
+from tempest import config
+from tempest import test
+
+from manila_tempest_tests.tests.api import base
+
+CONF = config.CONF
+
+
+class MicroversionsTest(base.BaseSharesTest):
+ """Request and validate REST API Microversions.
+
+ Sends a HTTP GET request with the base endpoint to request a Microversion.
+ """
+
+ _MIN_API_VERSION = CONF.share.min_api_microversion
+ _MAX_API_VERSION = CONF.share.max_api_microversion
+
+ @test.attr(type=["gate", "smoke", ])
+ def test_microversions_no_version(self):
+ resp, resp_body = self.shares_client.send_microversion_request()
+
+ self.assertEqual(self._MIN_API_VERSION,
+ resp[self.shares_client.API_MICROVERSIONS_HEADER])
+ self.assertTrue(len(resp_body['versions']) > 0)
+ self.assertNotIn('min_version', resp_body['versions'][0])
+ self.assertNotIn('version', resp_body['versions'][0])
+
+ @test.attr(type=["gate", "smoke", ])
+ def test_microversions_version_min_version(self):
+ """Requests base version 1.0."""
+
+ resp, resp_body = self.shares_client.send_microversion_request(
+ self._MIN_API_VERSION)
+
+ self.assertEqual(self._MIN_API_VERSION,
+ resp[self.shares_client.API_MICROVERSIONS_HEADER])
+ self.assertTrue(len(resp_body['versions']) > 0)
+ self.assertNotIn('min_version', resp_body['versions'][0])
+ self.assertNotIn('version', resp_body['versions'][0])
+
+ @test.attr(type=["gate", "smoke", ])
+ def test_microversions_version_max_configured_version(self):
+ """Requests maximum API microversion.
+
+ Requests the current maximum API microversion from the Manila API
+ service, and confirms that version is the same as what Tempest is
+ configured to request in other versioned API calls.
+ """
+
+ resp, resp_body = self.shares_client.send_microversion_request(
+ self._MAX_API_VERSION)
+
+ self.assertEqual(self._MAX_API_VERSION,
+ resp[self.shares_client.API_MICROVERSIONS_HEADER])
+ self.assertTrue(len(resp_body['versions']) > 0)
+ self.assertEqual(self._MAX_API_VERSION,
+ resp_body['versions'][0]['version'])
+
+ @test.attr(type=["gate", "smoke", ])
+ def test_microversions_version_1_1(self):
+ """Requests version 1.1, the first Manila microversion."""
+
+ resp, resp_body = self.shares_client.send_microversion_request('1.1')
+
+ self.assertEqual('1.1',
+ resp[self.shares_client.API_MICROVERSIONS_HEADER])
+ self.assertTrue(len(resp_body['versions']) > 0)
+ self.assertEqual(self._MIN_API_VERSION,
+ resp_body['versions'][0]['min_version'])
+
+ @test.attr(type=["gate", "smoke", ])
+ def test_microversions_unavailable_versions(self):
+ """Requests a version greater than the latest available version."""
+
+ resp, resp_body = self.shares_client.send_microversion_request('1.1')
+ self.assertTrue(len(resp_body['versions']) > 0)
+ major_ver, minor_ver = [int(ver) for ver in
+ resp_body['versions'][0]['version'].split(".")]
+ req_version = ('%s.%s' % (major_ver + 1, minor_ver + 1))
+ resp, _ = self.shares_client.send_microversion_request(req_version)
+
+ self.assertEqual(406, resp.status)
+
+ @test.attr(type=["gate", "smoke", ])
+ def test_microversions_invalid_versions(self):
+ """Requests invalid versions."""
+
+ resp, resp_body = self.shares_client.send_microversion_request('1.2.1')
+
+ self.assertEqual(400, resp.status)
+
+ resp, _ = self.shares_client.send_microversion_request('None')
+
+ self.assertEqual(400, resp.status)