(t *testing.T)
| 403 | } |
| 404 | |
| 405 | func TestWalBlockMetaSnapshot(t *testing.T) { |
| 406 | meta := backend.NewBlockMeta("fake", uuid.New(), VersionString) |
| 407 | w, err := createWALBlock(meta, t.TempDir(), model.CurrentEncoding, 0) |
| 408 | require.NoError(t, err) |
| 409 | |
| 410 | snap0 := w.MetaSnapshot() |
| 411 | require.NotSame(t, w.BlockMeta(), snap0, "MetaSnapshot must return a fresh allocation, not the live meta pointer") |
| 412 | require.Equal(t, int64(0), snap0.TotalObjects) |
| 413 | |
| 414 | id := test.ValidTraceID(nil) |
| 415 | tr := test.MakeTrace(10, id) |
| 416 | trace.SortTrace(tr) |
| 417 | require.NoError(t, w.AppendTrace(id, tr, 100, 200, false)) |
| 418 | |
| 419 | snap1 := w.MetaSnapshot() |
| 420 | require.NotSame(t, snap0, snap1, "successive MetaSnapshot calls must return distinct pointers") |
| 421 | require.Equal(t, int64(1), snap1.TotalObjects) |
| 422 | require.Equal(t, w.BlockMeta().StartTime, snap1.StartTime) |
| 423 | require.Equal(t, w.BlockMeta().EndTime, snap1.EndTime) |
| 424 | |
| 425 | snap1.TotalObjects = 9999 |
| 426 | require.Equal(t, int64(1), w.BlockMeta().TotalObjects) |
| 427 | } |
| 428 | |
| 429 | func TestWalBlockTombstone(t *testing.T) { |
| 430 | meta := backend.NewBlockMeta("fake", uuid.New(), VersionString) |
nothing calls this directly
no test coverage detected