Skip to content

Commit

Permalink
feat: fix unit test case for retry producing 5 times in batch_consumer
Browse files Browse the repository at this point in the history
  • Loading branch information
pinarrkok committed Dec 22, 2024
1 parent 4e38c53 commit 7d8489f
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 1 deletion.
7 changes: 7 additions & 0 deletions batch_consumer_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -532,6 +532,13 @@ func (m *mockCronsumer) GetMetricCollectors() []prometheus.Collector {
}

func (m *mockCronsumer) ProduceBatch([]kcronsumer.Message) error {
if m.retryBehaviorOpen {
if m.wantErr && m.times <= m.maxRetry {
m.times++
return errors.New("error")
}
return nil
}
if m.wantErr {
return errors.New("error")
}
Expand Down
2 changes: 1 addition & 1 deletion examples/docker-compose.yml
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ services:
- "4318:4318"

zookeeper:
image: debezium/zookeeper:2.4
image: debezium/zookeeper
ports:
- "2181:2181"

Expand Down

0 comments on commit 7d8489f

Please sign in to comment.