From c0c6bca985e0ea882580ccf0646ba95b77f52395 Mon Sep 17 00:00:00 2001 From: Bogdan Drutu Date: Tue, 12 Nov 2024 16:05:48 -0800 Subject: [PATCH] [chore] Do not call AddScraper with nil Scraper (#36343) Signed-off-by: Bogdan Drutu --- receiver/kafkametricsreceiver/receiver_test.go | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/receiver/kafkametricsreceiver/receiver_test.go b/receiver/kafkametricsreceiver/receiver_test.go index 5e37ccf39c83..c67d7150d5bb 100644 --- a/receiver/kafkametricsreceiver/receiver_test.go +++ b/receiver/kafkametricsreceiver/receiver_test.go @@ -32,7 +32,9 @@ func TestNewReceiver_invalid_scraper_error(t *testing.T) { c := createDefaultConfig().(*Config) c.Scrapers = []string{"brokers", "cpu"} mockScraper := func(context.Context, Config, *sarama.Config, receiver.Settings) (scraperhelper.Scraper, error) { - return nil, nil + return scraperhelper.NewScraper(brokersScraperType, func(context.Context) (pmetric.Metrics, error) { + return pmetric.Metrics{}, nil + }) } allScrapers["brokers"] = mockScraper r, err := newMetricsReceiver(context.Background(), *c, receivertest.NewNopSettings(), nil)