mirror of
https://code.briarproject.org/briar/briar.git
synced 2026-02-12 10:49:06 +01:00
Re-add integration test that goes through two full introduction cycles
This commit is contained in:
committed by
Torsten Grote
parent
1c54fd1101
commit
17fc81ab7a
@@ -389,6 +389,70 @@ public class AutoDeleteIntegrationTest extends AbstractAutoDeleteTest {
|
||||
assertGroupCountAt2With0(count20, unread20);
|
||||
}
|
||||
|
||||
/**
|
||||
* Go through two full cycles of introducing two contacts with
|
||||
* self-destructing messages enabled, lettings them both introducees expire
|
||||
* their introductions, thereby auto-declining it.
|
||||
*/
|
||||
@Test
|
||||
public void testTwoIntroductionCycles() throws Exception {
|
||||
// FIRST CYCLE
|
||||
introduceAndAutoDecline();
|
||||
|
||||
// SECOND CYCLE
|
||||
introduceAndAutoDecline();
|
||||
}
|
||||
|
||||
private void introduceAndAutoDecline() throws Exception {
|
||||
// send introduction
|
||||
makeIntroduction(true, true);
|
||||
markMessagesRead(c1, contact0From1);
|
||||
markMessagesRead(c2, contact0From2);
|
||||
assertGroupCounts(1, 0, 1, 0, 1, 0, 1, 0);
|
||||
|
||||
// ack from 1 and 2 to 0. This starts 0's timer
|
||||
ack1To0(1);
|
||||
ack2To0(1);
|
||||
waitForEvents(c0);
|
||||
|
||||
// time travel on all devices, destroying the introductions at 0 and
|
||||
// making 1 and 2 auto-decline
|
||||
timeTravel(c0);
|
||||
timeTravel(c1);
|
||||
timeTravel(c2);
|
||||
assertGroupCounts(0, 0, 0, 0, 1, 0, 1, 0);
|
||||
|
||||
// sync the auto-decline messages to 0
|
||||
sync1To0(1, true);
|
||||
sync2To0(1, true);
|
||||
waitForEvents(c0);
|
||||
assertGroupCounts(1, 1, 1, 1, 1, 0, 1, 0);
|
||||
|
||||
// mark declines read on 0, starting the timer there and let them expire
|
||||
markMessagesRead(c0, contact1From0);
|
||||
markMessagesRead(c0, contact2From0);
|
||||
timeTravel(c0);
|
||||
assertGroupCounts(0, 0, 0, 0, 1, 0, 1, 0);
|
||||
|
||||
// sync responses to 1 and 2
|
||||
sync0To1(1, true);
|
||||
sync0To2(1, true);
|
||||
waitForEvents(c1);
|
||||
waitForEvents(c2);
|
||||
|
||||
// ack the responses to 0 to clear the ack counts for subsequent cycles,
|
||||
// also starts the timer for the responses at 1 and 2
|
||||
ack1To0(1);
|
||||
ack2To0(1);
|
||||
waitForEvents(c0);
|
||||
assertGroupCounts(0, 0, 0, 0, 1, 0, 1, 0);
|
||||
|
||||
// let timers for responses expire
|
||||
timeTravel(c1);
|
||||
timeTravel(c2);
|
||||
assertGroupCounts(0, 0, 0, 0, 0, 0, 0, 0);
|
||||
}
|
||||
|
||||
/**
|
||||
* Let introductions self-destruct at the introducer and one of the
|
||||
* introducees
|
||||
|
||||
Reference in New Issue
Block a user