MCPcopy
hub / github.com/grafana/tempo / TestWalBlockTombstone

Function TestWalBlockTombstone

tempodb/encoding/vparquet5/wal_block_test.go:433–459  ·  view source on GitHub ↗
(t *testing.T)

Source from the content-addressed store, hash-verified

431}
432
433func TestWalBlockTombstone(t *testing.T) {
434 meta := backend.NewBlockMeta("fake", uuid.New(), VersionString)
435 w, err := createWALBlock(meta, t.TempDir(), model.CurrentEncoding, 0)
436 require.NoError(t, err)
437
438 id := test.ValidTraceID(nil)
439 tr := test.MakeTrace(10, id)
440 trace.SortTrace(tr)
441 require.NoError(t, w.AppendTrace(id, tr, 100, 200, false))
442 require.NoError(t, w.Flush())
443
444 metaPath := filepath.Join(w.walPath(), backend.MetaName)
445 deletedPath := filepath.Join(w.walPath(), backend.DeletedMetaName)
446
447 _, err = os.Stat(metaPath)
448 require.NoError(t, err, "meta.json should exist after Flush")
449
450 require.NoError(t, w.Tombstone())
451
452 _, err = os.Stat(metaPath)
453 assert.True(t, os.IsNotExist(err), "meta.json should be renamed away")
454 _, err = os.Stat(deletedPath)
455 assert.NoError(t, err, "meta.deleted.json should be present")
456
457 // Idempotent: a second Tombstone (meta.json is gone) returns nil.
458 require.NoError(t, w.Tombstone(), "Tombstone must be idempotent when meta.json is missing")
459}
460
461func testWalBlock(t *testing.T, f func(w *walBlock, ids []common.ID, trs []*tempopb.Trace)) {
462 meta := backend.NewBlockMeta("fake", uuid.New(), VersionString)

Callers

nothing calls this directly

Calls 10

NewBlockMetaFunction · 0.92
ValidTraceIDFunction · 0.92
MakeTraceFunction · 0.92
SortTraceFunction · 0.92
createWALBlockFunction · 0.70
AppendTraceMethod · 0.65
FlushMethod · 0.65
JoinMethod · 0.65
TombstoneMethod · 0.65
walPathMethod · 0.45

Tested by

no test coverage detected