mirror of
https://github.com/akvorado/akvorado.git
synced 2025-12-11 22:14:02 +01:00
global: split Akvorado into 3 services
This commit is contained in:
36
inlet/kafka/config_test.go
Normal file
36
inlet/kafka/config_test.go
Normal file
@@ -0,0 +1,36 @@
|
||||
package kafka
|
||||
|
||||
import (
|
||||
"testing"
|
||||
|
||||
"github.com/Shopify/sarama"
|
||||
)
|
||||
|
||||
func TestCompressionCodecUnmarshal(t *testing.T) {
|
||||
cases := []struct {
|
||||
Input string
|
||||
Expected sarama.CompressionCodec
|
||||
ExpectedError bool
|
||||
}{
|
||||
{"none", sarama.CompressionNone, false},
|
||||
{"zstd", sarama.CompressionZSTD, false},
|
||||
{"gzip", sarama.CompressionGZIP, false},
|
||||
{"unknown", sarama.CompressionNone, true},
|
||||
}
|
||||
for _, tc := range cases {
|
||||
var cmp CompressionCodec
|
||||
err := cmp.UnmarshalText([]byte(tc.Input))
|
||||
if err != nil && !tc.ExpectedError {
|
||||
t.Errorf("UnmarshalText(%q) error:\n%+v", tc.Input, err)
|
||||
continue
|
||||
}
|
||||
if err == nil && tc.ExpectedError {
|
||||
t.Errorf("UnmarshalText(%q) got %v but expected error", tc.Input, cmp)
|
||||
continue
|
||||
}
|
||||
if cmp != CompressionCodec(tc.Expected) {
|
||||
t.Errorf("UnmarshalText(%q) got %v but expected %v", tc.Input, cmp, tc.Expected)
|
||||
continue
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user