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

Function TestClusterAdminAlterPartitionReassignments

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

Source from the content-addressed store, hash-verified

520}
521
522func TestClusterAdminAlterPartitionReassignments(t *testing.T) {
523 seedBroker := NewMockBroker(t, 1)
524 defer seedBroker.Close()
525
526 secondBroker := NewMockBroker(t, 2)
527 defer secondBroker.Close()
528
529 seedBroker.SetHandlerByMap(map[string]MockResponse{
530 "ApiVersionsRequest": NewMockApiVersionsResponse(t),
531 "MetadataRequest": NewMockMetadataResponse(t).
532 SetController(secondBroker.BrokerID()).
533 SetBroker(seedBroker.Addr(), seedBroker.BrokerID()).
534 SetBroker(secondBroker.Addr(), secondBroker.BrokerID()),
535 })
536
537 secondBroker.SetHandlerByMap(map[string]MockResponse{
538 "ApiVersionsRequest": NewMockApiVersionsResponse(t),
539 "AlterPartitionReassignmentsRequest": NewMockAlterPartitionReassignmentsResponse(t),
540 })
541
542 config := NewTestConfig()
543 config.Version = V2_4_0_0
544 admin, err := NewClusterAdmin([]string{seedBroker.Addr()}, config)
545 if err != nil {
546 t.Fatal(err)
547 }
548
549 topicAssignment := make([][]int32, 0, 3)
550
551 err = admin.AlterPartitionReassignments("my_topic", topicAssignment)
552 if err != nil {
553 t.Fatal(err)
554 }
555
556 err = admin.Close()
557 if err != nil {
558 t.Fatal(err)
559 }
560}
561
562func TestClusterAdminAlterPartitionReassignmentsWithDiffVersion(t *testing.T) {
563 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

Tested by

no test coverage detected