diff --git a/storage/mysql/mysql_test.go b/storage/mysql/mysql_test.go index 5989a499..d84d733e 100644 --- a/storage/mysql/mysql_test.go +++ b/storage/mysql/mysql_test.go @@ -172,18 +172,20 @@ func TestGetTile(t *testing.T) { awaiter := tessera.NewIntegrationAwaiter(ctx, s.ReadCheckpoint, 10*time.Millisecond) treeSize := 258 - var lastIndex uint64 + + wg := errgroup.Group{} for i := range treeSize { - idx, _, err := awaiter.Await(ctx, s.Add(ctx, tessera.NewEntry([]byte(fmt.Sprintf("TestGetTile %d", i))))) - if err != nil { - t.Fatalf("Failed to prep test with entry: %v", err) - } - if idx > lastIndex { - lastIndex = idx - } + wg.Go( + func() error { + _, _, err := awaiter.Await(ctx, s.Add(ctx, tessera.NewEntry([]byte(fmt.Sprintf("TestGetTile %d", i))))) + if err != nil { + return fmt.Errorf("failed to prep test with entry: %v", err) + } + return nil + }) } - if got, want := lastIndex, uint64(treeSize-1); got != want { - t.Fatalf("expected only newly created entries in database; tests are not hermetic (got %d, want %d)", got, want) + if err := wg.Wait(); err != nil { + t.Fatalf("Failed to set up database with required leaves: %v", err) } for _, test := range []struct {