Add clients to tempest plugins

Change-Id: I847efff138dc4c3dbae686310221e1dfd0423587
This commit is contained in:
ricolin 2023-03-02 17:47:42 +08:00
parent a00cd2f638
commit 89cba9b96c
4 changed files with 83 additions and 17 deletions

View File

@ -21,12 +21,22 @@ from magnum_tempest_plugin.common import config
class MagnumClient(rest_client.RestClient, metaclass=abc.ABCMeta):
"""Abstract class responsible for setting up auth provider"""
def __init__(self, auth_provider):
def __init__(self, auth_provider, **kwargs):
service = kwargs.pop(
"service"
) if "service" in kwargs else 'container-infra'
region = kwargs.pop(
"region"
) if "region" in kwargs else config.Config.region
disable_validation = kwargs.pop(
"disable_ssl_certificate_validation"
) if "disable_ssl_certificate_validation" in kwargs else True
super(MagnumClient, self).__init__(
auth_provider=auth_provider,
service='container-infra',
region=config.Config.region,
disable_ssl_certificate_validation=True
service=service,
region=region,
disable_ssl_certificate_validation=disable_validation,
**kwargs
)
@classmethod

View File

@ -14,18 +14,30 @@ from oslo_config import cfg
from tempest import config # noqa
service_available_group = cfg.OptGroup(name="service_available",
title="Available OpenStack Services")
magnum_scope_enforcement = cfg.BoolOpt('magnum',
default=False,
help="Does the Magnum service API "
"policies enforce scope? "
"This configuration value should "
"be same as magnum.conf: "
"[oslo_policy].enforce_scope "
"option.")
ServiceAvailableGroup = [
cfg.BoolOpt("magnum",
default=True,
help="Whether or not magnum is expected to be available"),
]
service_option = cfg.BoolOpt(
"magnum", default=True,
help="Whether or not magnum is expected to be available")
magnum_group = cfg.OptGroup(name="magnum", title="Magnum Options")
MagnumGroup = [
cfg.StrOpt("catalog_type",
default="container-infra",
help="Catalog type of the coe service."),
cfg.StrOpt('endpoint_type',
default='publicURL',
choices=['public', 'admin', 'internal',
'publicURL', 'adminURL', 'internalURL'],
help="The endpoint type to use for the coe service."),
cfg.StrOpt("docker_storage_driver",
help="Docker storage driver. Supported: devicemapper, overlay"),
cfg.StrOpt("image_id",

View File

@ -28,14 +28,30 @@ class MagnumTempestPlugin(plugins.TempestPlugin):
return full_test_dir, base_path
def register_opts(self, conf):
config.register_opt_group(
conf, magnum_config.service_available_group,
magnum_config.ServiceAvailableGroup)
config.register_opt_group(conf, magnum_config.magnum_group,
magnum_config.MagnumGroup)
conf.register_opt(magnum_config.service_option,
group='service_available')
conf.register_opt(magnum_config.magnum_scope_enforcement,
group='enforce_scope')
conf.register_group(magnum_config.magnum_group)
conf.register_opts(magnum_config.MagnumGroup, group='magnum')
def get_opt_lists(self):
return [
(magnum_config.magnum_group.name, magnum_config.MagnumGroup),
('service_available', magnum_config.ServiceAvailableGroup)
('service_available', [magnum_config.service_option]),
('enforce_scope', [magnum_config.magnum_scope_enforcement])
]
def get_service_clients(self):
magnum_config = config.service_client_config('magnum')
v1_params = {
'name': 'magnum_v1',
'service_version': 'magnum.v1',
'module_path': 'magnum_tempest_plugin.tests.api.v1.clients',
'client_names': [
'CertClient', 'ClusterTemplateClient',
'ClusterClient', 'MagnumServiceClient'
]
}
v1_params.update(magnum_config)
return [v1_params]

View File

@ -0,0 +1,28 @@
# Licensed under the Apache License, Version 2.0 (the "License"); you may
# not use this file except in compliance with the License. You may obtain
# a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
# License for the specific language governing permissions and limitations
# under the License.
from magnum_tempest_plugin.tests.api.v1.clients.cert_client \
import CertClient
from magnum_tempest_plugin.tests.api.v1.clients.cluster_client \
import ClusterClient
from magnum_tempest_plugin.tests.api.v1.clients.cluster_template_client \
import ClusterTemplateClient
from magnum_tempest_plugin.tests.api.v1.clients.magnum_service_client \
import MagnumServiceClient
__all__ = [
'CertClient',
'ClusterClient',
'ClusterTemplateClient',
'MagnumServiceClient'
]