Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commitcdd6734

Browse files
committed
Fix flaky label evaluation by sorting both sides
Signed-off-by: Danny Kopping <danny@coder.com>
1 parentc11dc61 commitcdd6734

File tree

1 file changed

+4
-2
lines changed

1 file changed

+4
-2
lines changed

‎coderd/prometheusmetrics/aggregator_test.go

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -206,9 +206,11 @@ func verifyCollectedMetrics(t *testing.T, expected []*agentproto.Stats_Metric, a
206206

207207
dtoLabels:=asMetricAgentLabels(d.GetLabel())
208208
// dto labels are sorted in alphabetical order.
209-
sort.Slice(e.Labels,func(i,jint)bool {
209+
sortFn:=func(i,jint)bool {
210210
returne.Labels[i].Name<e.Labels[j].Name
211-
})
211+
}
212+
sort.Slice(e.Labels,sortFn)
213+
sort.Slice(dtoLabels,sortFn)
212214
require.Equal(t,e.Labels,dtoLabels,d.String())
213215
}
214216
returntrue

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp