6d4d85ab70
Add a new registration interface to service_clients. Add a new optional method to the plugin interface, that exposes the plugin service client registration details. Tests in plugins can initialise service_clients with parmaters common to their service clients and other ones they may need. Parameters specific to their service clients are passed via the registration interface, and can be overwritten at any time by passing extra parameters at client init time. Partially-implements: bp client-manager-refactor Change-Id: I2d99aaa317b0d21c0968dd25b21c4ba9088136fb
68 lines
1.6 KiB
Python
68 lines
1.6 KiB
Python
# Copyright (c) 2015 Deutsche Telekom AG
|
|
# All Rights Reserved.
|
|
#
|
|
# 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 tempest.test_discover import plugins
|
|
|
|
|
|
class FakePlugin(plugins.TempestPlugin):
|
|
expected_load_test = ["my/test/path", "/home/dir"]
|
|
expected_service_clients = [{'foo': 'bar'}]
|
|
|
|
def load_tests(self):
|
|
return self.expected_load_test
|
|
|
|
def register_opts(self, conf):
|
|
return
|
|
|
|
def get_opt_lists(self):
|
|
return []
|
|
|
|
def get_service_clients(self):
|
|
return self.expected_service_clients
|
|
|
|
|
|
class FakeStevedoreObj(object):
|
|
obj = FakePlugin()
|
|
|
|
@property
|
|
def name(self):
|
|
return self._name
|
|
|
|
def __init__(self, name='Test1'):
|
|
self._name = name
|
|
|
|
|
|
class FakePluginNoServiceClients(plugins.TempestPlugin):
|
|
|
|
def load_tests(self):
|
|
return []
|
|
|
|
def register_opts(self, conf):
|
|
return
|
|
|
|
def get_opt_lists(self):
|
|
return []
|
|
|
|
|
|
class FakeStevedoreObjNoServiceClients(object):
|
|
obj = FakePluginNoServiceClients()
|
|
|
|
@property
|
|
def name(self):
|
|
return self._name
|
|
|
|
def __init__(self, name='Test2'):
|
|
self._name = name
|