Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions .github/workflows/go_test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ jobs:
go-version: ${{ matrix.go-version }}

- name: Run tests
run: go test -v -race ./...
run: go test -race ./...

test-aws-mysql:
runs-on: ubuntu-latest
Expand Down Expand Up @@ -54,4 +54,4 @@ jobs:
persist-credentials: false
- name: Test with Go
# Parallel tests are disabled for the MySQL test database to always be in a known state.
run: go test -p=1 -v -race ./storage/aws/... -is_mysql_test_optional=false
run: go test -p=1 -race ./storage/aws/... -is_mysql_test_optional=false
3 changes: 1 addition & 2 deletions internal/mirror/gateway/mirror_gateway_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -56,8 +56,7 @@ func TestGateway(t *testing.T) {
} {
t.Run(tc.name, func(t *testing.T) {
opts := tessera.NewAppendOptions().
WithCheckpointInterval(100 * time.Millisecond).
WithCheckpointRepublishInterval(100 * time.Millisecond)
WithCheckpointInterval(100 * time.Millisecond)

testLog, shutdown := testonly.NewTestLog(t, opts)
defer func() {
Expand Down
14 changes: 12 additions & 2 deletions storage/posix/files_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,8 @@ import (

func TestGarbageCollect(t *testing.T) {
ctx := t.Context()
appCtx, cancel := context.WithCancel(ctx)
defer cancel()
batchSize := uint64(60000)
integrateEvery := uint64(31343)

Expand All @@ -59,7 +61,7 @@ func TestGarbageCollect(t *testing.T) {
s: s,
entriesPath: opts.EntriesPath(),
}
appender, lr, err := s.newAppender(ctx, logStorage, opts)
appender, lr, err := s.newAppender(appCtx, logStorage, opts)
if err != nil {
t.Fatalf("Appender: %v", err)
}
Expand Down Expand Up @@ -113,6 +115,9 @@ func TestGarbageCollect(t *testing.T) {
}
}

// Stop background appender jobs before running fsck and TempDir cleanup.
cancel()

// And finally, for good measure, assert that all the resources implied by the log's checkpoint
// are present.
f := fsck.New(vk.Name(), vk, lr, defaultMerkleLeafHasher, fsck.Opts{N: 1})
Expand Down Expand Up @@ -149,6 +154,8 @@ func TestGarbageCollectOption(t *testing.T) {
} {
t.Run(test.name, func(t *testing.T) {
ctx := t.Context()
appCtx, cancel := context.WithCancel(ctx)
defer cancel()

s := &Storage{
cfg: Config{
Expand All @@ -172,7 +179,7 @@ func TestGarbageCollectOption(t *testing.T) {
s: s,
entriesPath: opts.EntriesPath(),
}
appender, lr, err := s.newAppender(ctx, logStorage, opts)
appender, lr, err := s.newAppender(appCtx, logStorage, opts)
if err != nil {
t.Fatalf("Appender: %v", err)
}
Expand Down Expand Up @@ -240,6 +247,9 @@ func TestGarbageCollectOption(t *testing.T) {
}
}

// Stop background appender jobs before running fsck and TempDir cleanup.
cancel()

// And finally, for good measure, assert that all the resources implied by the log's checkpoint
// are present.
f := fsck.New(vk.Name(), vk, lr, defaultMerkleLeafHasher, fsck.Opts{N: 1})
Expand Down
12 changes: 9 additions & 3 deletions testonly/testlog.go
Original file line number Diff line number Diff line change
Expand Up @@ -46,13 +46,16 @@ func NewTestLog(t *testing.T, opts *tessera.AppendOptions) (*TestLog, func(conte
}

root := t.TempDir()
driver, err := posix.New(t.Context(), posix.Config{Path: root})
ctx, cancel := context.WithCancel(t.Context())
t.Cleanup(cancel)

driver, err := posix.New(ctx, posix.Config{Path: root})
if err != nil {
t.Fatalf("posix.New: %v", err)
}

opts.WithCheckpointSigner(s)
a, shutdown, lr, err := tessera.NewAppender(t.Context(), driver, opts)
a, shutdown, lr, err := tessera.NewAppender(ctx, driver, opts)
if err != nil {
t.Fatalf("NewAppender: %v", err)
}
Expand All @@ -64,7 +67,10 @@ func NewTestLog(t *testing.T, opts *tessera.AppendOptions) (*TestLog, func(conte
Appender: a,
}

return r, shutdown
return r, func(sCtx context.Context) error {
defer cancel()
return shutdown(sCtx)
}
}

// TestLog represents an ephemeral POSIX log instance intended for use in tests.
Expand Down
Loading