blob: 5b7723d855bf2af5ed9a7b2ab13ee0499dc795e9 [file] [log] [blame]
Chandan Kumar6f67e372016-05-02 10:19:22 +00001# Copyright 2015
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
Chandan Kumar6f67e372016-05-02 10:19:22 +000016import os
17
Chandan Kumar6f67e372016-05-02 10:19:22 +000018from tempest import config
19from tempest.test_discover import plugins
20
Sean McGinniscf556b52018-01-24 15:36:06 -060021from cinder_tempest_plugin import config as project_config
22
Chandan Kumar6f67e372016-05-02 10:19:22 +000023
24class CinderTempestPlugin(plugins.TempestPlugin):
25 def load_tests(self):
Sean McGinniscf556b52018-01-24 15:36:06 -060026 """Provides information to load the plugin tests.
27
28 :return: A tuple with the first value being the test dir and the
29 second being the top level dir.
30 """
Chandan Kumar6f67e372016-05-02 10:19:22 +000031 base_path = os.path.split(os.path.dirname(
Sean McGinniscf556b52018-01-24 15:36:06 -060032 os.path.abspath(__file__)))[0]
Chandan Kumar75511e32018-01-22 12:52:00 +053033 test_dir = "cinder_tempest_plugin"
Chandan Kumar6f67e372016-05-02 10:19:22 +000034 full_test_dir = os.path.join(base_path, test_dir)
35 return full_test_dir, base_path
36
37 def register_opts(self, conf):
Sean McGinniscf556b52018-01-24 15:36:06 -060038 """Adds additional configuration options to tempest.
39
40 This method will be run for the plugin during the register_opts()
41 function in tempest.config
42
43 :param conf: The conf object that can be used to register additional
44 options.
45 """
46 config.register_opt_group(conf, config.volume_feature_group,
47 project_config.cinder_option)
Chandan Kumar6f67e372016-05-02 10:19:22 +000048
49 def get_opt_lists(self):
Sean McGinniscf556b52018-01-24 15:36:06 -060050 """Get a list of options for sample config generation.
51
52 :return: A list of tuples with the group name and options in that
53 group.
54 """
Patrick East9b434d12016-08-12 17:23:19 -070055 return [
Sean McGinniscf556b52018-01-24 15:36:06 -060056 (config.volume_feature_group.name, project_config.cinder_option),
Patrick East9b434d12016-08-12 17:23:19 -070057 ]