MCPcopy Create free account
hub / github.com/IBM/sarama / TestClusterAdminCreatePartitionsWithDiffVersion

Function TestClusterAdminCreatePartitionsWithDiffVersion

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

Source from the content-addressed store, hash-verified

526}
527
528func TestClusterAdminCreatePartitionsWithDiffVersion(t *testing.T) {
529 seedBroker := NewMockBroker(t, 1)
530 defer seedBroker.Close()
531
532 seedBroker.SetHandlerByMap(map[string]MockResponse{
533 "MetadataRequest": NewMockMetadataResponse(t).
534 SetController(seedBroker.BrokerID()).
535 SetBroker(seedBroker.Addr(), seedBroker.BrokerID()),
536 "CreatePartitionsRequest": NewMockCreatePartitionsResponse(t),
537 })
538
539 config := NewTestConfig()
540 config.Version = V0_10_2_0
541 admin, err := NewClusterAdmin([]string{seedBroker.Addr()}, config)
542 if err != nil {
543 t.Fatal(err)
544 }
545
546 err = admin.CreatePartitions("my_topic", 3, nil, false)
547 if !errors.Is(err, ErrUnsupportedVersion) {
548 t.Fatal(err)
549 }
550
551 err = admin.Close()
552 if err != nil {
553 t.Fatal(err)
554 }
555}
556
557func TestClusterAdminCreatePartitionsWithoutAuthorization(t *testing.T) {
558 seedBroker := NewMockBroker(t, 1)

Callers

nothing calls this directly

Calls 15

CloseMethod · 0.95
SetHandlerByMapMethod · 0.95
BrokerIDMethod · 0.95
AddrMethod · 0.95
CreatePartitionsMethod · 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