Skip to content

Commit

Permalink
Add unit test for with/without Kafka executor message key
Browse files Browse the repository at this point in the history
  • Loading branch information
devops committed Oct 9, 2021
1 parent 4339456 commit 3d91bcd
Showing 1 changed file with 22 additions and 2 deletions.
24 changes: 22 additions & 2 deletions builtin/bins/dkron-executor-kafka/kafka_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -7,12 +7,13 @@ import (
dktypes "github.com/distribworks/dkron/v3/plugin/types"
)

func TestProduceExecute(t *testing.T) {
func TestProduceExecuteWithKey(t *testing.T) {
pa := &dktypes.ExecuteRequest{
JobName: "testJob",
JobName: "testJobWithKey",
Config: map[string]string{
"topic": "test",
"brokerAddress": "testaddress",
"key": "testkey",
"message": "{\"hello\":11}",
"debug": "true",
},
Expand All @@ -25,3 +26,22 @@ func TestProduceExecute(t *testing.T) {
t.Fatal(err)
}
}

func TestProduceExecuteWithoutKey(t *testing.T) {
pa := &dktypes.ExecuteRequest{
JobName: "testJobWithoutKey",
Config: map[string]string{
"topic": "test",
"brokerAddress": "testaddress",
"message": "{\"hello\":11}",
"debug": "true",
},
}
kafka := &Kafka{}
output, err := kafka.Execute(pa, nil)
fmt.Println(string(output.Output))
fmt.Println(err)
if err != nil {
t.Fatal(err)
}
}

0 comments on commit 3d91bcd

Please sign in to comment.