From 3761548ae16c7c6d67795f8a50ef92ec072be90c Mon Sep 17 00:00:00 2001 From: Artem Vysochyn Date: Thu, 20 Jun 2024 22:15:27 +0300 Subject: [PATCH] WIP --- .../fdetector/FailureDetectorTest.java | 20 +++++++++++++++++++ 1 file changed, 20 insertions(+) diff --git a/cluster2/src/test/java/io/scalecube/cluster2/fdetector/FailureDetectorTest.java b/cluster2/src/test/java/io/scalecube/cluster2/fdetector/FailureDetectorTest.java index 7f7fcc59..94fa3fd2 100644 --- a/cluster2/src/test/java/io/scalecube/cluster2/fdetector/FailureDetectorTest.java +++ b/cluster2/src/test/java/io/scalecube/cluster2/fdetector/FailureDetectorTest.java @@ -127,6 +127,26 @@ void testOnMembershipEventAddedThenLeaving() { verify(transport, never()).send(any(), any(), anyInt(), anyInt()); } + @Test + void testOnTick() { + emitMembershipEvent(MembershipEventType.ADDED, fooMember); + failureDetector.doWork(); + + epochClock.advance(1); + failureDetector.doWork(); + verify(transport).send(any(), any(), anyInt(), anyInt()); + + reset(transport); + epochClock.advance(config.pingInterval() + 1); + failureDetector.doWork(); + verify(transport).send(any(), any(), anyInt(), anyInt()); + + reset(transport); + epochClock.advance(config.pingInterval() + 1); + failureDetector.doWork(); + verify(transport).send(any(), any(), anyInt(), anyInt()); + } + @Test void testPingThenAck() { emitMembershipEvent(MembershipEventType.ADDED, fooMember);