forked from elastic/beats
-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Update sarama (kafka client) (elastic#7025)
- update sarama to v1.16.0 - Use kafka 1.0.0 for testing - add supported kafka versions up to 1.1.0 - Fix lz4 not being configurable - Add unit test on config validation - Separate kafka version definitions
- Loading branch information
Showing
98 changed files
with
6,559 additions
and
452 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,41 @@ | ||
package kafka | ||
|
||
import ( | ||
"testing" | ||
|
||
"github.com/elastic/beats/libbeat/common" | ||
) | ||
|
||
func TestConfigAcceptValid(t *testing.T) { | ||
tests := map[string]common.MapStr{ | ||
"default config is valid": common.MapStr{}, | ||
"lz4 with 0.11": common.MapStr{ | ||
"compression": "lz4", | ||
"version": "0.11", | ||
}, | ||
"lz4 with 1.0": common.MapStr{ | ||
"compression": "lz4", | ||
"version": "1.0.0", | ||
}, | ||
} | ||
|
||
for name, test := range tests { | ||
test := test | ||
t.Run(name, func(t *testing.T) { | ||
c, err := common.NewConfigFrom(test) | ||
if err != nil { | ||
t.Fatalf("Can not create test configuration: %v", err) | ||
} | ||
c.SetString("hosts", 0, "localhost") | ||
|
||
cfg := defaultConfig() | ||
if err := c.Unpack(&cfg); err != nil { | ||
t.Fatalf("Unpacking configuration failed: %v", err) | ||
} | ||
|
||
if _, err := newSaramaConfig(&cfg); err != nil { | ||
t.Fatalf("Failure creating sarama config: %v", err) | ||
} | ||
}) | ||
} | ||
} |
Oops, something went wrong.