@@ -12,8 +12,6 @@ import (
1212 "time"
1313
1414 "github.com/zeebo/assert"
15-
16- "storj.io/drpc"
1715)
1816
1917// blockingWriter blocks in Write until unblock is closed, then returns err.
@@ -80,7 +78,7 @@ func TestMuxWriter(t *testing.T) {
8078 assert .NoError (t , err )
8179
8280 // Now stop the writer and close the pipe.
83- mw .Stop ()
81+ mw .Stop (errors . New ( "stopped" ) )
8482 <- mw .Done ()
8583 pw .Close ()
8684 pr .Close ()
@@ -90,12 +88,12 @@ func TestMuxWriter(t *testing.T) {
9088
9189func TestMuxWriter_WriteFrameAfterStop (t * testing.T ) {
9290 mw := NewMuxWriter (io .Discard , func (error ) {})
93- mw .Stop ()
91+ mw .Stop (errors . New ( "stopped" ) )
9492 <- mw .Done ()
9593
9694 err := mw .WriteFrame (RandFrame ())
9795 assert .Error (t , err )
98- assert .That (t , drpc . ClosedError . Has ( err ) )
96+ assert .Equal (t , err . Error (), "stopped" )
9997}
10098
10199func TestMuxWriter_ConcurrentWriteFrame (t * testing.T ) {
@@ -141,7 +139,7 @@ func TestMuxWriter_ConcurrentWriteFrame(t *testing.T) {
141139 got := make ([]byte , expSize )
142140 _ , err := io .ReadFull (pr , got )
143141 assert .NoError (t , err )
144- mw .Stop ()
142+ mw .Stop (errors . New ( "stopped" ) )
145143 <- mw .Done ()
146144 pw .Close ()
147145 pr .Close ()
@@ -190,7 +188,7 @@ func TestMuxWriter_OnErrorCallingStopDoesNotDeadlock(t *testing.T) {
190188 var mw * MuxWriter
191189 mw = NewMuxWriter (fw , func (err error ) {
192190 // Simulate manager.terminate calling Stop.
193- mw .Stop ()
191+ mw .Stop (errors . New ( "stopped" ) )
194192 })
195193
196194 assert .NoError (t , mw .WriteFrame (RandFrame ()))
@@ -218,7 +216,7 @@ func TestMuxWriter_BlockedWriteUnblockedByClose(t *testing.T) {
218216 }
219217
220218 // Simulate terminate: Stop, then unblock the writer (like tr.Close()).
221- mw .Stop ()
219+ mw .Stop (errors . New ( "stopped" ) )
222220 bw .err = errors .New ("closed" )
223221 close (bw .unblock )
224222
@@ -241,7 +239,7 @@ func TestMuxWriter_ConcurrentStop(t *testing.T) {
241239 for range n {
242240 go func () {
243241 defer wg .Done ()
244- mw .Stop ()
242+ mw .Stop (errors . New ( "stopped" ) )
245243 }()
246244 }
247245 wg .Wait ()
@@ -276,7 +274,7 @@ func TestMuxWriter_StopDiscardsBufferedData(t *testing.T) {
276274 }
277275
278276 // Stop without letting the blocked Write complete.
279- mw .Stop ()
277+ mw .Stop (errors . New ( "stopped" ) )
280278 bw .err = errors .New ("closed" )
281279 close (bw .unblock )
282280
@@ -322,7 +320,7 @@ func TestMuxWriter_WriteFrameDuringActiveDrain(t *testing.T) {
322320 close (g2 .ch )
323321
324322 // Both batches were written. Stop and verify.
325- mw .Stop ()
323+ mw .Stop (errors . New ( "stopped" ) )
326324 <- mw .Done ()
327325}
328326
0 commit comments