Use Tempest config

Tempest plugins should use tempest config only. This patch changes code
to read params from tempest config instead of vitrage.

OpenStack clients related code will be fixed in separate patch in scope of
task #27631.

Change-Id: Iaf91a84cbf7667e443ef21f7ed5ee0036afdba57
Story: #2004053
Task: #28634
This commit is contained in:
Ivan Kolodyazhny 2018-12-22 00:23:19 +02:00
parent 40ac8e1712
commit a3771ed121
4 changed files with 45 additions and 25 deletions

View File

@ -13,7 +13,22 @@
# License for the specific language governing permissions and limitations
# under the License.
source $BASE/new/devstack/functions
sudo chown -R $USER:stack $BASE/new/tempest
DEVSTACK_PATH="$BASE/new"
TEMPEST_CONFIG=$BASE/new/tempest/etc/tempest.conf
iniset $TEMPEST_CONFIG service_available vitrage true
if [ "$1" = "mock" ]; then
iniset $TEMPEST_CONFIG root_cause_analysis_service instances_per_host 50
iniset $TEMPEST_CONFIG root_cause_analysis_service snapshots_interval 60
else
iniset $TEMPEST_CONFIG root_cause_analysis_service instances_per_host 2
iniset $TEMPEST_CONFIG root_cause_analysis_service snapshots_interval 120
fi
#Argument is received from Zuul
if [ "$1" = "api" ]; then

View File

@ -15,25 +15,24 @@
from oslo_config import cfg
service_option = cfg.BoolOpt("vitrage",
default=True,
help="Whether or not vitrage is expected to be "
"available")
service_available_group = cfg.OptGroup(name="service_available",
title="Available OpenStack Services")
ServiceAvailableGroup = [cfg.BoolOpt("vitrage",
default=True,
help="Whether or not vitrage is expected "
"to be available")]
rca_service_group = cfg.OptGroup(name="root_cause_analysis_service",
title="Root Cause Analysis Service Options")
RcaServiceGroup = [
# RCA Service tempest configuration
cfg.StrOpt("region",
default="",
help="The application_catalog region name to use. If empty, "
"the value of identity.region is used instead. "
"If no such region is found in the service catalog, "
"the first found one is used."),
cfg.StrOpt("identity_version",
default="v2",
help="Default identity version for "
"REST client authentication.")
cfg.IntOpt('instances_per_host',
default=2,
help="Number of instances per host in mock graph datasource"),
cfg.IntOpt('snapshots_interval',
default=120,
min=10,
help='Time to wait between subsequent datasource snapshots'),
]

View File

@ -17,6 +17,7 @@
import os
# noinspection PyPackageRequirements
from tempest import config
from tempest.test_discover import plugins
from vitrage_tempest_plugin import config as config_rca_service
@ -31,13 +32,15 @@ class VitrageTempestPlugin(plugins.TempestPlugin):
return full_test_dir, base_path
def register_opts(self, conf):
conf.register_opt(config_rca_service.service_option,
group='service_available')
conf.register_group(config_rca_service.rca_service_group)
conf.register_opts(config_rca_service.RcaServiceGroup,
group='root_cause_analysis_service')
config.register_opt_group(conf,
config_rca_service.service_available_group,
config_rca_service.ServiceAvailableGroup)
config.register_opt_group(conf,
config_rca_service.rca_service_group,
config_rca_service.RcaServiceGroup)
def get_opt_lists(self):
return [(config_rca_service.rca_service_group.name,
config_rca_service.RcaServiceGroup),
('service_available', [config_rca_service.service_option])]
(config_rca_service.service_available_group.name,
[config_rca_service.ServiceAvailableGroup])]

View File

@ -16,6 +16,8 @@ from threading import Thread
import time
from oslo_log import log as logging
from tempest import config
from vitrage_tempest_plugin.tests.common.constants import VertexProperties
from vitrage_tempest_plugin.tests.common import general_utils as g_utils
@ -24,6 +26,7 @@ from vitrage_tempest_plugin.tests.common import vitrage_utils as v_utils
from vitrage_tempest_plugin.tests.e2e.test_actions_base import TestActionsBase
from vitrage_tempest_plugin.tests import utils
CONF = config.CONF
LOG = logging.getLogger(__name__)
DEDUCED_1 = 'mock_datasource.3rd_degree_scenarios.deduced.alarm1'
@ -68,7 +71,7 @@ class TestLongProcessing(TestActionsBase):
v_utils.delete_template(name=TEMPLATE_NAME)
# sleep to allow get_all to start and finish at least once:
time.sleep(4 * self.conf.datasources.snapshots_interval)
time.sleep(4 * CONF.root_cause_analysis_service.snapshots_interval)
v_utils.restart_graph()
self.keep_sending_events = False
@ -111,7 +114,7 @@ class TestLongProcessing(TestActionsBase):
topo2 = TempestClients.vitrage().topology.get(all_tenants=True)
self.assert_graph_equal(
topo1, topo2, 'comparing graph items iteration ' + str(i))
time.sleep(self.conf.datasources.snapshots_interval)
time.sleep(CONF.root_cause_analysis_service.snapshots_interval)
v_utils.delete_template(name=TEMPLATE_NAME)
time.sleep(SLEEP)
@ -130,11 +133,11 @@ class TestLongProcessing(TestActionsBase):
alarm_count = TempestClients.vitrage().alarm.count(
all_tenants=True)
self.assertEqual(
self.conf.mock_graph_datasource.instances_per_host,
CONF.root_cause_analysis_service.instances_per_host,
alarm_count['SEVERE'],
'Each instance should have one SEVERE deduced alarm')
self.assertEqual(
self.conf.mock_graph_datasource.instances_per_host,
CONF.root_cause_analysis_service.instances_per_host,
alarm_count['CRITICAL'],
'Each instance should have one CRITICAL deduced alarm')