mirror of
https://github.com/prometheus/prometheus.git
synced 2024-12-25 05:34:05 -08:00
scrape tests: Make appenders more realistic (#7594)
With this, the storage tests inside the scrape package are more realistic. Discovered with #7593, but fixed independently as #7593 will probably take some time. Signed-off-by: Julien Pivotto <roidelapluie@inuits.eu>
This commit is contained in:
parent
a69a8b931f
commit
22aa21e508
|
@ -648,15 +648,13 @@ func TestScrapeLoopSeriesAdded(t *testing.T) {
|
|||
s := teststorage.New(t)
|
||||
defer s.Close()
|
||||
|
||||
app := s.Appender()
|
||||
|
||||
ctx, cancel := context.WithCancel(context.Background())
|
||||
sl := newScrapeLoop(ctx,
|
||||
&testScraper{},
|
||||
nil, nil,
|
||||
nopMutator,
|
||||
nopMutator,
|
||||
func() storage.Appender { return app },
|
||||
s.Appender,
|
||||
nil,
|
||||
0,
|
||||
true,
|
||||
|
@ -793,13 +791,11 @@ func TestScrapeLoopCache(t *testing.T) {
|
|||
s := teststorage.New(t)
|
||||
defer s.Close()
|
||||
|
||||
sapp := s.Appender()
|
||||
|
||||
appender := &collectResultAppender{next: sapp}
|
||||
appender := &collectResultAppender{}
|
||||
var (
|
||||
signal = make(chan struct{}, 1)
|
||||
scraper = &testScraper{}
|
||||
app = func() storage.Appender { return appender }
|
||||
app = func() storage.Appender { appender.next = s.Appender(); return appender }
|
||||
)
|
||||
|
||||
ctx, cancel := context.WithCancel(context.Background())
|
||||
|
@ -1141,15 +1137,13 @@ func TestScrapeLoop_ChangingMetricString(t *testing.T) {
|
|||
s := teststorage.New(t)
|
||||
defer s.Close()
|
||||
|
||||
app := s.Appender()
|
||||
|
||||
capp := &collectResultAppender{next: app}
|
||||
capp := &collectResultAppender{}
|
||||
|
||||
sl := newScrapeLoop(context.Background(),
|
||||
nil, nil, nil,
|
||||
nopMutator,
|
||||
nopMutator,
|
||||
func() storage.Appender { return capp },
|
||||
func() storage.Appender { capp.next = s.Appender(); return capp },
|
||||
nil,
|
||||
0,
|
||||
true,
|
||||
|
@ -1628,15 +1622,13 @@ func TestScrapeLoopDiscardDuplicateLabels(t *testing.T) {
|
|||
s := teststorage.New(t)
|
||||
defer s.Close()
|
||||
|
||||
app := s.Appender()
|
||||
|
||||
ctx, cancel := context.WithCancel(context.Background())
|
||||
sl := newScrapeLoop(ctx,
|
||||
&testScraper{},
|
||||
nil, nil,
|
||||
nopMutator,
|
||||
nopMutator,
|
||||
func() storage.Appender { return app },
|
||||
s.Appender,
|
||||
nil,
|
||||
0,
|
||||
true,
|
||||
|
@ -1896,15 +1888,13 @@ func TestScrapeAddFast(t *testing.T) {
|
|||
s := teststorage.New(t)
|
||||
defer s.Close()
|
||||
|
||||
app := s.Appender()
|
||||
|
||||
ctx, cancel := context.WithCancel(context.Background())
|
||||
sl := newScrapeLoop(ctx,
|
||||
&testScraper{},
|
||||
nil, nil,
|
||||
nopMutator,
|
||||
nopMutator,
|
||||
func() storage.Appender { return app },
|
||||
s.Appender,
|
||||
nil,
|
||||
0,
|
||||
true,
|
||||
|
|
Loading…
Reference in a new issue