Skip to content

Commit

Permalink
fluent-bit: edge case tests (#1096)
Browse files Browse the repository at this point in the history
  • Loading branch information
JensErat authored and cyriltovena committed Oct 1, 2019
1 parent e4d6a8c commit c4913bf
Showing 1 changed file with 49 additions and 0 deletions.
49 changes: 49 additions & 0 deletions cmd/fluent-bit/loki_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -198,6 +198,22 @@ func Test_labelMapping(t *testing.T) {
mapping map[string]interface{}
want model.LabelSet
}{
{
"empty record",
map[string]interface{}{},
map[string]interface{}{},
model.LabelSet{},
},
{
"empty subrecord",
map[string]interface{}{
"kubernetes": map[interface{}]interface{}{
"foo": []byte("buzz"),
},
},
map[string]interface{}{},
model.LabelSet{},
},
{
"bytes string",
map[string]interface{}{
Expand All @@ -216,6 +232,39 @@ func Test_labelMapping(t *testing.T) {
},
model.LabelSet{"test": "buzz", "output": "stderr"},
},
{
"numeric label",
map[string]interface{}{
"kubernetes": map[interface{}]interface{}{
"integer": 42,
"floating_point": 42.42,
},
"stream": "stderr",
},
map[string]interface{}{
"kubernetes": map[string]interface{}{
"integer": "integer",
"floating_point": "floating_point",
},
"stream": "output",
"nope": "nope",
},
model.LabelSet{"integer": "42", "floating_point": "42.42", "output": "stderr"},
},
{
"list label",
map[string]interface{}{
"kubernetes": map[interface{}]interface{}{
"integers": []int{42, 43},
},
},
map[string]interface{}{
"kubernetes": map[string]interface{}{
"integers": "integers",
},
},
model.LabelSet{"integers": "[42 43]"},
},
{
"deep string",
map[string]interface{}{
Expand Down

0 comments on commit c4913bf

Please sign in to comment.