Skip to content

Commit 381a071

Browse files
committed
Clean up RedisLockRegistryLeaderInitiatorTests
Related to https://build.spring.io/browse/INT-MASTERSPRING40-1129 When there is no other candidates in the cluster, the current `yield()` will give a leadership to the current active initiator back Therefore a `revoke()` might not be called at all * Fir the `RedisLockRegistryLeaderInitiatorTests` to check revoking after `stop()` instead of `yield()`
1 parent 7424cb2 commit 381a071

File tree

1 file changed

+1
-3
lines changed

1 file changed

+1
-3
lines changed

spring-integration-redis/src/test/java/org/springframework/integration/redis/leader/RedisLockRegistryLeaderInitiatorTests.java

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -129,12 +129,10 @@ public void testDistributedLeaderElection() throws Exception {
129129
initiator1.setLeaderEventPublisher(new CountingPublisher(new CountDownLatch(1), revoked11,
130130
new CountDownLatch(1)));
131131

132-
initiator1.getContext().yield();
132+
initiator1.stop();
133133

134134
assertThat(revoked11.await(60, TimeUnit.SECONDS)).isTrue();
135135
assertThat(initiator1.getContext().isLeader()).isFalse();
136-
137-
initiator1.stop();
138136
}
139137

140138
private static class CountingPublisher implements LeaderEventPublisher {

0 commit comments

Comments
 (0)