Skip to content

Commit 290ea31

Browse files
committed
test(dumps): assert not-found instead of skipping in traversal test
The valid-but-missing-id branch used t.Skip, which masks a regression: if ReadMeta wrongly returned nil for a valid id, the test would skip rather than fail. Now it fails (t.Fatal) on nil and asserts errors.Is(err, errs.ErrDumpCorrupt) — the sentinel ReadMeta actually wraps for a missing dump.
1 parent cc6cbd0 commit 290ea31

1 file changed

Lines changed: 11 additions & 3 deletions

File tree

internal/dumps/catalog_test.go

Lines changed: 11 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,13 @@
11
package dumps
22

33
import (
4+
"errors"
45
"os"
56
"path/filepath"
67
"testing"
78
"time"
9+
10+
"github.com/nixrajput/siphon/internal/errs"
811
)
912

1013
func TestCatalog_WriteRead_Roundtrip(t *testing.T) {
@@ -93,8 +96,13 @@ func TestCatalog_RejectsTraversalID(t *testing.T) {
9396
t.Errorf("Delete(%q) = nil error; want rejection", bad)
9497
}
9598
}
96-
// A clean ULID-like id is accepted (ReadMeta then fails only on not-found).
97-
if _, err := c.ReadMeta("01HXKZ000000000000000000"); err == nil {
98-
t.Skip("unexpected: a non-existent valid id should error as not-found, not pass")
99+
// A clean ULID-like id passes validation, so ReadMeta proceeds and fails
100+
// only because the dump doesn't exist — surfaced as errs.ErrDumpCorrupt.
101+
_, err = c.ReadMeta("01HXKZ000000000000000000")
102+
if err == nil {
103+
t.Fatal("ReadMeta(valid-but-missing id) = nil error; want a not-found error")
104+
}
105+
if !errors.Is(err, errs.ErrDumpCorrupt) {
106+
t.Fatalf("ReadMeta(valid-but-missing id) error = %v; want errs.ErrDumpCorrupt", err)
99107
}
100108
}

0 commit comments

Comments
 (0)