Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

bitswap: reenable tests #423

Merged
merged 2 commits into from
Aug 25, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
35 changes: 0 additions & 35 deletions bitswap/bitswap_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,6 @@ import (
"github.com/ipfs/boxo/bitswap/server"
testinstance "github.com/ipfs/boxo/bitswap/testinstance"
tn "github.com/ipfs/boxo/bitswap/testnet"
"github.com/ipfs/boxo/internal/test"
mockrouting "github.com/ipfs/boxo/routing/mock"
blocks "github.com/ipfs/go-block-format"
cid "github.com/ipfs/go-cid"
Expand Down Expand Up @@ -49,8 +48,6 @@ func addBlock(t *testing.T, ctx context.Context, inst testinstance.Instance, blk
const kNetworkDelay = 0 * time.Millisecond

func TestClose(t *testing.T) {
test.Flaky(t)

vnet := tn.VirtualNetwork(mockrouting.NewServer(), delay.Fixed(kNetworkDelay))
ig := testinstance.NewTestInstanceGenerator(vnet, nil, nil)
defer ig.Close()
Expand All @@ -67,8 +64,6 @@ func TestClose(t *testing.T) {
}

func TestProviderForKeyButNetworkCannotFind(t *testing.T) { // TODO revisit this
test.Flaky(t)

rs := mockrouting.NewServer()
net := tn.VirtualNetwork(rs, delay.Fixed(kNetworkDelay))
ig := testinstance.NewTestInstanceGenerator(net, nil, nil)
Expand All @@ -94,8 +89,6 @@ func TestProviderForKeyButNetworkCannotFind(t *testing.T) { // TODO revisit this
}

func TestGetBlockFromPeerAfterPeerAnnounces(t *testing.T) {
test.Flaky(t)

net := tn.VirtualNetwork(mockrouting.NewServer(), delay.Fixed(kNetworkDelay))
block := blocks.NewBlock([]byte("block"))
ig := testinstance.NewTestInstanceGenerator(net, nil, nil)
Expand Down Expand Up @@ -124,8 +117,6 @@ func TestGetBlockFromPeerAfterPeerAnnounces(t *testing.T) {
}

func TestDoesNotProvideWhenConfiguredNotTo(t *testing.T) {
test.Flaky(t)

net := tn.VirtualNetwork(mockrouting.NewServer(), delay.Fixed(kNetworkDelay))
block := blocks.NewBlock([]byte("block"))
bsOpts := []bitswap.Option{bitswap.ProvideEnabled(false), bitswap.ProviderSearchDelay(50 * time.Millisecond)}
Expand Down Expand Up @@ -158,8 +149,6 @@ func TestDoesNotProvideWhenConfiguredNotTo(t *testing.T) {
// Tests that a received block is not stored in the blockstore if the block was
// not requested by the client
func TestUnwantedBlockNotAdded(t *testing.T) {
test.Flaky(t)

net := tn.VirtualNetwork(mockrouting.NewServer(), delay.Fixed(kNetworkDelay))
block := blocks.NewBlock([]byte("block"))
bsMessage := bsmsg.New(true)
Expand Down Expand Up @@ -195,8 +184,6 @@ func TestUnwantedBlockNotAdded(t *testing.T) {
//
// (because the live request queue is full)
func TestPendingBlockAdded(t *testing.T) {
test.Flaky(t)

ctx := context.Background()
net := tn.VirtualNetwork(mockrouting.NewServer(), delay.Fixed(kNetworkDelay))
bg := blocksutil.NewBlockGenerator()
Expand Down Expand Up @@ -245,8 +232,6 @@ func TestPendingBlockAdded(t *testing.T) {
}

func TestLargeSwarm(t *testing.T) {
test.Flaky(t)

if testing.Short() {
t.SkipNow()
}
Expand Down Expand Up @@ -279,8 +264,6 @@ func TestLargeFile(t *testing.T) {
}

func TestLargeFileTwoPeers(t *testing.T) {
test.Flaky(t)

if testing.Short() {
t.SkipNow()
}
Expand All @@ -290,8 +273,6 @@ func TestLargeFileTwoPeers(t *testing.T) {
}

func PerformDistributionTest(t *testing.T, numInstances, numBlocks int) {
test.Flaky(t)

ctx := context.Background()
if testing.Short() {
t.SkipNow()
Expand Down Expand Up @@ -349,8 +330,6 @@ func PerformDistributionTest(t *testing.T, numInstances, numBlocks int) {

// TODO simplify this test. get to the _essence_!
func TestSendToWantingPeer(t *testing.T) {
test.Flaky(t)

if testing.Short() {
t.SkipNow()
}
Expand Down Expand Up @@ -393,8 +372,6 @@ func TestSendToWantingPeer(t *testing.T) {
}

func TestEmptyKey(t *testing.T) {
test.Flaky(t)

net := tn.VirtualNetwork(mockrouting.NewServer(), delay.Fixed(kNetworkDelay))
ig := testinstance.NewTestInstanceGenerator(net, nil, nil)
defer ig.Close()
Expand Down Expand Up @@ -428,8 +405,6 @@ func assertStat(t *testing.T, st *bitswap.Stat, sblks, rblks, sdata, rdata uint6
}

func TestBasicBitswap(t *testing.T) {
test.Flaky(t)

net := tn.VirtualNetwork(mockrouting.NewServer(), delay.Fixed(kNetworkDelay))
ig := testinstance.NewTestInstanceGenerator(net, nil, nil)
defer ig.Close()
Expand Down Expand Up @@ -502,8 +477,6 @@ func TestBasicBitswap(t *testing.T) {
}

func TestDoubleGet(t *testing.T) {
test.Flaky(t)

net := tn.VirtualNetwork(mockrouting.NewServer(), delay.Fixed(kNetworkDelay))
ig := testinstance.NewTestInstanceGenerator(net, nil, nil)
defer ig.Close()
Expand Down Expand Up @@ -569,8 +542,6 @@ func TestDoubleGet(t *testing.T) {
}

func TestWantlistCleanup(t *testing.T) {
test.Flaky(t)

net := tn.VirtualNetwork(mockrouting.NewServer(), delay.Fixed(kNetworkDelay))
ig := testinstance.NewTestInstanceGenerator(net, nil, nil)
defer ig.Close()
Expand Down Expand Up @@ -693,8 +664,6 @@ func newReceipt(sent, recv, exchanged uint64) *server.Receipt {
}

func TestBitswapLedgerOneWay(t *testing.T) {
test.Flaky(t)

net := tn.VirtualNetwork(mockrouting.NewServer(), delay.Fixed(kNetworkDelay))
ig := testinstance.NewTestInstanceGenerator(net, nil, nil)
defer ig.Close()
Expand Down Expand Up @@ -744,8 +713,6 @@ func TestBitswapLedgerOneWay(t *testing.T) {
}

func TestBitswapLedgerTwoWay(t *testing.T) {
test.Flaky(t)

net := tn.VirtualNetwork(mockrouting.NewServer(), delay.Fixed(kNetworkDelay))
ig := testinstance.NewTestInstanceGenerator(net, nil, nil)
defer ig.Close()
Expand Down Expand Up @@ -834,8 +801,6 @@ func (tsl *testingScoreLedger) Stop() {

// Tests start and stop of a custom decision logic
func TestWithScoreLedger(t *testing.T) {
test.Flaky(t)

tsl := newTestingScoreLedger()
net := tn.VirtualNetwork(mockrouting.NewServer(), delay.Fixed(kNetworkDelay))
bsOpts := []bitswap.Option{bitswap.WithScoreLedger(tsl)}
Expand Down
19 changes: 0 additions & 19 deletions bitswap/client/bitswap_with_sessions_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,6 @@ import (
"github.com/ipfs/boxo/bitswap/client/traceability"
testinstance "github.com/ipfs/boxo/bitswap/testinstance"
tn "github.com/ipfs/boxo/bitswap/testnet"
"github.com/ipfs/boxo/internal/test"
mockrouting "github.com/ipfs/boxo/routing/mock"
blocks "github.com/ipfs/go-block-format"
cid "github.com/ipfs/go-cid"
Expand Down Expand Up @@ -40,8 +39,6 @@ func addBlock(t *testing.T, ctx context.Context, inst testinstance.Instance, blk
}

func TestBasicSessions(t *testing.T) {
test.Flaky(t)

ctx, cancel := context.WithCancel(context.Background())
defer cancel()

Expand Down Expand Up @@ -109,8 +106,6 @@ func assertBlockListsFrom(from peer.ID, got, exp []blocks.Block) error {
}

func TestSessionBetweenPeers(t *testing.T) {
test.Flaky(t)

ctx, cancel := context.WithCancel(context.Background())
defer cancel()

Expand Down Expand Up @@ -171,8 +166,6 @@ func TestSessionBetweenPeers(t *testing.T) {
}

func TestSessionSplitFetch(t *testing.T) {
test.Flaky(t)

ctx, cancel := context.WithCancel(context.Background())
defer cancel()

Expand Down Expand Up @@ -217,8 +210,6 @@ func TestSessionSplitFetch(t *testing.T) {
}

func TestFetchNotConnected(t *testing.T) {
test.Flaky(t)

ctx, cancel := context.WithTimeout(context.Background(), 2*time.Second)
defer cancel()

Expand Down Expand Up @@ -262,8 +253,6 @@ func TestFetchNotConnected(t *testing.T) {
}

func TestFetchAfterDisconnect(t *testing.T) {
test.Flaky(t)

ctx, cancel := context.WithTimeout(context.Background(), 2*time.Second)
defer cancel()

Expand Down Expand Up @@ -342,8 +331,6 @@ func TestFetchAfterDisconnect(t *testing.T) {
}

func TestInterestCacheOverflow(t *testing.T) {
test.Flaky(t)

ctx, cancel := context.WithCancel(context.Background())
defer cancel()

Expand Down Expand Up @@ -394,8 +381,6 @@ func TestInterestCacheOverflow(t *testing.T) {
}

func TestPutAfterSessionCacheEvict(t *testing.T) {
test.Flaky(t)

ctx, cancel := context.WithCancel(context.Background())
defer cancel()

Expand Down Expand Up @@ -434,8 +419,6 @@ func TestPutAfterSessionCacheEvict(t *testing.T) {
}

func TestMultipleSessions(t *testing.T) {
test.Flaky(t)

ctx, cancel := context.WithCancel(context.Background())
defer cancel()

Expand Down Expand Up @@ -477,8 +460,6 @@ func TestMultipleSessions(t *testing.T) {
}

func TestWantlistClearsOnCancel(t *testing.T) {
test.Flaky(t)

ctx, cancel := context.WithTimeout(context.Background(), time.Second*5)
defer cancel()

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@ import (
"testing"

"github.com/ipfs/boxo/bitswap/internal/testutil"
"github.com/ipfs/boxo/internal/test"
cid "github.com/ipfs/go-cid"
peer "github.com/libp2p/go-libp2p/core/peer"
)
Expand All @@ -17,8 +16,6 @@ const (
)

func TestBlockPresenceManager(t *testing.T) {
test.Flaky(t)

bpm := New()

p := testutil.GeneratePeers(1)[0]
Expand Down Expand Up @@ -99,8 +96,6 @@ func TestBlockPresenceManager(t *testing.T) {
}

func TestAddRemoveMulti(t *testing.T) {
test.Flaky(t)

bpm := New()

peers := testutil.GeneratePeers(2)
Expand Down Expand Up @@ -184,8 +179,6 @@ func TestAddRemoveMulti(t *testing.T) {
}

func TestAllPeersDoNotHaveBlock(t *testing.T) {
test.Flaky(t)

bpm := New()

peers := testutil.GeneratePeers(3)
Expand Down
19 changes: 0 additions & 19 deletions bitswap/client/internal/messagequeue/donthavetimeoutmgr_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,6 @@ import (

"github.com/benbjohnson/clock"
"github.com/ipfs/boxo/bitswap/internal/testutil"
"github.com/ipfs/boxo/internal/test"
cid "github.com/ipfs/go-cid"
"github.com/libp2p/go-libp2p/p2p/protocol/ping"
)
Expand Down Expand Up @@ -74,8 +73,6 @@ func (tr *timeoutRecorder) clear() {
}

func TestDontHaveTimeoutMgrTimeout(t *testing.T) {
test.Flaky(t)

firstks := testutil.GenerateCids(2)
secondks := append(firstks, testutil.GenerateCids(3)...)
latency := time.Millisecond * 20
Expand Down Expand Up @@ -132,8 +129,6 @@ func TestDontHaveTimeoutMgrTimeout(t *testing.T) {
}

func TestDontHaveTimeoutMgrCancel(t *testing.T) {
test.Flaky(t)

ks := testutil.GenerateCids(3)
latency := time.Millisecond * 10
latMultiplier := 1
Expand Down Expand Up @@ -170,8 +165,6 @@ func TestDontHaveTimeoutMgrCancel(t *testing.T) {
}

func TestDontHaveTimeoutWantCancelWant(t *testing.T) {
test.Flaky(t)

ks := testutil.GenerateCids(3)
latency := time.Millisecond * 20
latMultiplier := 1
Expand Down Expand Up @@ -225,8 +218,6 @@ func TestDontHaveTimeoutWantCancelWant(t *testing.T) {
}

func TestDontHaveTimeoutRepeatedAddPending(t *testing.T) {
test.Flaky(t)

ks := testutil.GenerateCids(10)
latency := time.Millisecond * 5
latMultiplier := 1
Expand Down Expand Up @@ -260,8 +251,6 @@ func TestDontHaveTimeoutRepeatedAddPending(t *testing.T) {
}

func TestDontHaveTimeoutMgrMessageLatency(t *testing.T) {
test.Flaky(t)

ks := testutil.GenerateCids(2)
latency := time.Millisecond * 40
latMultiplier := 1
Expand Down Expand Up @@ -311,8 +300,6 @@ func TestDontHaveTimeoutMgrMessageLatency(t *testing.T) {
}

func TestDontHaveTimeoutMgrMessageLatencyMax(t *testing.T) {
test.Flaky(t)

ks := testutil.GenerateCids(2)
clock := clock.NewMock()
pinged := make(chan struct{})
Expand Down Expand Up @@ -346,8 +333,6 @@ func TestDontHaveTimeoutMgrMessageLatencyMax(t *testing.T) {
}

func TestDontHaveTimeoutMgrUsesDefaultTimeoutIfPingError(t *testing.T) {
test.Flaky(t)

ks := testutil.GenerateCids(2)
latency := time.Millisecond * 1
latMultiplier := 2
Expand Down Expand Up @@ -389,8 +374,6 @@ func TestDontHaveTimeoutMgrUsesDefaultTimeoutIfPingError(t *testing.T) {
}

func TestDontHaveTimeoutMgrUsesDefaultTimeoutIfLatencyLonger(t *testing.T) {
test.Flaky(t)

ks := testutil.GenerateCids(2)
latency := time.Millisecond * 200
latMultiplier := 1
Expand Down Expand Up @@ -431,8 +414,6 @@ func TestDontHaveTimeoutMgrUsesDefaultTimeoutIfLatencyLonger(t *testing.T) {
}

func TestDontHaveTimeoutNoTimeoutAfterShutdown(t *testing.T) {
test.Flaky(t)

ks := testutil.GenerateCids(2)
latency := time.Millisecond * 10
latMultiplier := 1
Expand Down
Loading