GODT-1657: Stable sync (still needs more tests)

This commit is contained in:
James Houlahan
2022-10-01 23:14:42 +02:00
parent 705875cff2
commit 9d69a2e565
34 changed files with 1270 additions and 1099 deletions

View File

@ -39,10 +39,10 @@ func init() {
certs.GenerateCert = FastGenerateCert
// Set the event period to 100 milliseconds for more responsive tests.
user.DefaultEventPeriod = 100 * time.Millisecond
user.EventPeriod = 100 * time.Millisecond
// Don't use jitter during tests.
user.DefaultEventJitter = 0
user.EventJitter = 0
}
type scenario struct {

View File

@ -137,7 +137,7 @@ func (s *scenario) bridgeSendsADeauthEventForUser(username string) error {
}
func (s *scenario) bridgeSendsAnAddressCreatedEventForUser(username string) error {
return try(s.t.addrCreatedCh, 5*time.Second, func(event events.UserAddressCreated) error {
return try(s.t.addrCreatedCh, 60*time.Second, func(event events.UserAddressCreated) error {
if wantUserID := s.t.getUserID(username); wantUserID != event.UserID {
return fmt.Errorf("expected user address created event for user with ID %s, got %s", wantUserID, event.UserID)
}
@ -147,7 +147,7 @@ func (s *scenario) bridgeSendsAnAddressCreatedEventForUser(username string) erro
}
func (s *scenario) bridgeSendsAnAddressDeletedEventForUser(username string) error {
return try(s.t.addrDeletedCh, 5*time.Second, func(event events.UserAddressDeleted) error {
return try(s.t.addrDeletedCh, 60*time.Second, func(event events.UserAddressDeleted) error {
if wantUserID := s.t.getUserID(username); wantUserID != event.UserID {
return fmt.Errorf("expected user address deleted event for user with ID %s, got %s", wantUserID, event.UserID)
}

View File

@ -138,9 +138,9 @@ func (s *scenario) theAddressOfAccountHasMessagesInMailbox(address, username str
for idx := 0; idx < count; idx++ {
messageID, err := s.t.api.CreateMessage(userID, addrID, Message{
Subject: fmt.Sprintf("subject %d", idx),
To: fmt.Sprintf("to %d", idx),
From: fmt.Sprintf("from %d", idx),
Subject: fmt.Sprintf("%d", idx),
To: fmt.Sprintf("%d@pm.me", idx),
From: fmt.Sprintf("%d@pm.me", idx),
Body: fmt.Sprintf("body %d", idx),
}.Build(), liteapi.MessageFlagReceived, idx%2 == 0, false)
if err != nil {