Skip to content

Commit

Permalink
[chore] Do not call AddScraper with nil Scraper (#36343)
Browse files Browse the repository at this point in the history
Signed-off-by: Bogdan Drutu <[email protected]>
  • Loading branch information
bogdandrutu authored Nov 13, 2024
1 parent 806049b commit c0c6bca
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion receiver/kafkametricsreceiver/receiver_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down

0 comments on commit c0c6bca

Please sign in to comment.