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

Function TestWalBlockTombstone

tempodb/encoding/vparquet3/wal_block_test.go:427–453  ·  view source on GitHub ↗
(t *testing.T)

Source from the content-addressed store, hash-verified

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