Skip to content
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Using copy instead
Signed-off-by: Danny Kopping <danny@coder.com>
  • Loading branch information
dannykopping committed Mar 13, 2024
commit 9113c015ee1d937707451836172eca47d987e1ab
10 changes: 2 additions & 8 deletions coderd/prometheusmetrics/aggregator_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -204,14 +204,8 @@ func verifyCollectedMetrics(t *testing.T, expected []*agentproto.Stats_Metric, a
require.Failf(t, "unsupported type: %s", string(e.Type))
}

// make a copy of the expected labels because tests run in parallel and can cause data races
var expectedLabels []*agentproto.Stats_Metric_Label
for _, l := range e.Labels {
expectedLabels = append(expectedLabels, &agentproto.Stats_Metric_Label{
Name: l.Name,
Value: l.Value,
})
}
expectedLabels := make([]*agentproto.Stats_Metric_Label, len(e.Labels))
copy(expectedLabels, e.Labels)

dtoLabels := asMetricAgentLabels(d.GetLabel())
// dto labels are sorted in alphabetical order.
Expand Down