MCPcopy Create free account
hub / github.com/PasarGuard/node / TestGRPC_GetSystemStats

Function TestGRPC_GetSystemStats

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

Source from the content-addressed store, hash-verified

402}
403
404func TestGRPC_GetSystemStats(t *testing.T) {
405 ctx, cancel := context.WithTimeout(sharedTestCtx.ctxWithSession, 5*time.Second)
406 defer cancel()
407
408 nodeStats, err := sharedTestCtx.client.GetSystemStats(ctx, &common.Empty{})
409 if err != nil {
410 t.Fatalf("Failed to get node stats: %v", err)
411 }
412 log.Println("mem_total:", nodeStats.GetMemTotal())
413 log.Println("mem_usage:", nodeStats.GetMemUsed())
414 log.Println("cpu_usage:", nodeStats.GetCpuUsage())
415 log.Println("cpu_cores:", nodeStats.GetCpuCores())
416 log.Println("incoming_bandwidth:", nodeStats.GetIncomingBandwidthSpeed())
417 log.Println("outgoing_bandwidth:", nodeStats.GetOutgoingBandwidthSpeed())
418 log.Println("uptime:", nodeStats.GetUptime())
419}
420
421func TestGRPC_KeepAliveTimeout(t *testing.T) {
422 // Wait for keep alive to timeout (10 seconds + buffer)

Callers

nothing calls this directly

Calls 8

GetMemTotalMethod · 0.80
GetMemUsedMethod · 0.80
GetCpuUsageMethod · 0.80
GetCpuCoresMethod · 0.80
GetSystemStatsMethod · 0.65
GetUptimeMethod · 0.45

Tested by

no test coverage detected