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): |
Peter Stachowski | 320f9c7 | 2014-04-21 16:13:23 -0400 | [diff] [blame] | 21 | |
| 22 | @classmethod |
Rohan Kanade | 37497b4 | 2015-02-05 13:39:57 +0530 | [diff] [blame] | 23 | def setup_clients(cls): |
| 24 | super(DatabaseVersionsTest, cls).setup_clients() |
Peter Stachowski | 320f9c7 | 2014-04-21 16:13:23 -0400 | [diff] [blame] | 25 | cls.client = cls.database_versions_client |
| 26 | |
| 27 | @test.attr(type='smoke') |
Chris Hoge | 7579c1a | 2015-02-26 14:12:15 -0800 | [diff] [blame] | 28 | @test.idempotent_id('6952cd77-90cd-4dca-bb60-8e2c797940cf') |
Peter Stachowski | 320f9c7 | 2014-04-21 16:13:23 -0400 | [diff] [blame] | 29 | def test_list_db_versions(self): |
Anusha Ramineni | ae4abd1 | 2015-08-20 11:24:06 +0530 | [diff] [blame^] | 30 | versions = self.client.list_db_versions()['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) |