Like Prometheus, but for logs.
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 
 
 
 
loki/pkg/util/marshal/labels_test.go

32 lines
638 B

package marshal
import (
"reflect"
"testing"
"github.com/grafana/loki/v3/pkg/loghttp"
)
func TestNewLabelSet(t *testing.T) {
tests := []struct {
lbs string
want loghttp.LabelSet
wantErr bool
}{
{`{1="foo"}`, nil, true},
{`{_1="foo"}`, loghttp.LabelSet{"_1": "foo"}, false},
}
for _, tt := range tests {
t.Run(tt.lbs, func(t *testing.T) {
got, err := NewLabelSet(tt.lbs)
if (err != nil) != tt.wantErr {
t.Errorf("NewLabelSet() error = %v, wantErr %v", err, tt.wantErr)
return
}
if !reflect.DeepEqual(got, tt.want) {
t.Errorf("NewLabelSet() = %v, want %v", got, tt.want)
}
})
}
}