1
0
mirror of https://github.com/samba-team/samba.git synced 2024-12-22 13:34:15 +03:00

KCC: attempt to use correct verification tests for graphs

Before they were liberally assigned because the failures were as
interesting as the passes.

Also add a stub for the forest_of_rings test.

Signed-off-by: Douglas Bagnall <douglas.bagnall@catalyst.net.nz>
Reviewed-by: Garming Sam <garming@catalyst.net.nz>
Reviewed-by: Andrew Bartlett <abartlet@samba.org>
This commit is contained in:
Douglas Bagnall 2015-03-18 11:33:53 +13:00 committed by Andrew Bartlett
parent c35ba6f349
commit d68387774d
2 changed files with 8 additions and 7 deletions

View File

@ -2476,6 +2476,10 @@ def verify_graph_multi_edge_forest(edges, vertices, edge_vertices):
return return
def verify_graph_forest_of_rings(edges, vertices, edge_vertices):
"""The graph should consist of clusters of node connected in rings,
with the connections between the cdlusters forming a forest."""
pass
def verify_graph_no_lonely_vertices(edges, vertices, edge_vertices): def verify_graph_no_lonely_vertices(edges, vertices, edge_vertices):

View File

@ -1707,8 +1707,6 @@ class KCC(object):
for a, b in itertools.chain(*(itertools.combinations(edge.vertices, 2) for a, b in itertools.chain(*(itertools.combinations(edge.vertices, 2)
for edge in e_set.edges))] for edge in e_set.edges))]
graph_nodes = [v.site.site_dnstr for v in graph.vertices] graph_nodes = [v.site.site_dnstr for v in graph.vertices]
verify_properties = ('complete', 'connected', 'multi_edge_forest', 'forest',
'directed_double_ring')
if opts.dot_files: if opts.dot_files:
write_dot_file('edgeset_%s' % (edgeType,), graph_edges, vertices=graph_nodes, write_dot_file('edgeset_%s' % (edgeType,), graph_edges, vertices=graph_nodes,
@ -1716,7 +1714,7 @@ class KCC(object):
if opts.verify: if opts.verify:
verify_graph('spanning tree edge set %s' % edgeType, graph_edges, vertices=graph_nodes, verify_graph('spanning tree edge set %s' % edgeType, graph_edges, vertices=graph_nodes,
properties=verify_properties, debug=DEBUG) properties=('complete', 'connected'), debug=DEBUG)
# Run dijkstra's algorithm with just the red vertices as seeds # Run dijkstra's algorithm with just the red vertices as seeds
# Seed from the full replicas # Seed from the full replicas
@ -1739,8 +1737,7 @@ class KCC(object):
if opts.verify or opts.dot_files: if opts.verify or opts.dot_files:
graph_edges = [(e.v1.site.site_dnstr, e.v2.site.site_dnstr) for e in internal_edges] graph_edges = [(e.v1.site.site_dnstr, e.v2.site.site_dnstr) for e in internal_edges]
graph_nodes = [v.site.site_dnstr for v in graph.vertices] graph_nodes = [v.site.site_dnstr for v in graph.vertices]
verify_properties = ('complete', 'connected', 'multi_edge_forest', 'forest', verify_properties = ('multi_edge_forest',)
'directed_double_ring')
verify_and_dot('prekruskal', graph_edges, graph_nodes, label=label, verify_and_dot('prekruskal', graph_edges, graph_nodes, label=label,
properties=verify_properties, debug=DEBUG, verify=opts.verify, properties=verify_properties, debug=DEBUG, verify=opts.verify,
dot_files=opts.dot_files) dot_files=opts.dot_files)
@ -2255,7 +2252,7 @@ class KCC(object):
dot_edges.append((v2, v1.dsa_dnstr)) dot_edges.append((v2, v1.dsa_dnstr))
dot_vertices.add(v2) dot_vertices.add(v2)
verify_properties = ('complete', 'connected', 'multi_edge_forest', 'forest', 'directed_double_ring') verify_properties = ('connected', 'directed_double_ring')
verify_and_dot('intrasite_post_ntdscon', dot_edges, dot_vertices, verify_and_dot('intrasite_post_ntdscon', dot_edges, dot_vertices,
label='%s__%s__%s' % (site_local.site_dnstr, nctype_lut[nc_x.nc_type], nc_x.nc_dnstr), label='%s__%s__%s' % (site_local.site_dnstr, nctype_lut[nc_x.nc_type], nc_x.nc_dnstr),
properties=verify_properties, debug=DEBUG, verify=opts.verify, properties=verify_properties, debug=DEBUG, verify=opts.verify,
@ -2456,7 +2453,7 @@ class KCC(object):
for dsa in site.dsa_table.values(): for dsa in site.dsa_table.values():
for con in dsa.connect_table.values(): for con in dsa.connect_table.values():
dot_edges.append((dsa.dsa_dnstr, con.from_dnstr)) dot_edges.append((dsa.dsa_dnstr, con.from_dnstr))
verify_properties = ('complete', 'connected', 'multi_edge_forest', 'forest', 'directed_double_ring') verify_properties = ('connected', 'forest_of_rings')
verify_and_dot('dsa_final', dot_edges, label=self.my_dsa_dnstr, verify_and_dot('dsa_final', dot_edges, label=self.my_dsa_dnstr,
properties=verify_properties, debug=DEBUG, verify=opts.verify, properties=verify_properties, debug=DEBUG, verify=opts.verify,
dot_files=opts.dot_files, directed=True) dot_files=opts.dot_files, directed=True)