skip reloader in failing test

Signed-off-by: Lovro Mažgon <lovro.mazgon@gmail.com>
This commit is contained in:
Lovro Mažgon 2024-05-09 13:55:48 +02:00
parent d60f34a324
commit 582753daa8
No known key found for this signature in database
GPG key ID: A8554FEB34E8BC79
2 changed files with 6 additions and 3 deletions

View file

@ -87,8 +87,9 @@ type Options struct {
// Optional HTTP client options to use when scraping.
HTTPClientOptions []config_util.HTTPClientOption
// private option for testability.
// private options for testability.
skipOffsetting bool
skipReloader bool
}
// Manager maintains a set of scrape pools and manages start/stop cycles
@ -114,7 +115,9 @@ type Manager struct {
// Run receives and saves target set updates and triggers the scraping loops reloading.
// Reloading happens in the background so that it doesn't block receiving targets updates.
func (m *Manager) Run(tsets <-chan map[string][]*targetgroup.Group) error {
if !m.opts.skipReloader {
go m.reloader()
}
for {
select {
case ts := <-tsets:

View file

@ -572,7 +572,7 @@ scrape_configs:
}
func TestManagerTargetsUpdates(t *testing.T) {
opts := Options{}
opts := Options{skipReloader: true}
testRegistry := prometheus.NewRegistry()
m, err := NewManager(&opts, nil, nil, testRegistry)
require.NoError(t, err)