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

Function TestClusterAdminCreatePartitionsWithDiffVersion

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

Source from the content-addressed store, hash-verified

462}
463
464func TestClusterAdminCreatePartitionsWithDiffVersion(t *testing.T) {
465 seedBroker := NewMockBroker(t, 1)
466 defer seedBroker.Close()
467
468 seedBroker.SetHandlerByMap(map[string]MockResponse{
469 "MetadataRequest": NewMockMetadataResponse(t).
470 SetController(seedBroker.BrokerID()).
471 SetBroker(seedBroker.Addr(), seedBroker.BrokerID()),
472 "CreatePartitionsRequest": NewMockCreatePartitionsResponse(t),
473 })
474
475 config := NewTestConfig()
476 config.Version = V0_10_2_0
477 admin, err := NewClusterAdmin([]string{seedBroker.Addr()}, config)
478 if err != nil {
479 t.Fatal(err)
480 }
481
482 err = admin.CreatePartitions("my_topic", 3, nil, false)
483 if !errors.Is(err, ErrUnsupportedVersion) {
484 t.Fatal(err)
485 }
486
487 err = admin.Close()
488 if err != nil {
489 t.Fatal(err)
490 }
491}
492
493func TestClusterAdminCreatePartitionsWithoutAuthorization(t *testing.T) {
494 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