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()`
This commit is contained in:
Artem Bilan
2020-07-06 11:30:43 -04:00
parent 7424cb215c
commit 381a071287

View File

@@ -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 {