MCPcopy
hub / github.com/prometheus/prometheus / TestCompactEmptyResultBlockWithTombstone

Function TestCompactEmptyResultBlockWithTombstone

tsdb/compact_test.go:1970–1987  ·  view source on GitHub ↗
(t *testing.T)

Source from the content-addressed store, hash-verified

1968}
1969
1970func TestCompactEmptyResultBlockWithTombstone(t *testing.T) {
1971 ctx := context.Background()
1972 tmpdir := t.TempDir()
1973 blockDir := createBlock(t, tmpdir, genSeries(1, 1, 0, 10))
1974 block, err := OpenBlock(nil, blockDir, nil, nil)
1975 require.NoError(t, err)
1976 // Write tombstone covering the whole block.
1977 err = block.Delete(ctx, 0, 10, labels.MustNewMatcher(labels.MatchEqual, defaultLabelName, "0"))
1978 require.NoError(t, err)
1979
1980 c, err := NewLeveledCompactor(ctx, nil, promslog.NewNopLogger(), []int64{0}, nil, nil)
1981 require.NoError(t, err)
1982
1983 ulids, err := c.Compact(tmpdir, []string{blockDir}, []*Block{block})
1984 require.NoError(t, err)
1985 require.Nil(t, ulids)
1986 require.NoError(t, block.Close())
1987}
1988
1989func TestDelayedCompaction(t *testing.T) {
1990 delay := 5 * time.Second

Callers

nothing calls this directly

Calls 8

CompactMethod · 0.95
MustNewMatcherFunction · 0.92
createBlockFunction · 0.85
genSeriesFunction · 0.85
OpenBlockFunction · 0.85
NewLeveledCompactorFunction · 0.85
DeleteMethod · 0.65
CloseMethod · 0.65

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…