Mehdi Abaakouk | b64d2b0 | 2018-09-03 11:50:49 +0200 | [diff] [blame] | 1 | # Licensed under the Apache License, Version 2.0 (the "License"); you may |
| 2 | # not use this file except in compliance with the License. You may obtain |
| 3 | # a copy of the License at |
| 4 | # |
| 5 | # http://www.apache.org/licenses/LICENSE-2.0 |
| 6 | # |
| 7 | # Unless required by applicable law or agreed to in writing, software |
| 8 | # distributed under the License is distributed on an "AS IS" BASIS, WITHOUT |
| 9 | # WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the |
| 10 | # License for the specific language governing permissions and limitations |
| 11 | # under the License. |
| 12 | |
| 13 | from __future__ import absolute_import |
| 14 | |
| 15 | import os |
| 16 | |
| 17 | from tempest import config |
| 18 | import tempest.test |
| 19 | |
| 20 | from telemetry_tempest_plugin.scenario import utils |
| 21 | |
| 22 | CONF = config.CONF |
| 23 | |
| 24 | TEST_DIR = os.path.join(os.path.dirname(__file__), 'gnocchi_gabbits') |
| 25 | |
| 26 | |
| 27 | class GnocchiGabbiTest(tempest.test.BaseTestCase): |
| 28 | credentials = ['admin'] |
| 29 | |
| 30 | TIMEOUT_SCALING_FACTOR = 5 |
| 31 | |
| 32 | @classmethod |
| 33 | def skip_checks(cls): |
| 34 | super(GnocchiGabbiTest, cls).skip_checks() |
| 35 | if not CONF.service_available.gnocchi: |
| 36 | raise cls.skipException("Gnocchi support is required") |
| 37 | |
| 38 | def _prep_test(self, filename): |
| 39 | token = self.os_admin.auth_provider.get_token() |
| 40 | url = self.os_admin.auth_provider.base_url( |
| 41 | {'service': CONF.metric.catalog_type, |
| 42 | 'endpoint_type': CONF.metric.endpoint_type, |
| 43 | 'region': CONF.identity.region}) |
| 44 | |
| 45 | os.environ.update({ |
| 46 | "GNOCCHI_SERVICE_URL": url, |
| 47 | "GNOCCHI_SERVICE_TOKEN": token, |
| 48 | "GNOCCHI_AUTHORIZATION": "not used", |
| 49 | }) |
| 50 | |
| 51 | |
| 52 | utils.generate_tests(GnocchiGabbiTest, TEST_DIR) |