(t *testing.T)
| 549 | } |
| 550 | |
| 551 | func (s) TestCZRecursiveDeletionOfEntry(t *testing.T) { |
| 552 | // +--+TopChan+---+ |
| 553 | // | | |
| 554 | // v v |
| 555 | // +-+SubChan1+--+ SubChan2 |
| 556 | // | | |
| 557 | // v v |
| 558 | // Socket1 Socket2 |
| 559 | |
| 560 | topChan := channelz.RegisterChannel(nil, "") |
| 561 | subChan1 := channelz.RegisterSubChannel(topChan, "") |
| 562 | subChan2 := channelz.RegisterSubChannel(topChan, "") |
| 563 | skt1 := channelz.RegisterSocket(&channelz.Socket{SocketType: channelz.SocketTypeNormal, Parent: subChan1}) |
| 564 | skt2 := channelz.RegisterSocket(&channelz.Socket{SocketType: channelz.SocketTypeNormal, Parent: subChan1}) |
| 565 | |
| 566 | tcs, _ := channelz.GetTopChannels(0, 0) |
| 567 | if tcs == nil || len(tcs) != 1 { |
| 568 | t.Fatalf("There should be one TopChannel entry") |
| 569 | } |
| 570 | if len(tcs[0].SubChans()) != 2 { |
| 571 | t.Fatalf("There should be two SubChannel entries") |
| 572 | } |
| 573 | sc := channelz.GetSubChannel(subChan1.ID) |
| 574 | if sc == nil || len(sc.Sockets()) != 2 { |
| 575 | t.Fatalf("There should be two Socket entries") |
| 576 | } |
| 577 | |
| 578 | channelz.RemoveEntry(topChan.ID) |
| 579 | tcs, _ = channelz.GetTopChannels(0, 0) |
| 580 | if tcs == nil || len(tcs) != 1 { |
| 581 | t.Fatalf("There should be one TopChannel entry") |
| 582 | } |
| 583 | |
| 584 | channelz.RemoveEntry(subChan1.ID) |
| 585 | channelz.RemoveEntry(subChan2.ID) |
| 586 | tcs, _ = channelz.GetTopChannels(0, 0) |
| 587 | if tcs == nil || len(tcs) != 1 { |
| 588 | t.Fatalf("There should be one TopChannel entry") |
| 589 | } |
| 590 | if len(tcs[0].SubChans()) != 1 { |
| 591 | t.Fatalf("There should be one SubChannel entry") |
| 592 | } |
| 593 | |
| 594 | channelz.RemoveEntry(skt1.ID) |
| 595 | channelz.RemoveEntry(skt2.ID) |
| 596 | tcs, _ = channelz.GetTopChannels(0, 0) |
| 597 | if tcs != nil { |
| 598 | t.Fatalf("There should be no TopChannel entry") |
| 599 | } |
| 600 | } |
| 601 | |
| 602 | func (s) TestCZChannelMetrics(t *testing.T) { |
| 603 | e := tcpClearRREnv |
nothing calls this directly
no test coverage detected