Exclude sidecar containers from the comparison of running containers
Both tobiko sanity and faults tests compare the running containers at some moment with the list of running containers that was obtained when tobiko tests started. The sidecar containers have to be excluded from this comparison, because they do not exist until resources are created. Change-Id: I13c202bd5701b0899c1b0975ac842671c6c79883
This commit is contained in:
parent
35083361eb
commit
874a41caa7
@ -587,21 +587,26 @@ pcs_resource_list = ['haproxy', 'galera', 'redis', 'ovn-dbs', 'cinder',
|
|||||||
'rabbitmq', 'manila', 'ceph', 'pacemaker']
|
'rabbitmq', 'manila', 'ceph', 'pacemaker']
|
||||||
|
|
||||||
|
|
||||||
def remove_containers_if_pacemaker_resources(comparable_containers_df):
|
sidecar_container_list = [
|
||||||
"""remove any containers in
|
'neutron-haproxy-ovnmeta', 'neutron-haproxy-qrouter',
|
||||||
param: comparable_containers_df that are pacemaker resources
|
'neutron-dnsmasq-qdhcp', 'neutron-keepalived-qrouter']
|
||||||
i.e if they contain tha names of resources defined in
|
|
||||||
pcs_resources_list"""
|
|
||||||
|
|
||||||
|
|
||||||
|
def remove_containers_from_comparison(comparable_containers_df):
|
||||||
|
"""remove any containers if comparing them with previous status is not
|
||||||
|
necessary or makes no sense
|
||||||
|
"""
|
||||||
|
ignore_containers_list = pcs_resource_list + sidecar_container_list
|
||||||
for row in comparable_containers_df.iterrows():
|
for row in comparable_containers_df.iterrows():
|
||||||
for pcs_resource in pcs_resource_list:
|
for ignore_container in ignore_containers_list:
|
||||||
if pcs_resource in str(row):
|
if ignore_container in str(row):
|
||||||
LOG.info(f'pcs resource {pcs_resource} has changed state, '
|
LOG.info(f'container {ignore_container} has changed state, '
|
||||||
f'but that\'s ok since pcs resources can change '
|
'but that\'s ok - it will be ignored and the test '
|
||||||
f'state/host: {str(row)}')
|
f'will not fail due to this: {str(row)}')
|
||||||
# if a pcs resource is found , we drop that row
|
# if a pcs resource is found , we drop that row
|
||||||
comparable_containers_df.drop(row[0], inplace=True)
|
comparable_containers_df.drop(row[0], inplace=True)
|
||||||
return comparable_containers_df
|
# this row was already dropped, go to next row
|
||||||
|
break
|
||||||
|
|
||||||
|
|
||||||
def dataframe_difference(df1, df2, which=None):
|
def dataframe_difference(df1, df2, which=None):
|
||||||
@ -616,10 +621,12 @@ def dataframe_difference(df1, df2, which=None):
|
|||||||
else:
|
else:
|
||||||
diff_df = comparison_df[comparison_df['same_state'] == which]
|
diff_df = comparison_df[comparison_df['same_state'] == which]
|
||||||
|
|
||||||
# if the list of diffrent state container are pacemaker resources ignore
|
# if the list of different state containers includes sidecar containers,
|
||||||
# the error since we are checking pacemaker also.
|
# ignore them because the existence of these containers depends on the
|
||||||
|
# created resources
|
||||||
remove_containers_if_pacemaker_resources(diff_df)
|
# if the list of different state containers includes pacemaker resources,
|
||||||
|
# ignore them since the sanity and fault tests check pacemaker status too
|
||||||
|
remove_containers_from_comparison(diff_df)
|
||||||
|
|
||||||
return diff_df
|
return diff_df
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user