diff --git a/internal/filechannel/regression_1_unexpected_overwritten_test.go b/internal/filechannel/regression_1_unexpected_overwritten_test.go index 56b4ea7..3af2a7c 100644 --- a/internal/filechannel/regression_1_unexpected_overwritten_test.go +++ b/internal/filechannel/regression_1_unexpected_overwritten_test.go @@ -4,6 +4,7 @@ import ( "fmt" "os" "path" + "slices" "testing" "time" ) @@ -62,6 +63,23 @@ func TestRegressionUnexpectedOverwritten(t *testing.T) { if stat.Size() != SegmentHeaderBinarySize { t.Fatalf("segment file size wasn't correctly truncated, size now is %d", stat.Size()) } + + err = fc.Write(magicPayload(4096)) + if err != nil { + t.Fatalf("failed to write payload: %s", err) + } + err = fc.Flush() + if err != nil { + t.Fatalf("failed to flush: %s", err) + } + + data, err := fc.Iterator().Next(nil) + if err != nil { + t.Fatalf("failed to read next: %s", err) + } + if !slices.Equal(data, magicPayload(4096)) { + t.Fatalf("data mismatch") + } }() // Keep fc alive.