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

Function TestWalBlockTombstone

tempodb/encoding/vparquet4/wal_block_test.go:429–455  ·  view source on GitHub ↗
(t *testing.T)

Source from the content-addressed store, hash-verified

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