Skip to content

Commit

Permalink
Providing exchange: attempt to fix flapping test
Browse files Browse the repository at this point in the history
  • Loading branch information
hsanjuan committed Nov 20, 2024
1 parent ecc9dd9 commit cc82f9b
Showing 1 changed file with 12 additions and 0 deletions.
12 changes: 12 additions & 0 deletions exchange/providing/providing_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ package providing
import (
"context"
"testing"
"time"

testinstance "github.com/ipfs/boxo/bitswap/testinstance"
tn "github.com/ipfs/boxo/bitswap/testnet"
Expand Down Expand Up @@ -37,6 +38,14 @@ func TestExchange(t *testing.T) {
t.Fatal()
}

// Trigger reproviding, otherwise it's not really provided.
err = prov.Reprovide(ctx)
if err != nil {
t.Fatal(err)
}

time.Sleep(200 * time.Millisecond)

providersChan := provFinder.FindProvidersAsync(ctx, block.Cid(), 1)
_, ok := <-providersChan
if ok {
Expand All @@ -54,6 +63,9 @@ func TestExchange(t *testing.T) {
if err != nil {
t.Fatal(err)
}

time.Sleep(200 * time.Millisecond)

providersChan = provFinder.FindProvidersAsync(ctx, block.Cid(), 1)
_, ok = <-providersChan
if !ok {
Expand Down

0 comments on commit cc82f9b

Please sign in to comment.