MCPcopy
hub / github.com/prometheus/prometheus / TestCompactionFailWillCleanUpTempDir

Function TestCompactionFailWillCleanUpTempDir

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

Source from the content-addressed store, hash-verified

496}
497
498func TestCompactionFailWillCleanUpTempDir(t *testing.T) {
499 compactor, err := NewLeveledCompactor(context.Background(), nil, promslog.NewNopLogger(), []int64{
500 20,
501 60,
502 240,
503 720,
504 2160,
505 }, nil, nil)
506 require.NoError(t, err)
507
508 tmpdir := t.TempDir()
509
510 require.Error(t, compactor.write(tmpdir, &BlockMeta{}, DefaultBlockPopulator{}, erringBReader{}))
511 _, err = os.Stat(filepath.Join(tmpdir, BlockMeta{}.ULID.String()) + tmpForCreationBlockDirSuffix)
512 require.True(t, os.IsNotExist(err), "directory is not cleaned up")
513}
514
515func metaRange(name string, mint, maxt int64, stats *BlockStats) dirMeta {
516 meta := &BlockMeta{MinTime: mint, MaxTime: maxt}

Callers

nothing calls this directly

Calls 5

writeMethod · 0.95
NewLeveledCompactorFunction · 0.85
StatMethod · 0.80
ErrorMethod · 0.65
StringMethod · 0.65

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…