File tree Expand file tree Collapse file tree 2 files changed +5
-9
lines changed Expand file tree Collapse file tree 2 files changed +5
-9
lines changed Original file line number Diff line number Diff line change @@ -47,11 +47,11 @@ func (a *StatsAPI) now() time.Time {
47
47
}
48
48
49
49
func (a * StatsAPI ) UpdateStats (ctx context.Context , req * agentproto.UpdateStatsRequest ) (* agentproto.UpdateStatsResponse , error ) {
50
- // An empty stat means it's just looking for the report interval.
51
50
res := & agentproto.UpdateStatsResponse {
52
51
ReportInterval : durationpb .New (a .AgentStatsRefreshInterval ),
53
52
}
54
- if req .Stats == nil || len (req .Stats .ConnectionsByProto ) == 0 {
53
+ // An empty stat means it's just looking for the report interval.
54
+ if req .Stats == nil {
55
55
return res , nil
56
56
}
57
57
Original file line number Diff line number Diff line change @@ -222,9 +222,7 @@ func TestUpdateStates(t *testing.T) {
222
222
223
223
req = & agentproto.UpdateStatsRequest {
224
224
Stats : & agentproto.Stats {
225
- ConnectionsByProto : map [string ]int64 {
226
- "tcp" : 1 ,
227
- },
225
+ ConnectionsByProto : map [string ]int64 {},
228
226
ConnectionCount : 0 ,
229
227
ConnectionMedianLatencyMs : 23 ,
230
228
},
@@ -262,16 +260,14 @@ func TestUpdateStates(t *testing.T) {
262
260
require .NoError (t , err )
263
261
})
264
262
265
- t .Run ("NoConnectionsByProto " , func (t * testing.T ) {
263
+ t .Run ("NoStats " , func (t * testing.T ) {
266
264
t .Parallel ()
267
265
268
266
var (
269
267
dbM = dbmock .NewMockStore (gomock .NewController (t ))
270
268
ps = pubsub .NewInMemory ()
271
269
req = & agentproto.UpdateStatsRequest {
272
- Stats : & agentproto.Stats {
273
- ConnectionsByProto : map [string ]int64 {}, // len() == 0
274
- },
270
+ Stats : nil ,
275
271
}
276
272
)
277
273
api := agentapi.StatsAPI {
You can’t perform that action at this time.
0 commit comments