(t *testing.T)
| 599 | } |
| 600 | |
| 601 | func TestClusterAdminListPartitionReassignments(t *testing.T) { |
| 602 | seedBroker := NewMockBroker(t, 1) |
| 603 | defer seedBroker.Close() |
| 604 | |
| 605 | secondBroker := NewMockBroker(t, 2) |
| 606 | defer secondBroker.Close() |
| 607 | |
| 608 | seedBroker.SetHandlerByMap(map[string]MockResponse{ |
| 609 | "ApiVersionsRequest": NewMockApiVersionsResponse(t), |
| 610 | "MetadataRequest": NewMockMetadataResponse(t). |
| 611 | SetController(secondBroker.BrokerID()). |
| 612 | SetBroker(seedBroker.Addr(), seedBroker.BrokerID()). |
| 613 | SetBroker(secondBroker.Addr(), secondBroker.BrokerID()), |
| 614 | }) |
| 615 | |
| 616 | secondBroker.SetHandlerByMap(map[string]MockResponse{ |
| 617 | "ApiVersionsRequest": NewMockApiVersionsResponse(t), |
| 618 | "ListPartitionReassignmentsRequest": NewMockListPartitionReassignmentsResponse(t), |
| 619 | }) |
| 620 | |
| 621 | config := NewTestConfig() |
| 622 | config.Version = V2_4_0_0 |
| 623 | admin, err := NewClusterAdmin([]string{seedBroker.Addr()}, config) |
| 624 | if err != nil { |
| 625 | t.Fatal(err) |
| 626 | } |
| 627 | |
| 628 | response, err := admin.ListPartitionReassignments("my_topic", []int32{0, 1}) |
| 629 | if err != nil { |
| 630 | t.Fatal(err) |
| 631 | } |
| 632 | |
| 633 | partitionStatus, ok := response["my_topic"] |
| 634 | if !ok { |
| 635 | t.Fatalf("topic missing in response") |
| 636 | } |
| 637 | |
| 638 | if len(partitionStatus) != 2 { |
| 639 | t.Fatalf("partition missing in response") |
| 640 | } |
| 641 | |
| 642 | err = admin.Close() |
| 643 | if err != nil { |
| 644 | t.Fatal(err) |
| 645 | } |
| 646 | } |
| 647 | |
| 648 | func TestClusterAdminListPartitionReassignmentsWithDiffVersion(t *testing.T) { |
| 649 | seedBroker := NewMockBroker(t, 1) |
nothing calls this directly
no test coverage detected