summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJenkins <jenkins@review.openstack.org>2017-04-11 07:27:54 +0000
committerGerrit Code Review <review@openstack.org>2017-04-11 07:27:54 +0000
commit33713436134915b74ed101027eda18b9887d3f16 (patch)
tree351b1b9da29ad70b3e30adad38b7cefe636d5d2c
parent0cff23d8d1b17feb8fcacc5374a39c5bd2a62912 (diff)
parentd59df5d7bf6c6b272eedc7bd53298d4908581c6f (diff)
Merge "Revert "Remove the tempest plugin""8.0.0.0b1
-rw-r--r--setup.cfg3
-rw-r--r--trove/tests/tempest/__init__.py0
-rw-r--r--trove/tests/tempest/config.py35
-rw-r--r--trove/tests/tempest/plugin.py41
-rw-r--r--trove/tests/tempest/services/__init__.py0
-rw-r--r--trove/tests/tempest/services/database/__init__.py0
-rw-r--r--trove/tests/tempest/services/database/json/__init__.py0
-rw-r--r--trove/tests/tempest/services/database/json/flavors_client.py37
-rw-r--r--trove/tests/tempest/services/database/json/limits_client.py31
-rw-r--r--trove/tests/tempest/services/database/json/versions_client.py37
-rw-r--r--trove/tests/tempest/tests/__init__.py0
-rw-r--r--trove/tests/tempest/tests/api/__init__.py0
-rw-r--r--trove/tests/tempest/tests/api/database/__init__.py0
-rw-r--r--trove/tests/tempest/tests/api/database/base.py74
-rw-r--r--trove/tests/tempest/tests/api/database/flavors/__init__.py0
-rw-r--r--trove/tests/tempest/tests/api/database/flavors/test_flavors.py88
-rw-r--r--trove/tests/tempest/tests/api/database/flavors/test_flavors_negative.py36
-rw-r--r--trove/tests/tempest/tests/api/database/limits/__init__.py0
-rw-r--r--trove/tests/tempest/tests/api/database/limits/test_limits.py47
-rw-r--r--trove/tests/tempest/tests/api/database/versions/__init__.py0
-rw-r--r--trove/tests/tempest/tests/api/database/versions/test_versions.py41
21 files changed, 470 insertions, 0 deletions
diff --git a/setup.cfg b/setup.cfg
index e6c34b2..401df14 100644
--- a/setup.cfg
+++ b/setup.cfg
@@ -50,6 +50,9 @@ oslo.messaging.notify.drivers =
50 trove.openstack.common.notifier.rpc_notifier = oslo_messaging.notify.messaging:MessagingDriver 50 trove.openstack.common.notifier.rpc_notifier = oslo_messaging.notify.messaging:MessagingDriver
51 trove.openstack.common.notifier.test_notifier = oslo_messaging.notify._impl_test:TestDriver 51 trove.openstack.common.notifier.test_notifier = oslo_messaging.notify._impl_test:TestDriver
52 52
53tempest.test_plugins =
54 trove_tests = trove.tests.tempest.plugin:TroveTempestPlugin
55
53[global] 56[global]
54setup-hooks = 57setup-hooks =
55 pbr.hooks.setup_hook 58 pbr.hooks.setup_hook
diff --git a/trove/tests/tempest/__init__.py b/trove/tests/tempest/__init__.py
new file mode 100644
index 0000000..e69de29
--- /dev/null
+++ b/trove/tests/tempest/__init__.py
diff --git a/trove/tests/tempest/config.py b/trove/tests/tempest/config.py
new file mode 100644
index 0000000..0048b7a
--- /dev/null
+++ b/trove/tests/tempest/config.py
@@ -0,0 +1,35 @@
1# Copyright (c) 2016 Hewlett-Packard Development Company, L.P.
2#
3# Licensed under the Apache License, Version 2.0 (the "License"); you may
4# not use this file except in compliance with the License. You may obtain
5# a copy of the License at
6#
7# http://www.apache.org/licenses/LICENSE-2.0
8#
9# Unless required by applicable law or agreed to in writing, software
10# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
11# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
12# License for the specific language governing permissions and limitations
13# under the License.
14
15from oslo_config import cfg
16
17service_option = cfg.BoolOpt('trove',
18 default=True,
19 help="Whether or not Trove is expected to be "
20 "available")
21
22database_group = cfg.OptGroup(name='database',
23 title='Database Service Options')
24
25DatabaseGroup = [
26 cfg.StrOpt('catalog_type',
27 default='database',
28 help="Catalog type of the Database service."),
29 cfg.StrOpt('db_flavor_ref',
30 default="1",
31 help="Valid primary flavor to use in database tests."),
32 cfg.StrOpt('db_current_version',
33 default="v1.0",
34 help="Current database version to use in database tests."),
35]
diff --git a/trove/tests/tempest/plugin.py b/trove/tests/tempest/plugin.py
new file mode 100644
index 0000000..c739b29
--- /dev/null
+++ b/trove/tests/tempest/plugin.py
@@ -0,0 +1,41 @@
1# Copyright (c) 2016 Hewlett-Packard Development Company, L.P.
2# All Rights Reserved.
3#
4# Licensed under the Apache License, Version 2.0 (the "License"); you may
5# not use this file except in compliance with the License. You may obtain
6# a copy of the License at
7#
8# http://www.apache.org/licenses/LICENSE-2.0
9#
10# Unless required by applicable law or agreed to in writing, software
11# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
12# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
13# License for the specific language governing permissions and limitations
14# under the License.
15
16import os
17
18from tempest.test_discover import plugins
19
20from trove.tests.tempest import config as trove_config
21
22
23class TroveTempestPlugin(plugins.TempestPlugin):
24
25 def load_tests(self):
26 base_path = os.path.split(os.path.dirname(
27 os.path.abspath(__file__)))[0]
28 base_path = os.path.dirname(os.path.dirname(base_path))
29 test_dir = "trove/tests/tempest/tests"
30 full_test_dir = os.path.join(base_path, test_dir)
31 return full_test_dir, base_path
32
33 def register_opts(self, conf):
34 conf.register_group(trove_config.database_group)
35 conf.register_opts(trove_config.DatabaseGroup, group='database')
36 conf.register_opt(trove_config.service_option,
37 group='service_available')
38
39 def get_opt_lists(self):
40 return [('database', trove_config.DatabaseGroup),
41 ('service_available', [trove_config.service_option])]
diff --git a/trove/tests/tempest/services/__init__.py b/trove/tests/tempest/services/__init__.py
new file mode 100644
index 0000000..e69de29
--- /dev/null
+++ b/trove/tests/tempest/services/__init__.py
diff --git a/trove/tests/tempest/services/database/__init__.py b/trove/tests/tempest/services/database/__init__.py
new file mode 100644
index 0000000..e69de29
--- /dev/null
+++ b/trove/tests/tempest/services/database/__init__.py
diff --git a/trove/tests/tempest/services/database/json/__init__.py b/trove/tests/tempest/services/database/json/__init__.py
new file mode 100644
index 0000000..e69de29
--- /dev/null
+++ b/trove/tests/tempest/services/database/json/__init__.py
diff --git a/trove/tests/tempest/services/database/json/flavors_client.py b/trove/tests/tempest/services/database/json/flavors_client.py
new file mode 100644
index 0000000..95ecfdc
--- /dev/null
+++ b/trove/tests/tempest/services/database/json/flavors_client.py
@@ -0,0 +1,37 @@
1# Copyright 2014 OpenStack Foundation
2# All Rights Reserved.
3#
4# Licensed under the Apache License, Version 2.0 (the "License"); you may
5# not use this file except in compliance with the License. You may obtain
6# a copy of the License at
7#
8# http://www.apache.org/licenses/LICENSE-2.0
9#
10# Unless required by applicable law or agreed to in writing, software
11# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
12# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
13# License for the specific language governing permissions and limitations
14# under the License.
15
16from oslo_serialization import jsonutils as json
17from six.moves import urllib
18from tempest.lib.common import rest_client
19
20
21class DatabaseFlavorsClient(rest_client.RestClient):
22
23 def list_db_flavors(self, params=None):
24 url = 'flavors'
25 if params:
26 url += '?%s' % urllib.parse.urlencode(params)
27
28 resp, body = self.get(url)
29 self.expected_success(200, resp.status)
30 body = json.loads(body)
31 return rest_client.ResponseBody(resp, body)
32
33 def show_db_flavor(self, db_flavor_id):
34 resp, body = self.get("flavors/%s" % db_flavor_id)
35 self.expected_success(200, resp.status)
36 body = json.loads(body)
37 return rest_client.ResponseBody(resp, body)
diff --git a/trove/tests/tempest/services/database/json/limits_client.py b/trove/tests/tempest/services/database/json/limits_client.py
new file mode 100644
index 0000000..23164a8
--- /dev/null
+++ b/trove/tests/tempest/services/database/json/limits_client.py
@@ -0,0 +1,31 @@
1# Copyright 2014 OpenStack Foundation
2# All Rights Reserved.
3#
4# Licensed under the Apache License, Version 2.0 (the "License"); you may
5# not use this file except in compliance with the License. You may obtain
6# a copy of the License at
7#
8# http://www.apache.org/licenses/LICENSE-2.0
9#
10# Unless required by applicable law or agreed to in writing, software
11# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
12# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
13# License for the specific language governing permissions and limitations
14# under the License.
15
16from oslo_serialization import jsonutils as json
17from six.moves.urllib import parse as urllib
18from tempest.lib.common import rest_client
19
20
21class DatabaseLimitsClient(rest_client.RestClient):
22
23 def list_db_limits(self, params=None):
24 """List all limits."""
25 url = 'limits'
26 if params:
27 url += '?%s' % urllib.urlencode(params)
28 resp, body = self.get(url)
29 self.expected_success(200, resp.status)
30 body = json.loads(body)
31 return rest_client.ResponseBody(resp, body)
diff --git a/trove/tests/tempest/services/database/json/versions_client.py b/trove/tests/tempest/services/database/json/versions_client.py
new file mode 100644
index 0000000..d7154f2
--- /dev/null
+++ b/trove/tests/tempest/services/database/json/versions_client.py
@@ -0,0 +1,37 @@
1# Copyright 2014 OpenStack Foundation
2# All Rights Reserved.
3#
4# Licensed under the Apache License, Version 2.0 (the "License"); you may
5# not use this file except in compliance with the License. You may obtain
6# a copy of the License at
7#
8# http://www.apache.org/licenses/LICENSE-2.0
9#
10# Unless required by applicable law or agreed to in writing, software
11# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
12# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
13# License for the specific language governing permissions and limitations
14# under the License.
15
16from oslo_serialization import jsonutils as json
17from six.moves.urllib import parse as urllib
18from tempest.lib.common import rest_client
19
20
21class DatabaseVersionsClient(rest_client.RestClient):
22
23 def __init__(self, auth_provider, service, region, **kwargs):
24 super(DatabaseVersionsClient, self).__init__(
25 auth_provider, service, region, **kwargs)
26 self.skip_path()
27
28 def list_db_versions(self, params=None):
29 """List all versions."""
30 url = ''
31 if params:
32 url += '?%s' % urllib.urlencode(params)
33
34 resp, body = self.get(url)
35 self.expected_success(200, resp.status)
36 body = json.loads(body)
37 return rest_client.ResponseBody(resp, body)
diff --git a/trove/tests/tempest/tests/__init__.py b/trove/tests/tempest/tests/__init__.py
new file mode 100644
index 0000000..e69de29
--- /dev/null
+++ b/trove/tests/tempest/tests/__init__.py
diff --git a/trove/tests/tempest/tests/api/__init__.py b/trove/tests/tempest/tests/api/__init__.py
new file mode 100644
index 0000000..e69de29
--- /dev/null
+++ b/trove/tests/tempest/tests/api/__init__.py
diff --git a/trove/tests/tempest/tests/api/database/__init__.py b/trove/tests/tempest/tests/api/database/__init__.py
new file mode 100644
index 0000000..e69de29
--- /dev/null
+++ b/trove/tests/tempest/tests/api/database/__init__.py
diff --git a/trove/tests/tempest/tests/api/database/base.py b/trove/tests/tempest/tests/api/database/base.py
new file mode 100644
index 0000000..a0d58bd
--- /dev/null
+++ b/trove/tests/tempest/tests/api/database/base.py
@@ -0,0 +1,74 @@
1# Copyright 2014 OpenStack Foundation
2# All Rights Reserved.
3#
4# Licensed under the Apache License, Version 2.0 (the "License"); you may
5# not use this file except in compliance with the License. You may obtain
6# a copy of the License at
7#
8# http://www.apache.org/licenses/LICENSE-2.0
9#
10# Unless required by applicable law or agreed to in writing, software
11# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
12# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
13# License for the specific language governing permissions and limitations
14# under the License.
15
16from tempest import config
17import tempest.test
18
19from trove.tests.tempest.services.database.json import flavors_client
20from trove.tests.tempest.services.database.json import limits_client
21from trove.tests.tempest.services.database.json import versions_client
22
23
24CONF = config.CONF
25
26
27class BaseDatabaseTest(tempest.test.BaseTestCase):
28 """Base test case class for all Database API tests."""
29
30 credentials = ['primary']
31
32 @classmethod
33 def skip_checks(cls):
34 super(BaseDatabaseTest, cls).skip_checks()
35 if not CONF.service_available.trove:
36 skip_msg = ("%s skipped as trove is not available" % cls.__name__)
37 raise cls.skipException(skip_msg)
38
39 @classmethod
40 def setup_clients(cls):
41 super(BaseDatabaseTest, cls).setup_clients()
42 default_params = config.service_client_config()
43
44 # NOTE: Tempest uses timeout values of compute API if project specific
45 # timeout values don't exist.
46 default_params_with_timeout_values = {
47 'build_interval': CONF.compute.build_interval,
48 'build_timeout': CONF.compute.build_timeout
49 }
50 default_params_with_timeout_values.update(default_params)
51 cls.database_flavors_client = flavors_client.DatabaseFlavorsClient(
52 cls.os.auth_provider,
53 CONF.database.catalog_type,
54 CONF.identity.region,
55 **default_params_with_timeout_values)
56 cls.os_flavors_client = cls.os.flavors_client
57 cls.database_limits_client = limits_client.DatabaseLimitsClient(
58 cls.os.auth_provider,
59 CONF.database.catalog_type,
60 CONF.identity.region,
61 **default_params_with_timeout_values)
62 cls.database_versions_client = versions_client.DatabaseVersionsClient(
63 cls.os.auth_provider,
64 CONF.database.catalog_type,
65 CONF.identity.region,
66 **default_params_with_timeout_values)
67
68 @classmethod
69 def resource_setup(cls):
70 super(BaseDatabaseTest, cls).resource_setup()
71
72 cls.catalog_type = CONF.database.catalog_type
73 cls.db_flavor_ref = CONF.database.db_flavor_ref
74 cls.db_current_version = CONF.database.db_current_version
diff --git a/trove/tests/tempest/tests/api/database/flavors/__init__.py b/trove/tests/tempest/tests/api/database/flavors/__init__.py
new file mode 100644
index 0000000..e69de29
--- /dev/null
+++ b/trove/tests/tempest/tests/api/database/flavors/__init__.py
diff --git a/trove/tests/tempest/tests/api/database/flavors/test_flavors.py b/trove/tests/tempest/tests/api/database/flavors/test_flavors.py
new file mode 100644
index 0000000..43e3909
--- /dev/null
+++ b/trove/tests/tempest/tests/api/database/flavors/test_flavors.py
@@ -0,0 +1,88 @@
1# Copyright 2014 OpenStack Foundation
2# All Rights Reserved.
3#
4# Licensed under the Apache License, Version 2.0 (the "License"); you may
5# not use this file except in compliance with the License. You may obtain
6# a copy of the License at
7#
8# http://www.apache.org/licenses/LICENSE-2.0
9#
10# Unless required by applicable law or agreed to in writing, software
11# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
12# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
13# License for the specific language governing permissions and limitations
14# under the License.
15
16from tempest.lib import decorators
17from tempest import test
18from testtools import testcase as testtools
19
20from trove.tests.tempest.tests.api.database import base
21
22
23class DatabaseFlavorsTest(base.BaseDatabaseTest):
24
25 @classmethod
26 def setup_clients(cls):
27 super(DatabaseFlavorsTest, cls).setup_clients()
28 cls.client = cls.database_flavors_client
29
30 @testtools.attr('smoke')
31 @decorators.idempotent_id('c94b825e-0132-4686-8049-8a4a2bc09525')
32 def test_get_db_flavor(self):
33 # The expected flavor details should be returned
34 flavor = (self.client.show_db_flavor(self.db_flavor_ref)
35 ['flavor'])
36 self.assertEqual(self.db_flavor_ref, str(flavor['id']))
37 self.assertIn('ram', flavor)
38 self.assertIn('links', flavor)
39 self.assertIn('name', flavor)
40
41 @testtools.attr('smoke')
42 @decorators.idempotent_id('685025d6-0cec-4673-8a8d-995cb8e0d3bb')
43 def test_list_db_flavors(self):
44 flavor = (self.client.show_db_flavor(self.db_flavor_ref)
45 ['flavor'])
46 # List of all flavors should contain the expected flavor
47 flavors = self.client.list_db_flavors()['flavors']
48 self.assertIn(flavor, flavors)
49
50 def _check_values(self, names, db_flavor, os_flavor, in_db=True):
51 for name in names:
52 self.assertIn(name, os_flavor)
53 if in_db:
54 self.assertIn(name, db_flavor)
55 self.assertEqual(str(db_flavor[name]), str(os_flavor[name]),
56 "DB flavor differs from OS on '%s' value"
57 % name)
58 else:
59 self.assertNotIn(name, db_flavor)
60
61 @testtools.attr('smoke')
62 @decorators.idempotent_id('afb2667f-4ec2-4925-bcb7-313fdcffb80d')
63 @test.services('compute')
64 def test_compare_db_flavors_with_os(self):
65 db_flavors = self.client.list_db_flavors()['flavors']
66 os_flavors = (self.os_flavors_client.list_flavors(detail=True)
67 ['flavors'])
68 self.assertEqual(len(os_flavors), len(db_flavors),
69 "OS flavors %s do not match DB flavors %s" %
70 (os_flavors, db_flavors))
71 for os_flavor in os_flavors:
72 db_flavor =\
73 self.client.show_db_flavor(os_flavor['id'])['flavor']
74 if db_flavor['id']:
75 self.assertIn('id', db_flavor)
76 self.assertEqual(str(db_flavor['id']), str(os_flavor['id']),
77 "DB flavor id differs from OS flavor id value"
78 )
79 else:
80 self.assertIn('str_id', db_flavor)
81 self.assertEqual(db_flavor['str_id'], str(os_flavor['id']),
82 "DB flavor id differs from OS flavor id value"
83 )
84
85 self._check_values(['name', 'ram', 'vcpus',
86 'disk'], db_flavor, os_flavor)
87 self._check_values(['swap'], db_flavor, os_flavor,
88 in_db=False)
diff --git a/trove/tests/tempest/tests/api/database/flavors/test_flavors_negative.py b/trove/tests/tempest/tests/api/database/flavors/test_flavors_negative.py
new file mode 100644
index 0000000..ad20807
--- /dev/null
+++ b/trove/tests/tempest/tests/api/database/flavors/test_flavors_negative.py
@@ -0,0 +1,36 @@
1# Copyright 2014 OpenStack Foundation
2# All Rights Reserved.
3#
4# Licensed under the Apache License, Version 2.0 (the "License"); you may
5# not use this file except in compliance with the License. You may obtain
6# a copy of the License at
7#
8# http://www.apache.org/licenses/LICENSE-2.0
9#
10# Unless required by applicable law or agreed to in writing, software
11# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
12# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
13# License for the specific language governing permissions and limitations
14# under the License.
15
16
17from tempest.lib import decorators
18from tempest.lib import exceptions as lib_exc
19from testtools import testcase as testtools
20
21from trove.tests.tempest.tests.api.database import base
22
23
24class DatabaseFlavorsNegativeTest(base.BaseDatabaseTest):
25
26 @classmethod
27 def setup_clients(cls):
28 super(DatabaseFlavorsNegativeTest, cls).setup_clients()
29 cls.client = cls.database_flavors_client
30
31 @testtools.attr('negative')
32 @decorators.idempotent_id('f8e7b721-373f-4a64-8e9c-5327e975af3e')
33 def test_get_non_existent_db_flavor(self):
34 # flavor details are not returned for non-existent flavors
35 self.assertRaises(lib_exc.NotFound,
36 self.client.show_db_flavor, -1)
diff --git a/trove/tests/tempest/tests/api/database/limits/__init__.py b/trove/tests/tempest/tests/api/database/limits/__init__.py
new file mode 100644
index 0000000..e69de29
--- /dev/null
+++ b/trove/tests/tempest/tests/api/database/limits/__init__.py
diff --git a/trove/tests/tempest/tests/api/database/limits/test_limits.py b/trove/tests/tempest/tests/api/database/limits/test_limits.py
new file mode 100644
index 0000000..c58ef6b
--- /dev/null
+++ b/trove/tests/tempest/tests/api/database/limits/test_limits.py
@@ -0,0 +1,47 @@
1# Copyright 2014 OpenStack Foundation
2# All Rights Reserved.
3#
4# Licensed under the Apache License, Version 2.0 (the "License"); you may
5# not use this file except in compliance with the License. You may obtain
6# a copy of the License at
7#
8# http://www.apache.org/licenses/LICENSE-2.0
9#
10# Unless required by applicable law or agreed to in writing, software
11# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
12# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
13# License for the specific language governing permissions and limitations
14# under the License.
15
16from tempest.lib import decorators
17from testtools import testcase as testtools
18
19from trove.tests.tempest.tests.api.database import base
20
21
22class DatabaseLimitsTest(base.BaseDatabaseTest):
23
24 @classmethod
25 def resource_setup(cls):
26 super(DatabaseLimitsTest, cls).resource_setup()
27 cls.client = cls.database_limits_client
28
29 @testtools.attr('smoke')
30 @decorators.idempotent_id('73024538-f316-4829-b3e9-b459290e137a')
31 def test_absolute_limits(self):
32 # Test to verify if all absolute limit parameters are
33 # present when verb is ABSOLUTE
34 limits = self.client.list_db_limits()['limits']
35 expected_abs_limits = ['max_backups', 'max_volumes',
36 'max_instances', 'verb']
37 absolute_limit = [l for l in limits
38 if l['verb'] == 'ABSOLUTE']
39 self.assertEqual(1, len(absolute_limit), "One ABSOLUTE limit "
40 "verb is allowed. Fetched %s"
41 % len(absolute_limit))
42 actual_abs_limits = absolute_limit[0].keys()
43 missing_abs_limit = set(expected_abs_limits) - set(actual_abs_limits)
44 self.assertEmpty(missing_abs_limit,
45 "Failed to find the following absolute limit(s)"
46 " in a fetched list: %s" %
47 ', '.join(str(a) for a in missing_abs_limit))
diff --git a/trove/tests/tempest/tests/api/database/versions/__init__.py b/trove/tests/tempest/tests/api/database/versions/__init__.py
new file mode 100644
index 0000000..e69de29
--- /dev/null
+++ b/trove/tests/tempest/tests/api/database/versions/__init__.py
diff --git a/trove/tests/tempest/tests/api/database/versions/test_versions.py b/trove/tests/tempest/tests/api/database/versions/test_versions.py
new file mode 100644
index 0000000..53eb7c3
--- /dev/null
+++ b/trove/tests/tempest/tests/api/database/versions/test_versions.py
@@ -0,0 +1,41 @@
1# Copyright 2014 OpenStack Foundation
2# All Rights Reserved.
3#
4# Licensed under the Apache License, Version 2.0 (the "License"); you may
5# not use this file except in compliance with the License. You may obtain
6# a copy of the License at
7#
8# http://www.apache.org/licenses/LICENSE-2.0
9#
10# Unless required by applicable law or agreed to in writing, software
11# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
12# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
13# License for the specific language governing permissions and limitations
14# under the License.
15
16from tempest.lib import decorators
17from testtools import testcase as testtools
18
19from trove.tests.tempest.tests.api.database import base
20
21
22class DatabaseVersionsTest(base.BaseDatabaseTest):
23
24 @classmethod
25 def setup_clients(cls):
26 super(DatabaseVersionsTest, cls).setup_clients()
27 cls.client = cls.database_versions_client
28
29 @testtools.attr('smoke')
30 @decorators.idempotent_id('6952cd77-90cd-4dca-bb60-8e2c797940cf')
31 def test_list_db_versions(self):
32 versions = self.client.list_db_versions()['versions']
33 self.assertTrue(len(versions) > 0, "No database versions found")
34 # List of all versions should contain the current version, and there
35 # should only be one 'current' version
36 current_versions = list()
37 for version in versions:
38 if 'CURRENT' == version['status']:
39 current_versions.append(version['id'])
40 self.assertEqual(1, len(current_versions))
41 self.assertIn(self.db_current_version, current_versions)