Skip to content

Commit

Permalink
WIP
Browse files Browse the repository at this point in the history
  • Loading branch information
hannahhoward committed May 5, 2020
1 parent 9a1d95f commit 2536126
Showing 1 changed file with 6 additions and 0 deletions.
6 changes: 6 additions & 0 deletions impl/graphsync/graphsync_impl_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -935,10 +935,14 @@ func TestDataTransferPushRoundTrip(t *testing.T) {
dt2 := NewGraphSyncDataTransfer(host2, gs2, gsData.StoredCounter2)

finished := make(chan struct{}, 2)
errChan := make(chan struct{}, 2)
var subscriber datatransfer.Subscriber = func(event datatransfer.Event, channelState datatransfer.ChannelState) {
if event.Code == datatransfer.Complete {
finished <- struct{}{}
}
if event.Code == datatransfer.Error {
errChan <- struct{}{}
}
}
dt1.SubscribeToEvents(subscriber)
dt2.SubscribeToEvents(subscriber)
Expand All @@ -954,6 +958,8 @@ func TestDataTransferPushRoundTrip(t *testing.T) {
case <-ctx.Done():
t.Fatal("Did not complete succcessful data transfer")
case <-finished:
case <-errChan:
t.Fatal("received error on data transfer")
}
}
gsData.VerifyFileTransferred(t, root, true)
Expand Down

0 comments on commit 2536126

Please sign in to comment.