MCPcopy
hub / github.com/benbjohnson/litestream / TestCompactor_CompactWithVerification

Function TestCompactor_CompactWithVerification

compactor_test.go:566–589  ·  view source on GitHub ↗
(t *testing.T)

Source from the content-addressed store, hash-verified

564}
565
566func TestCompactor_CompactWithVerification(t *testing.T) {
567 t.Run("VerificationEnabled", func(t *testing.T) {
568 client := file.NewReplicaClient(t.TempDir())
569 compactor := litestream.NewCompactor(client, slog.Default())
570 compactor.VerifyCompaction = true
571
572 // Create contiguous L0 files
573 createTestLTXFile(t, client, 0, 1, 1)
574 createTestLTXFile(t, client, 0, 2, 2)
575 createTestLTXFile(t, client, 0, 3, 3)
576
577 // Compact to L1 - should succeed with verification
578 info, err := compactor.Compact(context.Background(), 1)
579 if err != nil {
580 t.Fatal(err)
581 }
582 if info.Level != 1 {
583 t.Errorf("Level=%d, want 1", info.Level)
584 }
585 if info.MinTXID != 1 || info.MaxTXID != 3 {
586 t.Errorf("TXID range=%d-%d, want 1-3", info.MinTXID, info.MaxTXID)
587 }
588 })
589}
590
591// containsString checks if s contains substr.
592func containsString(s, substr string) bool {

Callers

nothing calls this directly

Calls 5

CompactMethod · 0.95
NewReplicaClientFunction · 0.92
NewCompactorFunction · 0.92
createTestLTXFileFunction · 0.70
RunMethod · 0.45

Tested by

no test coverage detected