MCPcopy
hub / github.com/cilium/cilium / TestPrinter_WriteServerStatusResponse

Function TestPrinter_WriteServerStatusResponse

hubble/pkg/printer/printer_test.go:1442–1656  ·  view source on GitHub ↗
(t *testing.T)

Source from the content-addressed store, hash-verified

1440}
1441
1442func TestPrinter_WriteServerStatusResponse(t *testing.T) {
1443 buf := bytes.Buffer{}
1444 ss := &observerpb.ServerStatusResponse{
1445 NumFlows: 2031,
1446 MaxFlows: 4095,
1447 SeenFlows: 2348885,
1448 FlowsRate: 23.456,
1449 UptimeNs: 301515181665,
1450 Version: "cilium v1.15.0+g4145278",
1451 }
1452 sso := &observerpb.ServerStatusResponse{
1453 NumFlows: 2031,
1454 MaxFlows: 4095,
1455 SeenFlows: 2348885,
1456 UptimeNs: 301515181665,
1457 Version: "cilium v1.10.3+g4145278",
1458 }
1459 ssn := &observerpb.ServerStatusResponse{
1460 NumFlows: 2771,
1461 MaxFlows: 8190,
1462 SeenFlows: 2771,
1463 FlowsRate: 23.456,
1464 UptimeNs: 301515181665,
1465 Version: "hubble-relay v1.15.0+g4145278",
1466 NumConnectedNodes: &wrapperspb.UInt32Value{Value: 2},
1467 NumUnavailableNodes: &wrapperspb.UInt32Value{Value: 0},
1468 }
1469 type args struct {
1470 ss *observerpb.ServerStatusResponse
1471 }
1472 tests := []struct {
1473 name string
1474 options []Option
1475 args args
1476 wantErr bool
1477 expected string
1478 }{
1479 {
1480 name: "tabular",
1481 options: []Option{
1482 WithColor("never"),
1483 Writer(&buf),
1484 },
1485 args: args{ss},
1486 wantErr: false,
1487 expected: `
1488NUM FLOWS MAX FLOWS SEEN FLOWS FLOWS PER SECOND UPTIME NUM CONNECTED NODES NUM UNAVAILABLE NODES VERSION
14892,031 4,095 2,348,885 23.46 5m1.515181665s N/A N/A cilium v1.15.0+g4145278`,
1490 }, {
1491 name: "tabular-with-nodes",
1492 options: []Option{
1493 WithColor("never"),
1494 Writer(&buf),
1495 },
1496 args: args{ssn},
1497 wantErr: false,
1498 expected: `
1499NUM FLOWS MAX FLOWS SEEN FLOWS FLOWS PER SECOND UPTIME NUM CONNECTED NODES NUM UNAVAILABLE NODES VERSION

Callers

nothing calls this directly

Calls 13

ResetMethod · 0.95
StringMethod · 0.95
WithColorFunction · 0.85
CompactFunction · 0.85
JSONPBFunction · 0.85
DictFunction · 0.85
WriterFunction · 0.70
NewFunction · 0.70
RunMethod · 0.65
CloseMethod · 0.65
EqualMethod · 0.65

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…