@@ -29,7 +29,7 @@ import (
2929
3030func TestInspector_Send_NoSessions (t * testing.T ) {
3131 underTest := New (log .Nop (), 10 )
32- underTest .Send (record.Record {})
32+ underTest .Send (context . Background (), record.Record {})
3333}
3434
3535func TestInspector_Send_SingleSession (t * testing.T ) {
@@ -39,7 +39,7 @@ func TestInspector_Send_SingleSession(t *testing.T) {
3939 r := record.Record {
4040 Position : record .Position ("test-pos" ),
4141 }
42- underTest .Send (r )
42+ underTest .Send (context . Background (), r )
4343 assertGotRecord (is .New (t ), s , r )
4444}
4545
@@ -53,7 +53,7 @@ func TestInspector_Send_MultipleSessions(t *testing.T) {
5353 r := record.Record {
5454 Position : record .Position ("test-pos" ),
5555 }
56- underTest .Send (r )
56+ underTest .Send (context . Background (), r )
5757 assertGotRecord (is , s1 , r )
5858 assertGotRecord (is , s2 , r )
5959}
@@ -67,12 +67,16 @@ func TestInspector_Send_SessionClosed(t *testing.T) {
6767 r := record.Record {
6868 Position : record .Position ("test-pos" ),
6969 }
70- underTest .Send (r )
70+ underTest .Send (context . Background (), r )
7171 assertGotRecord (is .New (t ), s , r )
7272
73- err := cerrors .New ("yet another error" )
74- s .Close (err )
75- is .True (cerrors .Is (s .CloseReason , err ))
73+ s .Close ()
74+ underTest .Send (
75+ context .Background (),
76+ record.Record {
77+ Position : record .Position ("test-pos-2" ),
78+ },
79+ )
7680}
7781
7882func TestInspector_Send_SessionCtxCanceled (t * testing.T ) {
@@ -85,12 +89,18 @@ func TestInspector_Send_SessionCtxCanceled(t *testing.T) {
8589 r := record.Record {
8690 Position : record .Position ("test-pos" ),
8791 }
88- underTest .Send (r )
92+ underTest .Send (context . Background (), r )
8993 assertGotRecord (is .New (t ), s , r )
9094
9195 cancel ()
9296 time .Sleep (100 * time .Millisecond )
93- is .True (cerrors .Is (s .CloseReason , context .Canceled ))
97+
98+ select {
99+ case _ , ok := <- s .C :
100+ is .True (! ok ) // expected no record
101+ default :
102+ is .Fail () // expected channel to be closed
103+ }
94104}
95105
96106func TestInspector_Send_SlowConsumer (t * testing.T ) {
@@ -106,9 +116,12 @@ func TestInspector_Send_SlowConsumer(t *testing.T) {
106116 s := underTest .NewSession (context .Background ())
107117
108118 for i := 0 ; i < bufferSize + 1 ; i ++ {
109- s .send (record.Record {
110- Position : record .Position (fmt .Sprintf ("test-pos-%v" , i )),
111- })
119+ s .send (
120+ context .Background (),
121+ record.Record {
122+ Position : record .Position (fmt .Sprintf ("test-pos-%v" , i )),
123+ },
124+ )
112125 }
113126
114127 for i := 0 ; i < bufferSize ; i ++ {
0 commit comments