@@ -34,14 +34,14 @@ func TestStatsReporter(t *testing.T) {
34
34
}()
35
35
36
36
// initial request to get duration
37
- req := testutil .RequireRecvCtx (ctx , t , fDest .reqs )
37
+ req := testutil .TryReceive (ctx , t , fDest .reqs )
38
38
require .NotNil (t , req )
39
39
require .Nil (t , req .Stats )
40
40
interval := time .Second * 34
41
- testutil .RequireSendCtx (ctx , t , fDest .resps , & proto.UpdateStatsResponse {ReportInterval : durationpb .New (interval )})
41
+ testutil .RequireSend (ctx , t , fDest .resps , & proto.UpdateStatsResponse {ReportInterval : durationpb .New (interval )})
42
42
43
43
// call to source to set the callback and interval
44
- gotInterval := testutil .RequireRecvCtx (ctx , t , fSource .period )
44
+ gotInterval := testutil .TryReceive (ctx , t , fSource .period )
45
45
require .Equal (t , interval , gotInterval )
46
46
47
47
// callback returning netstats
@@ -60,7 +60,7 @@ func TestStatsReporter(t *testing.T) {
60
60
fSource .callback (time .Now (), time .Now (), netStats , nil )
61
61
62
62
// collector called to complete the stats
63
- gotNetStats := testutil .RequireRecvCtx (ctx , t , fCollector .calls )
63
+ gotNetStats := testutil .TryReceive (ctx , t , fCollector .calls )
64
64
require .Equal (t , netStats , gotNetStats )
65
65
66
66
// while we are collecting the stats, send in two new netStats to simulate
@@ -94,13 +94,13 @@ func TestStatsReporter(t *testing.T) {
94
94
95
95
// complete first collection
96
96
stats := & proto.Stats {SessionCountJetbrains : 55 }
97
- testutil .RequireSendCtx (ctx , t , fCollector .stats , stats )
97
+ testutil .RequireSend (ctx , t , fCollector .stats , stats )
98
98
99
99
// destination called to report the first stats
100
- update := testutil .RequireRecvCtx (ctx , t , fDest .reqs )
100
+ update := testutil .TryReceive (ctx , t , fDest .reqs )
101
101
require .NotNil (t , update )
102
102
require .Equal (t , stats , update .Stats )
103
- testutil .RequireSendCtx (ctx , t , fDest .resps , & proto.UpdateStatsResponse {ReportInterval : durationpb .New (interval )})
103
+ testutil .RequireSend (ctx , t , fDest .resps , & proto.UpdateStatsResponse {ReportInterval : durationpb .New (interval )})
104
104
105
105
// second update -- netStat0 and netStats1 are accumulated and reported
106
106
wantNetStats := map [netlogtype.Connection ]netlogtype.Counts {
@@ -115,22 +115,22 @@ func TestStatsReporter(t *testing.T) {
115
115
RxBytes : 21 ,
116
116
},
117
117
}
118
- gotNetStats = testutil .RequireRecvCtx (ctx , t , fCollector .calls )
118
+ gotNetStats = testutil .TryReceive (ctx , t , fCollector .calls )
119
119
require .Equal (t , wantNetStats , gotNetStats )
120
120
stats = & proto.Stats {SessionCountJetbrains : 66 }
121
- testutil .RequireSendCtx (ctx , t , fCollector .stats , stats )
122
- update = testutil .RequireRecvCtx (ctx , t , fDest .reqs )
121
+ testutil .RequireSend (ctx , t , fCollector .stats , stats )
122
+ update = testutil .TryReceive (ctx , t , fDest .reqs )
123
123
require .NotNil (t , update )
124
124
require .Equal (t , stats , update .Stats )
125
125
interval2 := 27 * time .Second
126
- testutil .RequireSendCtx (ctx , t , fDest .resps , & proto.UpdateStatsResponse {ReportInterval : durationpb .New (interval2 )})
126
+ testutil .RequireSend (ctx , t , fDest .resps , & proto.UpdateStatsResponse {ReportInterval : durationpb .New (interval2 )})
127
127
128
128
// set the new interval
129
- gotInterval = testutil .RequireRecvCtx (ctx , t , fSource .period )
129
+ gotInterval = testutil .TryReceive (ctx , t , fSource .period )
130
130
require .Equal (t , interval2 , gotInterval )
131
131
132
132
loopCancel ()
133
- err := testutil .RequireRecvCtx (ctx , t , loopErr )
133
+ err := testutil .TryReceive (ctx , t , loopErr )
134
134
require .NoError (t , err )
135
135
}
136
136
0 commit comments