Skip to content

Commit

Permalink
chore: fix lint errors
Browse files Browse the repository at this point in the history
  • Loading branch information
moshloop committed Dec 10, 2024
1 parent 4ae80f5 commit ad415fd
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 10 deletions.
15 changes: 6 additions & 9 deletions collections/priorityqueue_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -96,8 +96,11 @@ func TestPriorityQueueConcurrency(t *testing.T) {
g := NewWithT(t)
pq, err := New(QueueOpts[string]{
Comparator: strings.Compare,
Metrics: MetricsOpts[string]{
MetricName: "concurrent_queue",
},
})
Expect(err).To(BeNil())
g.Expect(err).To(BeNil())

const numGoroutines = 50
const itemsPerGoroutine = 100
Expand Down Expand Up @@ -140,13 +143,10 @@ func TestPriorityQueueConcurrency(t *testing.T) {
// Wait for all operations to complete
wg.Wait()
g.Expect(time.Since(start).Milliseconds()).To(BeNumerically("<", 100))

// g.Expect(matchers.DumpMetrics("priority")).To(ContainSubstring("zz"))
g.Expect(int(dequeued.Load())).To(Equal(expectedCount))
// g.Expect("priority_queue_duration_sum").To(matchers.MatchCounter(1))
g.Expect("priority_queue_duration_count").To(matchers.MatchCounter(int64(expectedCount)))
g.Expect("concurrent_queue_duration_count").To(matchers.MatchCounter(int64(expectedCount)))

g.Expect("priority_queue_size").To(matchers.MatchCounter(0))
g.Expect("concurrent_queue_size").To(matchers.MatchCounter(0))
g.Expect(pq.Size()).To(BeNumerically("==", 0))

t.Log("\n" + matchers.DumpMetrics("priority"))
Expand All @@ -156,6 +156,3 @@ func TestPriorityQueueConcurrency(t *testing.T) {
func first[T1 any, T2 any](a T1, b T2) T1 {
return a
}
func second[T1 any, T2 any](a T1, b T2) T2 {
return b
}
5 changes: 4 additions & 1 deletion test/matchers/prometheus.go
Original file line number Diff line number Diff line change
Expand Up @@ -88,7 +88,10 @@ func DumpMetrics(prefix string) string {
for _, v := range lo.Filter(_metrics, func(i *io_prometheus_client.MetricFamily, _ int) bool {
return strings.HasPrefix(lo.FromPtr(i.Name), prefix)
}) {
expfmt.MetricFamilyToText(out, v)
if _, err := expfmt.MetricFamilyToText(out, v); err != nil {
return err.Error()
}

}
return out.String()
}
Expand Down

0 comments on commit ad415fd

Please sign in to comment.