Skip to content

Commit 3a3c027

Browse files
MB-61292: [cluster tests] Sort nodes when verifying services
Nodes can change order in the connected_nodes list (e.g. if we remove and add node back). In this case the services requirement can fail because it depends on the order of nodes in the list. This change makes the requirement agnostic to that order. Change-Id: I4f7db19fc51078937d82066fc08e94c4dd177eb9 Reviewed-on: https://review.couchbase.org/c/ns_server/+/223445 Well-Formed: Build Bot <[email protected]> Tested-by: Build Bot <[email protected]> Reviewed-by: Peter Searby <[email protected]> Tested-by: Timofey Barmin <[email protected]>
1 parent c1db52b commit 3a3c027

File tree

2 files changed

+4
-1
lines changed

2 files changed

+4
-1
lines changed

cluster_tests/testlib/node.py

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -36,6 +36,9 @@ def __str__(self):
3636
def __repr__(self):
3737
return self.__dict__.__repr__()
3838

39+
def __lt__(self, other):
40+
return self.hostname() < other.hostname()
41+
3942
def data_path(self):
4043
if self.data_path_cache is None:
4144
r = testlib.diag_eval(self, "path_config:component_path(data).")

cluster_tests/testlib/requirements.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -522,7 +522,7 @@ def __init__(self, deploy: Union[List[Service], Dict[str, List[Service]]]):
522522
self.connect_args = {"deploy": self.deploy}
523523

524524
def is_met(self, cluster):
525-
for i, node in enumerate(cluster.connected_nodes):
525+
for i, node in enumerate(sorted(cluster.connected_nodes)):
526526
# We can't take information for all nodes from a single /pools/nodes
527527
# because we don't know which node is which
528528
res = get_succ(node, "/pools/nodes").json()

0 commit comments

Comments
 (0)