forked from redpanda-data/connect
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add manual partitioning to Kakfa output component (redpanda-data#857)
- Loading branch information
Showing
7 changed files
with
136 additions
and
9 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,35 @@ | ||
package tests | ||
|
||
import ( | ||
"testing" | ||
|
||
"github.com/Jeffail/benthos/v3/lib/log" | ||
"github.com/Jeffail/benthos/v3/lib/metrics" | ||
"github.com/Jeffail/benthos/v3/lib/output/writer" | ||
"github.com/Jeffail/benthos/v3/lib/types" | ||
"github.com/stretchr/testify/require" | ||
|
||
_ "github.com/Jeffail/benthos/v3/public/components/all" | ||
) | ||
|
||
func TestKafkaConfigurationManualPartitioner(t *testing.T) { | ||
conf := writer.NewKafkaConfig() | ||
require.NoError(t, createKafkaWriter(conf), "Expected no error with default configuration") | ||
|
||
conf.Partitioner = "manual" | ||
require.Error(t, createKafkaWriter(conf), "Expected error with manual partitioner set and partition unset") | ||
|
||
conf.Partition = "test" | ||
require.NoError(t, createKafkaWriter(conf), "Expected no error with manual partitioner set and partition set") | ||
|
||
conf.Partitioner = "random" | ||
require.Error(t, createKafkaWriter(conf), "Expected error with non-manual partitioner set and partition set") | ||
|
||
conf.Partition = "" | ||
require.NoError(t, createKafkaWriter(conf), "Expected no error with non-manual partitioner set and partition unset") | ||
} | ||
|
||
func createKafkaWriter(conf writer.KafkaConfig) error { | ||
_, err := writer.NewKafka(conf, types.NoopMgr(), log.Noop(), metrics.Noop()) | ||
return err | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters