MCPcopy
hub / github.com/IBM/sarama / TestFuncAdminDescribeLogDirs

Function TestFuncAdminDescribeLogDirs

functional_admin_test.go:664–705  ·  view source on GitHub ↗
(t *testing.T)

Source from the content-addressed store, hash-verified

662}
663
664func TestFuncAdminDescribeLogDirs(t *testing.T) {
665 t.Parallel()
666 checkKafkaVersion(t, "2.0.0.0")
667 setupFunctionalTest(t)
668 defer teardownFunctionalTest(t)
669
670 kafkaVersion, err := ParseKafkaVersion(FunctionalTestEnv.KafkaVersion)
671 if err != nil {
672 t.Fatal(err)
673 }
674
675 config := NewFunctionalTestConfig()
676 adminClient, err := NewClusterAdmin(FunctionalTestEnv.KafkaBrokerAddrs, config)
677 if err != nil {
678 t.Fatal(err)
679 }
680 defer safeClose(t, adminClient)
681
682 brokerIDs := make([]int32, len(FunctionalTestEnv.KafkaBrokerAddrs))
683 for i := range brokerIDs {
684 brokerIDs[i] = int32(i + 1)
685 }
686
687 res, err := adminClient.DescribeLogDirs(brokerIDs)
688 if err != nil {
689 t.Fatal(err)
690 }
691 if len(res) != len(FunctionalTestEnv.KafkaBrokerAddrs) {
692 t.Errorf("should have %d broker replies, got %v\n", len(FunctionalTestEnv.KafkaBrokerAddrs), len(res))
693 }
694
695 for _, resp := range res {
696 for _, logDir := range resp {
697 assert.Equal(t, ErrNoError, logDir.ErrorCode)
698 // assert that total bytes and usable bytes were returned for kafka 3.3 and newer
699 if kafkaVersion.IsAtLeast(V3_3_0_0) {
700 assert.NotZero(t, logDir.TotalBytes)
701 assert.NotZero(t, logDir.UsableBytes)
702 }
703 }
704 }
705}
706
707func TestFuncAdminDescribeConfig(t *testing.T) {
708 t.Parallel()

Callers

nothing calls this directly

Calls 11

DescribeLogDirsMethod · 0.95
checkKafkaVersionFunction · 0.85
setupFunctionalTestFunction · 0.85
teardownFunctionalTestFunction · 0.85
ParseKafkaVersionFunction · 0.85
NewFunctionalTestConfigFunction · 0.85
NewClusterAdminFunction · 0.85
FatalMethod · 0.80
IsAtLeastMethod · 0.80
safeCloseFunction · 0.70
ErrorfMethod · 0.65

Tested by

no test coverage detected