Skip to content

Commit

Permalink
add rename test
Browse files Browse the repository at this point in the history
  • Loading branch information
ashwanthgoli committed Oct 17, 2024
1 parent eb1a898 commit e908d1e
Showing 1 changed file with 16 additions and 0 deletions.
16 changes: 16 additions & 0 deletions pkg/logql/log/fmt_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -515,6 +515,22 @@ func Test_labelsFormatter_Format(t *testing.T) {
in labels.Labels
want labels.Labels
}{
{
"rename label",
mustNewLabelsFormatter([]LabelFmt{
NewRenameLabelFmt("baz", "foo"),
}),
labels.FromStrings("foo", "blip", "bar", "blop"),
labels.FromStrings("bar", "blop", "baz", "blip"),
},
{
"rename and overwrite existing label",
mustNewLabelsFormatter([]LabelFmt{
NewRenameLabelFmt("bar", "foo"),
}),
labels.FromStrings("foo", "blip", "bar", "blop"),
labels.FromStrings("bar", "blip"),
},
{
"combined with template",
mustNewLabelsFormatter([]LabelFmt{NewTemplateLabelFmt("foo", "{{.foo}} and {{.bar}}")}),
Expand Down

0 comments on commit e908d1e

Please sign in to comment.