From 9aa132e67ee6779c45e61cb4a2e6554bd6767a92 Mon Sep 17 00:00:00 2001 From: Jaydip Gabani Date: Tue, 16 Jan 2024 21:18:10 +0000 Subject: [PATCH] fixing unit test Signed-off-by: Jaydip Gabani --- pkg/syncutil/stats_reporter_test.go | 9 +++------ 1 file changed, 3 insertions(+), 6 deletions(-) diff --git a/pkg/syncutil/stats_reporter_test.go b/pkg/syncutil/stats_reporter_test.go index 5353ee7a33f..b4569328b2e 100644 --- a/pkg/syncutil/stats_reporter_test.go +++ b/pkg/syncutil/stats_reporter_test.go @@ -21,8 +21,7 @@ func initializeTestInstruments(t *testing.T) (rdr *sdkmetric.PeriodicReader, r * mp := sdkmetric.NewMeterProvider(sdkmetric.WithReader(rdr)) meter = mp.Meter("test") - r, err = NewStatsReporter() - assert.NoError(t, err) + r = &Reporter{now: now} _, err = meter.Int64ObservableGauge(syncMetricName, metric.WithInt64Callback(r.observeSync)) assert.NoError(t, err) syncDurationM, err = meter.Float64Histogram(syncDurationMetricName) @@ -79,7 +78,7 @@ func TestReportSync(t *testing.T) { for kind := range tt.c.KnownKinds { for _, status := range metrics.AllStatuses { - if err := r.ReportSync( + r.ReportSync( Tags{ Kind: kind, Status: status, @@ -87,9 +86,7 @@ func TestReportSync(t *testing.T) { int64(totals[Tags{ Kind: kind, Status: status, - }])); err != nil { - log.Error(err, "failed to report sync") - } + }])) } }