MCPcopy Index your code
hub / github.com/PasarGuard/node / TestGRPC_GetUsersStats

Function TestGRPC_GetUsersStats

controller/rpc/rpc_test.go:166–178  ·  view source on GitHub ↗
(t *testing.T)

Source from the content-addressed store, hash-verified

164}
165
166func TestGRPC_GetUsersStats(t *testing.T) {
167 ctx, cancel := context.WithTimeout(sharedTestCtx.ctxWithSession, 5*time.Second)
168 defer cancel()
169
170 stats, err := sharedTestCtx.client.GetStats(ctx, &common.StatRequest{Reset_: true, Type: common.StatType_UsersStat})
171 if err != nil {
172 t.Fatalf("Failed to get users stats: %v", err)
173 }
174
175 for _, stat := range stats.GetStats() {
176 log.Printf("Name: %s , Traffic: %d , Type: %s , Link: %s", stat.Name, stat.Value, stat.Type, stat.Link)
177 }
178}
179
180func TestGRPC_GetUserOnlineStats_NotFound(t *testing.T) {
181 ctx, cancel := context.WithTimeout(sharedTestCtx.ctxWithSession, 5*time.Second)

Callers

nothing calls this directly

Calls 1

GetStatsMethod · 0.65

Tested by

no test coverage detected