Increase timeout on waku tests

This commit is contained in:
Andrea Maria Piana 2023-11-01 15:47:41 +00:00
parent fd76367be7
commit a89a386c82
No known key found for this signature in database
1 changed files with 26 additions and 10 deletions

View File

@ -81,7 +81,7 @@ func TestRestartDiscoveryV5(t *testing.T) {
w.discV5BootstrapNodes = []string{testENRBootstrap} w.discV5BootstrapNodes = []string{testENRBootstrap}
options = func(b *backoff.ExponentialBackOff) { options = func(b *backoff.ExponentialBackOff) {
b.MaxElapsedTime = 30 * time.Second b.MaxElapsedTime = 90 * time.Second
} }
err = tt.RetryWithBackOff(func() error { err = tt.RetryWithBackOff(func() error {
@ -127,11 +127,19 @@ func TestBasicWakuV2(t *testing.T) {
storeNode := discoveredNodes[int(r.Int64())] storeNode := discoveredNodes[int(r.Int64())]
// Wait for some peers to be discovered options := func(b *backoff.ExponentialBackOff) {
time.Sleep(3 * time.Second) b.MaxElapsedTime = 30 * time.Second
}
// At least 3 peers should have been discovered // Sanity check, not great, but it's probably helpful
require.GreaterOrEqual(t, w.PeerCount(), 3) err = tt.RetryWithBackOff(func() error {
if len(w.Peers()) > 2 {
return errors.New("no peers discovered")
}
return nil
}, options)
require.NoError(t, err)
filter := &common.Filter{ filter := &common.Filter{
Messages: common.NewMemoryMessageStore(), Messages: common.NewMemoryMessageStore(),
@ -160,7 +168,7 @@ func TestBasicWakuV2(t *testing.T) {
timestampInSeconds := msgTimestamp / int64(time.Second) timestampInSeconds := msgTimestamp / int64(time.Second)
marginInSeconds := 20 marginInSeconds := 20
options := func(b *backoff.ExponentialBackOff) { options = func(b *backoff.ExponentialBackOff) {
b.MaxElapsedTime = 60 * time.Second b.MaxElapsedTime = 60 * time.Second
b.InitialInterval = 500 * time.Millisecond b.InitialInterval = 500 * time.Millisecond
} }
@ -202,12 +210,20 @@ func TestWakuV2Filter(t *testing.T) {
require.NoError(t, err) require.NoError(t, err)
require.NoError(t, w.Start()) require.NoError(t, w.Start())
// DNSDiscovery options := func(b *backoff.ExponentialBackOff) {
// Wait for some peers to be discovered b.MaxElapsedTime = 10 * time.Second
time.Sleep(10 * time.Second) }
// Sanity check, not great, but it's probably helpful
err = tt.RetryWithBackOff(func() error {
if len(w.Peers()) > 2 {
return errors.New("no peers discovered")
}
return nil
}, options)
// At least 3 peers should have been discovered // At least 3 peers should have been discovered
require.Greater(t, w.PeerCount(), 3) require.GreaterOrEqual(t, w.PeerCount(), 3)
filter := &common.Filter{ filter := &common.Filter{
Messages: common.NewMemoryMessageStore(), Messages: common.NewMemoryMessageStore(),