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

Function TestNewOffsetManager

offset_manager_test.go:86–112  ·  view source on GitHub ↗
(t *testing.T)

Source from the content-addressed store, hash-verified

84}
85
86func TestNewOffsetManager(t *testing.T) {
87 seedBroker := NewMockBroker(t, 1)
88 metadataResponse := new(MetadataResponse)
89 metadataResponse.AddBroker(seedBroker.Addr(), seedBroker.BrokerID())
90 seedBroker.Returns(metadataResponse)
91 findCoordResponse := new(FindCoordinatorResponse)
92 findCoordResponse.Coordinator = &Broker{id: seedBroker.brokerID, addr: seedBroker.Addr()}
93 seedBroker.Returns(findCoordResponse)
94 defer seedBroker.Close()
95
96 testClient, err := NewClient([]string{seedBroker.Addr()}, NewTestConfig())
97 if err != nil {
98 t.Fatal(err)
99 }
100
101 om, err := NewOffsetManagerFromClient("group", testClient)
102 if err != nil {
103 t.Error(err)
104 }
105 safeClose(t, om)
106 safeClose(t, testClient)
107
108 _, err = NewOffsetManagerFromClient("group", testClient)
109 if !errors.Is(err, ErrClosedClient) {
110 t.Errorf("Error expected for closed client; actual value: %v", err)
111 }
112}
113
114// Test that the correct sequence of offset commit messages is sent to a broker when
115// multiple goroutines for a group are committing offsets at the same time

Callers

nothing calls this directly

Calls 14

AddrMethod · 0.95
BrokerIDMethod · 0.95
ReturnsMethod · 0.95
CloseMethod · 0.95
NewMockBrokerFunction · 0.85
AddBrokerMethod · 0.80
FatalMethod · 0.80
IsMethod · 0.80
NewClientFunction · 0.70
NewTestConfigFunction · 0.70
safeCloseFunction · 0.70

Tested by

no test coverage detected