Skip to content

Commit 786448f

Browse files
committed
backup: #904 v17 - add buf.Len() == 0 assertions to Redis rejection tests
Claude v16 observation (non-blocking but worth folding in): the two v16 rejection tests TestEncodeSnapshotRedisRejectsNonZeroDB and TestEncodeSnapshotRedisRejectsMultipleDBs pass a *bytes.Buffer to EncodeSnapshot but never assert it stays empty on rejection. All five prior rejection tests consistently include the assertion: - TestEncodeSnapshotRejectsMissingInputRoot - TestEncodeSnapshotRejectsLowManifestFloor - TestEncodeSnapshotRejectsDynamoDBJSONLLayout - TestEncodeSnapshotRejectsZeroAdapterSet - TestEncodeSnapshotMarksAdapterDataErrors Adding the same `if buf.Len() != 0 { t.Errorf(...) }` block to both new tests keeps the convention consistent and pins the no-bytes-on-rejection invariant explicitly. No behavior change; tests + lint green.
1 parent b52a688 commit 786448f

1 file changed

Lines changed: 6 additions & 0 deletions

File tree

internal/backup/encode_snapshot_test.go

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -498,6 +498,9 @@ func TestEncodeSnapshotRedisRejectsNonZeroDB(t *testing.T) {
498498
if !errors.Is(err, ErrEncodeAdapterData) {
499499
t.Errorf("err = %v, want errors.Is ErrEncodeAdapterData (mark from runAdapterEncoders)", err)
500500
}
501+
if buf.Len() != 0 {
502+
t.Errorf("buf.Len = %d, want 0 (no bytes should be written on multi-DB rejection)", buf.Len())
503+
}
501504
}
502505

503506
// TestEncodeSnapshotRedisRejectsMultipleDBs pins the multi-DB case:
@@ -524,6 +527,9 @@ func TestEncodeSnapshotRedisRejectsMultipleDBs(t *testing.T) {
524527
if !errors.Is(err, ErrRedisEncodeMultiDBUnsupported) {
525528
t.Errorf("err = %v, want errors.Is ErrRedisEncodeMultiDBUnsupported", err)
526529
}
530+
if buf.Len() != 0 {
531+
t.Errorf("buf.Len = %d, want 0 (no bytes should be written on multi-DB rejection)", buf.Len())
532+
}
527533
}
528534

529535
// TestEnumerateRedisDBsRejectsNonDirDBEntry pins codex P2 v14 #904

0 commit comments

Comments
 (0)