Skip to content

Commit edf038e

Browse files
committed
fix test starttup
1 parent d51a591 commit edf038e

File tree

2 files changed

+3
-3
lines changed

2 files changed

+3
-3
lines changed

test/integration/metrics/metrics_test.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@ func (s *MetricsTestSuite) SetupSuite() {
2727
slog.Info("starting metric tests")
2828
s.ctx = context.Background()
2929
s.teardownTest = utils.SetupMetricsTest(s.T())
30-
utils.WaitUntilNextScrapeCycle(s.T(), s.ctx)
30+
utils.WaitForMetricsToExist(s.T(), s.ctx)
3131
}
3232

3333
func (s *MetricsTestSuite) SetupTest() {

test/integration/utils/mock_collector_utils.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -194,7 +194,6 @@ func WaitUntilNextScrapeCycle(t *testing.T, ctx context.Context) {
194194
ticker := time.NewTicker(tickerTime)
195195
defer ticker.Stop()
196196

197-
waitForMetricToExist(t, ctx)
198197
prevScrapeValue, err := getRequestCountMetric(t, ctx)
199198
if err != nil {
200199
t.Fatalf("Failed to get initial scrape value: %v", err)
@@ -221,7 +220,7 @@ func WaitUntilNextScrapeCycle(t *testing.T, ctx context.Context) {
221220
}
222221
}
223222

224-
func waitForMetricToExist(t *testing.T, ctx context.Context) {
223+
func WaitForMetricsToExist(t *testing.T, ctx context.Context) {
225224
t.Helper()
226225

227226
waitCtx, cancel := context.WithTimeout(ctx, timeoutTime)
@@ -238,6 +237,7 @@ func waitForMetricToExist(t *testing.T, ctx context.Context) {
238237
case <-ticker.C:
239238
family := ScrapeCollectorMetricFamilies(t, ctx, MockCollectorStack.Otel)["nginx_http_request_count"]
240239
if family != nil {
240+
t.Log("NGINX metrics found")
241241
return
242242
}
243243
t.Log("NGINX metrics not found, retrying...")

0 commit comments

Comments
 (0)