Skip to content

Commit 2923a7d

Browse files
authored
fix: Update expected patterns when pruning (#13079)
1 parent 797bb64 commit 2923a7d

File tree

1 file changed

+9
-6
lines changed

1 file changed

+9
-6
lines changed

pkg/pattern/ingester_querier_test.go

+9-6
Original file line numberDiff line numberDiff line change
@@ -6,12 +6,13 @@ import (
66
"testing"
77

88
"github.com/stretchr/testify/require"
9+
"golang.org/x/exp/slices"
910

1011
"github.com/grafana/loki/v3/pkg/logproto"
1112
)
1213

1314
func Test_prunePatterns(t *testing.T) {
14-
file, err := os.Open("testdata/patterns.txt")
15+
file, err := os.Open(`testdata/patterns.txt`)
1516
require.NoError(t, err)
1617
defer file.Close()
1718

@@ -26,18 +27,20 @@ func Test_prunePatterns(t *testing.T) {
2627
prunePatterns(resp, 0)
2728

2829
expectedPatterns := []string{
30+
`<_> caller=aggregator.go:139 level=info msg="received kafka message" topic=cortex-dev-01-aggregations partition=<_>`,
31+
`<_> caller=batcher.go:155 level=info msg="batcher:processing aggregation result" <_> partitionID=<_> +0000 UTC, <_>`,
32+
`<_> caller=batcher.go:155 level=info msg="batcher:processing aggregation result" result="user=9960, partitionID=<_> +0000 UTC, <_>`,
33+
`<_> caller=batcher.go:155 level=info msg="batcher:processing aggregation result" result="user=9960, partitionID=<_> sampleTimestamp=2024-04-03 <_> +0000 UTC, <_>`,
34+
`<_> caller=offset_committer.go:174 level=info msg="partition offset committer committed offset" topic=cortex-dev-01-aggregations partition=<_> +0000 UTC" <_> +0000 UTC" <_> currentBuckets="unsupported value type"`,
35+
`<_> caller=offset_committer.go:174 level=info msg="partition offset committer committed offset" topic=cortex-dev-01-aggregations partition=<_> handledMessageTime="2024-04-03 <_> +0000 UTC" <_> +0000 UTC" <_> currentBuckets="unsupported value type"`,
2936
`<_> caller=wrapper.go:48 level=info component=distributor msg="sample remote write" eventType=bi <_>`,
30-
`<_> caller=offset_committer.go:174 level=info msg="partition offset committer committed offset" topic=cortex-dev-01-aggregations <_> +0000 UTC" <_> +0000 UTC" <_> currentBuckets="unsupported value type"`,
31-
`<_> caller=aggregator.go:139 level=info msg="received kafka message" topic=cortex-dev-01-aggregations <_>`,
32-
`<_> caller=batcher.go:155 level=info msg="batcher: processing aggregation result" result="user=9960, <_> sampleTimestamp=2024-04-03 <_> +0000 UTC, <_>`,
33-
`<_> caller=offset_committer.go:174 level=info msg="partition offset committer committed offset" topic=cortex-dev-01-aggregations <_> handledMessageTime="2024-04-03 <_> +0000 UTC" <_> +0000 UTC" <_> currentBuckets="unsupported value type"`,
34-
`<_> caller=batcher.go:155 level=info msg="batcher: processing aggregation result" <_> +0000 UTC, <_>`,
3537
}
3638

3739
patterns := make([]string, 0, len(resp.Series))
3840
for _, p := range resp.Series {
3941
patterns = append(patterns, p.Pattern)
4042
}
43+
slices.Sort(patterns)
4144

4245
require.Equal(t, expectedPatterns, patterns)
4346
}

0 commit comments

Comments
 (0)