Peter Stachowski | 320f9c7 | 2014-04-21 16:13:23 -0400 | [diff] [blame] | 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 | from tempest.api.database import base |
| 17 | from tempest import test |
| 18 | |
| 19 | |
| 20 | class DatabaseVersionsTest(base.BaseDatabaseTest): |
| 21 | _interface = 'json' |
| 22 | |
| 23 | @classmethod |
| 24 | def setUpClass(cls): |
| 25 | super(DatabaseVersionsTest, cls).setUpClass() |
| 26 | cls.client = cls.database_versions_client |
| 27 | |
| 28 | @test.attr(type='smoke') |
| 29 | def test_list_db_versions(self): |
Swapnil Kulkarni | 59c7f9b | 2014-08-20 14:55:23 +0000 | [diff] [blame] | 30 | _, versions = self.client.list_db_versions() |
Peter Stachowski | 320f9c7 | 2014-04-21 16:13:23 -0400 | [diff] [blame] | 31 | 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) |