blob: 896043777bd3182b196aef837d3540c76ee63904 [file] [log] [blame]
Peter Stachowski320f9c72014-04-21 16:13:23 -04001# 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.api.database import base
17from tempest import test
18
19
20class DatabaseVersionsTest(base.BaseDatabaseTest):
Peter Stachowski320f9c72014-04-21 16:13:23 -040021
22 @classmethod
Rohan Kanade37497b42015-02-05 13:39:57 +053023 def setup_clients(cls):
24 super(DatabaseVersionsTest, cls).setup_clients()
Peter Stachowski320f9c72014-04-21 16:13:23 -040025 cls.client = cls.database_versions_client
26
27 @test.attr(type='smoke')
28 def test_list_db_versions(self):
David Kranzb728df72015-02-18 13:40:29 -050029 versions = self.client.list_db_versions()
Peter Stachowski320f9c72014-04-21 16:13:23 -040030 self.assertTrue(len(versions) > 0, "No database versions found")
31 # List of all versions should contain the current version, and there
32 # should only be one 'current' version
33 current_versions = list()
34 for version in versions:
35 if 'CURRENT' == version['status']:
36 current_versions.append(version['id'])
37 self.assertEqual(1, len(current_versions))
38 self.assertIn(self.db_current_version, current_versions)