|
|
|
|
@ -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{}{ |
|
|
|
|
@ -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{}{ |
|
|
|
|
|