m-chrzan.xyz
aboutsummaryrefslogtreecommitdiff
path: root/src/test/java/pl
diff options
context:
space:
mode:
authorMarcin Chrzanowski <marcin.j.chrzanowski@gmail.com>2020-01-11 20:12:34 +0100
committerMarcin Chrzanowski <marcin.j.chrzanowski@gmail.com>2020-01-11 20:12:34 +0100
commit0953e404e7dacbe397cc60d8715af72bd59b8c1c (patch)
tree3689aab02ae709b9b4edc666956f08770eba3423 /src/test/java/pl
parent55be079e9b183c430662606548548ef935bbdf40 (diff)
Start implementing gossip cleanup
Diffstat (limited to 'src/test/java/pl')
-rw-r--r--src/test/java/pl/edu/mimuw/cloudatlas/agent/modules/GossipGirlTest.java23
1 files changed, 23 insertions, 0 deletions
diff --git a/src/test/java/pl/edu/mimuw/cloudatlas/agent/modules/GossipGirlTest.java b/src/test/java/pl/edu/mimuw/cloudatlas/agent/modules/GossipGirlTest.java
index a812e61..fb3c5f7 100644
--- a/src/test/java/pl/edu/mimuw/cloudatlas/agent/modules/GossipGirlTest.java
+++ b/src/test/java/pl/edu/mimuw/cloudatlas/agent/modules/GossipGirlTest.java
@@ -15,6 +15,7 @@ import java.util.Set;
import pl.edu.mimuw.cloudatlas.agent.MockExecutor;
import pl.edu.mimuw.cloudatlas.agent.messages.AgentMessage;
import pl.edu.mimuw.cloudatlas.agent.messages.AttributesMessage;
+import pl.edu.mimuw.cloudatlas.agent.messages.CleanOldGossipsMessage;
import pl.edu.mimuw.cloudatlas.agent.messages.HejkaMessage;
import pl.edu.mimuw.cloudatlas.agent.messages.GetStateMessage;
import pl.edu.mimuw.cloudatlas.agent.messages.GossipGirlMessage;
@@ -409,6 +410,28 @@ public class GossipGirlTest {
gossipGirl.handleTyped(queryMessage2);
}
+ @Test
+ public void cleanupOldGossips() throws Exception {
+ gossipGirl.handleTyped(hejkaMessage);
+ executor.messagesToPass.take();
+ gossipGirl.handleTyped(stateMessage);
+ executor.messagesToPass.take();
+
+ gossipGirl.handleTyped(attributesMessage1);
+ executor.messagesToPass.take();
+ executor.messagesToPass.take();
+ executor.messagesToPass.take();
+ executor.messagesToPass.take();
+ executor.messagesToPass.take();
+ executor.messagesToPass.take();
+
+ CleanOldGossipsMessage message = new CleanOldGossipsMessage("", 0, TestUtil.addToTime(ValueUtils.currentTime(), 10));
+ gossipGirl.handleTyped(message);
+ gossipGirl.handleTyped(attributesMessage2);
+
+ assertEquals(0, executor.messagesToPass.size());
+ }
+
private void assertQueryMessage(AgentMessage message, String recipientPath, String name, String query) throws Exception {
assertUDUPMessage(
message,