From 381a071287dd648879b47a15d9104df4af01eda1 Mon Sep 17 00:00:00 2001 From: Artem Bilan Date: Mon, 6 Jul 2020 11:30:43 -0400 Subject: [PATCH] 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()` --- .../redis/leader/RedisLockRegistryLeaderInitiatorTests.java | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/spring-integration-redis/src/test/java/org/springframework/integration/redis/leader/RedisLockRegistryLeaderInitiatorTests.java b/spring-integration-redis/src/test/java/org/springframework/integration/redis/leader/RedisLockRegistryLeaderInitiatorTests.java index b99af5398d..1c935dc161 100644 --- a/spring-integration-redis/src/test/java/org/springframework/integration/redis/leader/RedisLockRegistryLeaderInitiatorTests.java +++ b/spring-integration-redis/src/test/java/org/springframework/integration/redis/leader/RedisLockRegistryLeaderInitiatorTests.java @@ -129,12 +129,10 @@ public class RedisLockRegistryLeaderInitiatorTests extends RedisAvailableTests { initiator1.setLeaderEventPublisher(new CountingPublisher(new CountDownLatch(1), revoked11, new CountDownLatch(1))); - initiator1.getContext().yield(); + initiator1.stop(); assertThat(revoked11.await(60, TimeUnit.SECONDS)).isTrue(); assertThat(initiator1.getContext().isLeader()).isFalse(); - - initiator1.stop(); } private static class CountingPublisher implements LeaderEventPublisher {