Other: Increase integration test timeouts

This commit is contained in:
James Houlahan
2022-10-20 14:14:08 +02:00
parent 1729c085c7
commit c20143c212
3 changed files with 16 additions and 26 deletions

View File

@ -20,7 +20,6 @@ package tests
import (
"fmt"
"strings"
"time"
"github.com/bradenaw/juniper/iterator"
"github.com/bradenaw/juniper/xslices"
@ -161,11 +160,9 @@ func (s *scenario) imapClientSeesTheFollowingMailboxInfo(clientID string, table
}
func (s *scenario) imapClientEventuallySeesTheFollowingMailboxInfo(clientID string, table *godog.Table) error {
return eventually(
func() error { return s.imapClientSeesTheFollowingMailboxInfo(clientID, table) },
5*time.Second,
100*time.Millisecond,
)
return eventually(func() error {
return s.imapClientSeesTheFollowingMailboxInfo(clientID, table)
})
}
func (s *scenario) imapClientSeesTheFollowingMailboxInfoForMailbox(clientID, mailbox string, table *godog.Table) error {
@ -299,11 +296,9 @@ func (s *scenario) imapClientSeesTheFollowingMessagesInMailbox(clientID, mailbox
}
func (s *scenario) imapClientEventuallySeesTheFollowingMessagesInMailbox(clientID, mailbox string, table *godog.Table) error {
return eventually(
func() error { return s.imapClientSeesTheFollowingMessagesInMailbox(clientID, mailbox, table) },
5*time.Second,
500*time.Millisecond,
)
return eventually(func() error {
return s.imapClientSeesTheFollowingMessagesInMailbox(clientID, mailbox, table)
})
}
func (s *scenario) imapClientSeesMessagesInMailbox(clientID string, count int, mailbox string) error {
@ -322,11 +317,9 @@ func (s *scenario) imapClientSeesMessagesInMailbox(clientID string, count int, m
}
func (s *scenario) imapClientEventuallySeesMessagesInMailbox(clientID string, count int, mailbox string) error {
return eventually(
func() error { return s.imapClientSeesMessagesInMailbox(clientID, count, mailbox) },
5*time.Second,
500*time.Millisecond,
)
return eventually(func() error {
return s.imapClientSeesMessagesInMailbox(clientID, count, mailbox)
})
}
func (s *scenario) imapClientMarksMessageAsDeleted(clientID string, seq int) error {

View File

@ -166,19 +166,19 @@ func matchMailboxes(have, want []Mailbox) error {
return nil
}
func eventually(condition func() error, waitFor, tick time.Duration) error { //nolint:unparam
func eventually(condition func() error) error {
ch := make(chan error, 1)
timer := time.NewTimer(waitFor)
timer := time.NewTimer(10 * time.Second)
defer timer.Stop()
ticker := time.NewTicker(tick)
ticker := time.NewTicker(100 * time.Millisecond)
defer ticker.Stop()
for tick := ticker.C; ; {
select {
case <-timer.C:
return fmt.Errorf("timed out after %v", waitFor)
return fmt.Errorf("timed out")
case <-tick:
tick = nil

View File

@ -21,7 +21,6 @@ import (
"context"
"errors"
"fmt"
"time"
"github.com/cucumber/godog"
"github.com/google/uuid"
@ -222,11 +221,9 @@ func (s *scenario) userIsListedAndConnected(username string) error {
}
func (s *scenario) userIsEventuallyListedAndConnected(username string) error {
return eventually(
func() error { return s.userIsListedAndConnected(username) },
5*time.Second,
100*time.Millisecond,
)
return eventually(func() error {
return s.userIsListedAndConnected(username)
})
}
func (s *scenario) userIsListedButNotConnected(username string) error {