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

fix: Ignore stream close error in ProposeDeal #793

Merged
merged 1 commit into from
May 30, 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
3 changes: 1 addition & 2 deletions shared_testutil/test_network_types.go
Original file line number Diff line number Diff line change
Expand Up @@ -419,7 +419,6 @@ type TestStorageDealStream struct {
responseWriter StorageDealResponseWriter

CloseCount int
CloseError error
}

// TestStorageDealStreamParams are parameters used to setup a TestStorageDealStream.
Expand Down Expand Up @@ -485,7 +484,7 @@ func (tsds TestStorageDealStream) RemotePeer() peer.ID { return tsds.p }
// Close closes the stream (does nothing for mocked stream)
func (tsds *TestStorageDealStream) Close() error {
tsds.CloseCount += 1
return tsds.CloseError
return nil
}

// TrivialStorageDealProposalReader succeeds trivially, returning an empty proposal.
Expand Down
3 changes: 2 additions & 1 deletion storagemarket/impl/clientstates/client_states.go
Original file line number Diff line number Diff line change
Expand Up @@ -106,7 +106,8 @@ func ProposeDeal(ctx fsm.Context, environment ClientDealEnvironment, deal storag

err = s.Close()
if err != nil {
return ctx.Trigger(storagemarket.ClientEventStreamCloseError, err)
// doesn't really matter but log the error
log.Debugw("failed to close deal stream", "error", err)
}

tok, _, err := environment.Node().GetChainHead(ctx.Context())
Expand Down
11 changes: 0 additions & 11 deletions storagemarket/impl/clientstates/client_states_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -157,17 +157,6 @@ func TestProposeDeal(t *testing.T) {
},
})
})
t.Run("closing the stream fails", func(t *testing.T) {
ds := tut.NewTestStorageDealStream(tut.TestStorageDealStreamParams{})
ds.CloseError = xerrors.Errorf("failed to close stream")
runAndInspect(t, storagemarket.StorageDealFundsReserved, clientstates.ProposeDeal, testCase{
envParams: envParams{dealStream: ds},
inspector: func(deal storagemarket.ClientDeal, env *fakeEnvironment) {
tut.AssertDealState(t, storagemarket.StorageDealError, deal.State)
assert.Equal(t, "error attempting to close stream: failed to close stream", deal.Message)
},
})
})
t.Run("getting chain head fails", func(t *testing.T) {
ds := tut.NewTestStorageDealStream(tut.TestStorageDealStreamParams{})
runAndInspect(t, storagemarket.StorageDealFundsReserved, clientstates.ProposeDeal, testCase{
Expand Down