Skip to content

Commit 9434d27

Browse files
committed
fix counter test
1 parent 131982f commit 9434d27

File tree

2 files changed

+7
-4
lines changed

2 files changed

+7
-4
lines changed

byteman/4.0/election_counter_leader_favor_node2.btm

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7,8 +7,8 @@ RULE election counter leader cheat
77
CLASS org.apache.cassandra.service.StorageProxy
88
METHOD findSuitableEndpoint
99
AT EXIT
10-
BIND isthere:boolean = $localEndpoints.contains(org.apache.cassandra.locator.InetAddressAndPort.getByName("127.0.0.2"));
10+
BIND isthere:boolean = $localReplicas.stream().anyMatch(r -> { try { return r.endpoint().equals(org.apache.cassandra.locator.InetAddressAndPort.getByName("127.0.0.2")); } catch (Throwable t) { return false; } });
1111
if isthere
1212
DO
13-
return org.apache.cassandra.locator.InetAddressAndPort.getByName("127.0.0.2");
13+
return localReplicas.stream().filter(lr -> { try { return lr.endpoint().equals(InetAddressAndPort.getByName("127.0.0.2")); } catch (Throwable t) { return null; } }).findFirst().get();
1414
ENDRULE

counter_test.py

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -114,8 +114,11 @@ def test_counter_leader_with_partial_view(self):
114114

115115
# Now stop the node and restart but first install a rule to slow down how fast node 2 will update the list
116116
# nodes that are alive
117-
nodes[1].stop(wait=True, wait_other_notice=False)
118-
nodes[1].update_startup_byteman_script(mk_bman_path('gossip_alive_callback_sleep.btm'))
117+
nodes[1].stop(wait=True, wait_other_notice=True)
118+
119+
if cluster.version() < '5.1':
120+
nodes[1].update_startup_byteman_script(mk_bman_path('gossip_alive_callback_sleep.btm'))
121+
119122
nodes[1].start(no_wait=True, wait_other_notice=False)
120123

121124
# Until node 2 is fully alive try to force other nodes to pick him as mutation leader.

0 commit comments

Comments
 (0)