(t *testing.T, appV2 bool)
| 3136 | } |
| 3137 | |
| 3138 | func testScrapeLoopAppendCacheEntryButErrNotFound(t *testing.T, appV2 bool) { |
| 3139 | appTest := teststorage.NewAppendable() |
| 3140 | sl, _ := newTestScrapeLoop(t, withAppendable(appTest, appV2)) |
| 3141 | |
| 3142 | fakeRef := storage.SeriesRef(1) |
| 3143 | expValue := float64(1) |
| 3144 | metric := []byte(`metric{n="1"} 1`) |
| 3145 | p, warning := textparse.New(metric, "text/plain", labels.NewSymbolTable(), textparse.ParserOptions{}) |
| 3146 | require.NotNil(t, p) |
| 3147 | require.NoError(t, warning) |
| 3148 | |
| 3149 | var lset labels.Labels |
| 3150 | _, err := p.Next() |
| 3151 | require.NoError(t, err) |
| 3152 | p.Labels(&lset) |
| 3153 | hash := lset.Hash() |
| 3154 | |
| 3155 | // Create a fake entry in the cache |
| 3156 | sl.cache.addRef(metric, fakeRef, lset, hash) |
| 3157 | now := time.Now() |
| 3158 | |
| 3159 | app := sl.appender() |
| 3160 | _, _, _, err = app.append(metric, "text/plain", now) |
| 3161 | require.NoError(t, err) |
| 3162 | require.NoError(t, app.Commit()) |
| 3163 | |
| 3164 | expected := []sample{ |
| 3165 | { |
| 3166 | L: lset, |
| 3167 | T: timestamp.FromTime(now), |
| 3168 | V: expValue, |
| 3169 | }, |
| 3170 | } |
| 3171 | teststorage.RequireEqual(t, expected, appTest.ResultSamples()) |
| 3172 | } |
| 3173 | |
| 3174 | type appendableFunc func(ctx context.Context) storage.Appender |
| 3175 |
no test coverage detected
searching dependent graphs…