Skip to content

Commit

Permalink
Improve regression test 1
Browse files Browse the repository at this point in the history
Signed-off-by: arkbriar <[email protected]>
  • Loading branch information
arkbriar committed Jul 27, 2024
1 parent 9e78cd8 commit f9f68a5
Showing 1 changed file with 18 additions and 0 deletions.
18 changes: 18 additions & 0 deletions internal/filechannel/regression_1_unexpected_overwritten_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ import (
"fmt"
"os"
"path"
"slices"
"testing"
"time"
)
Expand Down Expand Up @@ -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)

Check failure on line 76 in internal/filechannel/regression_1_unexpected_overwritten_test.go

View workflow job for this annotation

GitHub Actions / build

SA1012: do not pass a nil Context, even if a function permits it; pass context.TODO if you are unsure about which Context to use (staticcheck)
if err != nil {
t.Fatalf("failed to read next: %s", err)
}
if !slices.Equal(data, magicPayload(4096)) {
t.Fatalf("data mismatch")
}
}()

// Keep fc alive.
Expand Down

0 comments on commit f9f68a5

Please sign in to comment.