Kiall Mac Innes | 25fb29e | 2016-04-07 08:07:04 +0100 | [diff] [blame] | 1 | # Copyright 2016 NEC Corporation. All rights reserved. |
| 2 | # |
| 3 | # Licensed under the Apache License, Version 2.0 (the "License"); you may |
| 4 | # not use this file except in compliance with the License. You may obtain |
| 5 | # a copy of the License at |
| 6 | # |
| 7 | # http://www.apache.org/licenses/LICENSE-2.0 |
| 8 | # |
| 9 | # Unless required by applicable law or agreed to in writing, software |
| 10 | # distributed under the License is distributed on an "AS IS" BASIS, WITHOUT |
| 11 | # WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the |
| 12 | # License for the specific language governing permissions and limitations |
| 13 | # under the License. |
| 14 | |
| 15 | import os |
| 16 | |
| 17 | from tempest import config |
| 18 | from tempest.test_discover import plugins |
| 19 | |
| 20 | from designate_tempest_plugin import config as project_config |
| 21 | |
| 22 | |
| 23 | class DesignateTempestPlugin(plugins.TempestPlugin): |
| 24 | """ |
| 25 | A DesignateTempestPlugin class provides the basic hooks for an external |
| 26 | plugin to provide tempest the necessary information to run the plugin. |
| 27 | """ |
| 28 | def load_tests(self): |
| 29 | """ |
| 30 | Method to return the information necessary to load the tests in the |
| 31 | plugin. |
| 32 | |
| 33 | :return: a tuple with the first value being the test_dir and the second |
| 34 | being the top_level |
| 35 | :return type: tuple |
| 36 | """ |
| 37 | base_path = os.path.split(os.path.dirname( |
| 38 | os.path.abspath(__file__)))[0] |
| 39 | test_dir = "designate_tempest_plugin/tests" |
| 40 | full_test_dir = os.path.join(base_path, test_dir) |
| 41 | return full_test_dir, base_path |
| 42 | |
| 43 | def register_opts(self, conf): |
| 44 | """ |
| 45 | Add additional configuration options to tempest. |
| 46 | |
| 47 | This method will be run for the plugin during the register_opts() |
| 48 | function in tempest.config |
| 49 | |
| 50 | Parameters: |
| 51 | conf (ConfigOpts): The conf object that can be used to register |
| 52 | additional options on. |
| 53 | """ |
Kiall Mac Innes | 8ae796c | 2016-04-21 13:47:25 +0100 | [diff] [blame] | 54 | config.register_opt_group(conf, project_config.service_available_group, |
| 55 | project_config.ServiceAvailableGroup) |
Kiall Mac Innes | 25fb29e | 2016-04-07 08:07:04 +0100 | [diff] [blame] | 56 | config.register_opt_group(conf, project_config.dns_group, |
| 57 | project_config.DnsGroup) |
Kiall Mac Innes | 8ae796c | 2016-04-21 13:47:25 +0100 | [diff] [blame] | 58 | config.register_opt_group(conf, project_config.dns_feature_group, |
| 59 | project_config.DnsFeatureGroup) |
Kiall Mac Innes | 25fb29e | 2016-04-07 08:07:04 +0100 | [diff] [blame] | 60 | |
| 61 | def get_opt_lists(self): |
| 62 | """ |
| 63 | Get a list of options for sample config generation |
| 64 | |
| 65 | Return option_list: A list of tuples with the group name |
| 66 | and options in that group. |
| 67 | Return type: list |
| 68 | """ |
Kiall Mac Innes | 8ae796c | 2016-04-21 13:47:25 +0100 | [diff] [blame] | 69 | return [ |
| 70 | (project_config.service_available_group.name, |
| 71 | project_config.ServiceAvailableGroup), |
| 72 | (project_config.dns_group.name, |
| 73 | project_config.DnsGroup), |
| 74 | (project_config.dns_feature_group.name, |
| 75 | project_config.DnsFeatureGroup), |
| 76 | ] |