MCPcopy
hub / github.com/prometheus/prometheus / testScrapeLoopOutOfBoundsTimeError

Function testScrapeLoopOutOfBoundsTimeError

scrape/scrape_test.go:4395–4422  ·  view source on GitHub ↗
(t *testing.T, appV2 bool)

Source from the content-addressed store, hash-verified

4393}
4394
4395func testScrapeLoopOutOfBoundsTimeError(t *testing.T, appV2 bool) {
4396 sl, _ := newTestScrapeLoop(t, func(sl *scrapeLoop) {
4397 if appV2 {
4398 sl.appendableV2 = appendableV2Func(func(ctx context.Context) storage.AppenderV2 {
4399 return &timeLimitAppenderV2{
4400 AppenderV2: teststorage.NewAppendable().AppenderV2(ctx),
4401 maxTime: timestamp.FromTime(time.Now().Add(10 * time.Minute)),
4402 }
4403 })
4404 } else {
4405 sl.appendable = appendableFunc(func(ctx context.Context) storage.Appender {
4406 return &timeLimitAppender{
4407 Appender: teststorage.NewAppendable().Appender(ctx),
4408 maxTime: timestamp.FromTime(time.Now().Add(10 * time.Minute)),
4409 }
4410 })
4411 }
4412 })
4413
4414 now := time.Now().Add(20 * time.Minute)
4415 app := sl.appender()
4416 total, added, seriesAdded, err := app.append([]byte("normal 1\n"), "text/plain", now)
4417 require.NoError(t, err)
4418 require.NoError(t, app.Commit())
4419 require.Equal(t, 1, total)
4420 require.Equal(t, 1, added)
4421 require.Equal(t, 0, seriesAdded)
4422}
4423
4424func TestAcceptHeader(t *testing.T) {
4425 tests := []struct {

Callers 1

Calls 11

NewAppendableFunction · 0.92
FromTimeFunction · 0.92
newTestScrapeLoopFunction · 0.85
appendableV2FuncFuncType · 0.85
appendableFuncFuncType · 0.85
AppenderV2Method · 0.65
AddMethod · 0.65
AppenderMethod · 0.65
appendMethod · 0.65
CommitMethod · 0.65
appenderMethod · 0.45

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…