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

Function TestClusterAdminAlterPartitionReassignmentsWithDiffVersion

admin_test.go:562–599  ·  view source on GitHub ↗
(t *testing.T)

Source from the content-addressed store, hash-verified

560}
561
562func TestClusterAdminAlterPartitionReassignmentsWithDiffVersion(t *testing.T) {
563 seedBroker := NewMockBroker(t, 1)
564 defer seedBroker.Close()
565
566 secondBroker := NewMockBroker(t, 2)
567 defer secondBroker.Close()
568
569 seedBroker.SetHandlerByMap(map[string]MockResponse{
570 "MetadataRequest": NewMockMetadataResponse(t).
571 SetController(secondBroker.BrokerID()).
572 SetBroker(seedBroker.Addr(), seedBroker.BrokerID()).
573 SetBroker(secondBroker.Addr(), secondBroker.BrokerID()),
574 })
575
576 secondBroker.SetHandlerByMap(map[string]MockResponse{
577 "AlterPartitionReassignmentsRequest": NewMockAlterPartitionReassignmentsResponse(t),
578 })
579
580 config := NewTestConfig()
581 config.Version = V2_3_0_0
582 admin, err := NewClusterAdmin([]string{seedBroker.Addr()}, config)
583 if err != nil {
584 t.Fatal(err)
585 }
586
587 topicAssignment := make([][]int32, 0, 3)
588
589 err = admin.AlterPartitionReassignments("my_topic", topicAssignment)
590
591 if !strings.ContainsAny(err.Error(), ErrUnsupportedVersion.Error()) {
592 t.Fatal(err)
593 }
594
595 err = admin.Close()
596 if err != nil {
597 t.Fatal(err)
598 }
599}
600
601func TestClusterAdminListPartitionReassignments(t *testing.T) {
602 seedBroker := NewMockBroker(t, 1)

Callers

nothing calls this directly

Calls 15

CloseMethod · 0.95
SetHandlerByMapMethod · 0.95
BrokerIDMethod · 0.95
AddrMethod · 0.95
CloseMethod · 0.95
NewMockBrokerFunction · 0.85
NewMockMetadataResponseFunction · 0.85
NewClusterAdminFunction · 0.85
SetBrokerMethod · 0.80
SetControllerMethod · 0.80

Tested by

no test coverage detected