Skip to content

Commit c007a8e

Browse files
authored
Merge branch 'master' into 779-ES-autogenerate-id
2 parents 3489723 + e0b2331 commit c007a8e

File tree

2 files changed

+33
-17
lines changed

2 files changed

+33
-17
lines changed

.codecov.yml

Lines changed: 13 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,17 @@
1-
coverage:
2-
range: 100..100
3-
round: down
4-
precision: 2
5-
61
codecov:
72
notify:
83
require_ci_to_pass: yes
4+
strict_yaml_branch: master # only use the latest copy on master branch
5+
6+
coverage:
7+
precision: 2
8+
round: down
9+
range: "100...100"
10+
11+
status:
12+
project:
13+
default:
14+
target: 100
15+
patch: yes
16+
changes: no
917

10-
# see https://docs.codecov.io/docs/ignoring-paths
11-
ignore:
12-
- "model.pb*.go"

plugin/storage/kafka/factory_test.go

Lines changed: 20 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -71,15 +71,26 @@ func TestKafkaFactory(t *testing.T) {
7171
assert.Error(t, err)
7272
}
7373

74-
func TestKafkaFactoryProto(t *testing.T) {
75-
f := NewFactory()
76-
v, command := config.Viperize(f.AddFlags)
77-
command.ParseFlags([]string{"--kafka.encoding=protobuf"})
78-
f.InitFromViper(v)
79-
80-
f.config = &mockProducerBuilder{t: t}
81-
assert.NoError(t, f.Initialize(metrics.NullFactory, zap.NewNop()))
82-
assert.IsType(t, &protobufMarshaller{}, f.marshaller)
74+
func TestKafkaFactoryEncoding(t *testing.T) {
75+
tests := []struct {
76+
encoding string
77+
marshaller Marshaller
78+
}{
79+
{encoding: "protobuf", marshaller: new(protobufMarshaller)},
80+
{encoding: "json", marshaller: new(jsonMarshaller)},
81+
}
82+
for _, test := range tests {
83+
t.Run(test.encoding, func(t *testing.T) {
84+
f := NewFactory()
85+
v, command := config.Viperize(f.AddFlags)
86+
command.ParseFlags([]string{"--kafka.encoding=" + test.encoding})
87+
f.InitFromViper(v)
88+
89+
f.config = &mockProducerBuilder{t: t}
90+
assert.NoError(t, f.Initialize(metrics.NullFactory, zap.NewNop()))
91+
assert.IsType(t, test.marshaller, f.marshaller)
92+
})
93+
}
8394
}
8495

8596
func TestKafkaFactoryMarshallerErr(t *testing.T) {

0 commit comments

Comments
 (0)