(t *testing.T, m *metricstest.MockMetrics, key string)
| 807 | } |
| 808 | |
| 809 | func waitForMeasure(t *testing.T, m *metricstest.MockMetrics, key string) { |
| 810 | t.Helper() |
| 811 | timeout := time.After(time.Second) |
| 812 | ticker := time.NewTicker(time.Millisecond) |
| 813 | defer ticker.Stop() |
| 814 | |
| 815 | for { |
| 816 | found := false |
| 817 | m.WithMeasures(func(measures map[string][]time.Duration) { |
| 818 | _, found = measures[key] |
| 819 | }) |
| 820 | if found { |
| 821 | return |
| 822 | } |
| 823 | |
| 824 | select { |
| 825 | case <-timeout: |
| 826 | t.Fatalf("timed out waiting for measure %q", key) |
| 827 | case <-ticker.C: |
| 828 | } |
| 829 | } |
| 830 | } |
no test coverage detected
searching dependent graphs…