blob: ae568b1e93a5d89feed53a62afdce04d1a29ae75 [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')
Chris Hoge7579c1a2015-02-26 14:12:15 -080028 @test.idempotent_id('6952cd77-90cd-4dca-bb60-8e2c797940cf')
Peter Stachowski320f9c72014-04-21 16:13:23 -040029 def test_list_db_versions(self):
Anusha Ramineniae4abd12015-08-20 11:24:06 +053030 versions = self.client.list_db_versions()['versions']
Peter Stachowski320f9c72014-04-21 16:13:23 -040031 self.assertTrue(len(versions) > 0, "No database versions found")
32 # List of all versions should contain the current version, and there
33 # should only be one 'current' version
34 current_versions = list()
35 for version in versions:
36 if 'CURRENT' == version['status']:
37 current_versions.append(version['id'])
38 self.assertEqual(1, len(current_versions))
39 self.assertIn(self.db_current_version, current_versions)