Fixing issues in operator tests

Change-Id: Ie9fa14176e4eee6d13ea575f22de3de1482b0ffb
This commit is contained in:
Anand Shanmugam 2015-09-22 13:48:35 -07:00
parent 0089419c4f
commit ee54aee648
3 changed files with 54 additions and 59 deletions

View File

@ -1,42 +1,38 @@
# Copyright 2010-2011 OpenStack Foundation
# Copyright (c) 2013 Hewlett-Packard Development Company, L.P.
#
# 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.
class openstack_node_obj(object):
def __init__(self, host, ip, user, password, role, name):
self.host = host
self.ip = ip
self.user = user
self.password = password
self.role = role
self.name = name
def getHost(self):
return self.host
def getIp(self):
return self.ip
def getUser(self):
return self.user
def getPassword(self):
return self.password
def getRole(self):
return self.role
def getName(self):
return self.name
# Copyright 2010-2011 OpenStack Foundation
# Copyright (c) 2013 Hewlett-Packard Development Company, L.P.
#
# 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.
class openstack_node_obj(object):
def __init__(self, host, ip, user, role, name):
self.host = host
self.ip = ip
self.user = user
self.role = role
self.name = name
def getHost(self):
return self.host
def getIp(self):
return self.ip
def getUser(self):
return self.user
def getRole(self):
return self.role
def getName(self):
return self.name

View File

@ -40,10 +40,9 @@ class openstack_node_info_reader(object):
ip = self.hostYamlObj[key]["ip"]
hostname = key
username = self.hostYamlObj[key]["user"]
password = self.hostYamlObj[key]["password"]
role = self.hostYamlObj[key]["role"]
node_obj = openstack_node_obj(hostname, ip, username,
password, role, name)
role, name)
openstack_host_list.append(node_obj)
return openstack_host_list

View File

@ -79,13 +79,13 @@ class operator_scenario(base.Scenario):
out = self.ans_runner.execute(cmd)
res, output = self.ans_runner.validate_results(out)
node_status = res['contacted'][res['contacted'].keys()[0]]['stdout']
node_status_string = node_status.replace('\n', '')
mathobj = re.search(
r'running_nodes,(.*?)}', node_status_string, re.M | re.I)
nodes = mathobj.group(1)
if res['status'] is 'PASS':
node_status = res['contacted'][
res['contacted'].keys()[0]]['stdout']
node_status_string = node_status.replace('\n', '')
mathobj = re.search(
r'running_nodes,(.*?)}', node_status_string, re.M | re.I)
nodes = mathobj.group(1)
return (200, "Active Nodes : %s" % nodes,
['RabbitMQ-server Running'])
else:
@ -97,8 +97,9 @@ class operator_scenario(base.Scenario):
self.load()
galera = self.os_node_info_obj.get_galera_details()
cmd = (r"mysql -u %s -e 'SHOW STATUS;'|grep wsrep_incoming_addresses" %
(galera['username']))
cmd = ((r"mysql -u %s -p%s -e 'SHOW STATUS;'|grep "
"wsrep_incoming_addresses") %
(galera['username'], galera['password']))
is_containerized = cfg.CONF.operator_test.containerized
if is_containerized:
@ -108,14 +109,13 @@ class operator_scenario(base.Scenario):
out = self.ans_runner.execute(cmd)
results, failed_hosts = self.ans_runner.validate_results(out)
galera_status = results['contacted'][
results['contacted'].keys()[0]]['stdout']
galera_status_string = galera_status.replace('\n', '')
mathobj = re.search(r'wsrep_incoming_addresses\s+(.*?)$',
galera_status_string, re.M | re.I)
nodes = mathobj.group(1)
if results['status'] is 'PASS':
galera_status = results['contacted'][
results['contacted'].keys()[0]]['stdout']
galera_status_string = galera_status.replace('\n', '')
mathobj = re.search(r'wsrep_incoming_addresses\s+(.*?)$',
galera_status_string, re.M | re.I)
nodes = mathobj.group(1)
return (200, "Active Nodes : %s" % nodes,
['Galera Cluster Test Passed'])
else: