Skip to content

Commit

Permalink
pipeline: test file receiver shouldAutocommit()
Browse files Browse the repository at this point in the history
  • Loading branch information
adamdecaf committed Mar 9, 2023
1 parent 4af57d6 commit b0e11d0
Showing 1 changed file with 18 additions and 0 deletions.
18 changes: 18 additions & 0 deletions internal/pipeline/file_receiver_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -56,6 +56,24 @@ func testFileReceiver(t *testing.T) *FileReceiver {
return fileRec
}

func TestFileReceiver__shouldAutocommit(t *testing.T) {
fr := testFileReceiver(t)

// Ensure the setup is as we expect
require.Nil(t, fr.cfg.Inbound.Kafka)
require.False(t, fr.shouldAutocommit())

// Set a config with AutoCommit disabled
fr.cfg.Inbound.Kafka = &service.KafkaConfig{
AutoCommit: false,
}
require.False(t, fr.shouldAutocommit())

// Set .AutoCommit to true
fr.cfg.Inbound.Kafka.AutoCommit = true
require.True(t, fr.shouldAutocommit())
}

func TestFileReceiver__contains(t *testing.T) {
err := errors.New("pubsub (code=Unknown): write tcp 10.100.53.92:45360->12.132.211.32:2222: write: broken pipe")

Expand Down

0 comments on commit b0e11d0

Please sign in to comment.