MCPcopy
hub / github.com/prometheus/prometheus / testNewScrapePool

Function testNewScrapePool

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

Source from the content-addressed store, hash-verified

97}
98
99func testNewScrapePool(t *testing.T, appV2 bool) {
100 var (
101 app = teststorage.NewAppendable()
102 sa = selectAppendable(app, appV2)
103 cfg = &config.ScrapeConfig{
104 MetricNameValidationScheme: model.UTF8Validation,
105 MetricNameEscapingScheme: model.AllowUTF8,
106 }
107 sp, err = newScrapePool(cfg, sa.V1(), sa.V2(), 0, nil, nil, &Options{}, newTestScrapeMetrics(t))
108 )
109 require.NoError(t, err)
110
111 if appV2 {
112 a, ok := sp.appendableV2.(*teststorage.Appendable)
113 require.True(t, ok, "Failure to append.")
114 require.Equal(t, app, a, "Wrong sample AppenderV2.")
115 require.Equal(t, cfg, sp.config, "Wrong scrape config.")
116
117 require.Nil(t, sp.appendable)
118 return
119 }
120 a, ok := sp.appendable.(*teststorage.Appendable)
121 require.True(t, ok, "Failure to append.")
122 require.Equal(t, app, a, "Wrong sample appender.")
123 require.Equal(t, cfg, sp.config, "Wrong scrape config.")
124
125 require.Nil(t, sp.appendableV2)
126}
127
128func TestStorageHandlesOutOfOrderTimestamps(t *testing.T) {
129 foreachAppendable(t, func(t *testing.T, appV2 bool) {

Callers 1

TestNewScrapePoolFunction · 0.85

Calls 6

NewAppendableFunction · 0.92
selectAppendableFunction · 0.85
newScrapePoolFunction · 0.85
newTestScrapeMetricsFunction · 0.85
V1Method · 0.80
V2Method · 0.80

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…