Skip to content

Commit 3381ed2

Browse files
committed
fixup! fix(coderd): remove CREATE INDEX CONCURRENTLY from migrations
1 parent caa8de3 commit 3381ed2

File tree

1 file changed

+22
-0
lines changed

1 file changed

+22
-0
lines changed

coderd/database/migrations/migrate_test.go

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,7 @@ import (
2020
"github.com/stretchr/testify/require"
2121
"go.uber.org/goleak"
2222
"golang.org/x/exp/slices"
23+
"golang.org/x/sync/errgroup"
2324

2425
"github.com/coder/coder/coderd/database/migrations"
2526
"github.com/coder/coder/coderd/database/postgres"
@@ -47,6 +48,22 @@ func TestMigrate(t *testing.T) {
4748
require.NoError(t, err)
4849
})
4950

51+
t.Run("Parallel", func(t *testing.T) {
52+
t.Parallel()
53+
54+
db := testSQLDB(t)
55+
eg := errgroup.Group{}
56+
57+
eg.Go(func() error {
58+
return migrations.Up(db)
59+
})
60+
eg.Go(func() error {
61+
return migrations.Up(db)
62+
})
63+
64+
require.NoError(t, eg.Wait())
65+
})
66+
5067
t.Run("Twice", func(t *testing.T) {
5168
t.Parallel()
5269

@@ -86,6 +103,11 @@ func testSQLDB(t testing.TB) *sql.DB {
86103
require.NoError(t, err)
87104
t.Cleanup(func() { _ = db.Close() })
88105

106+
_, err = db.Exec(`DROP SCHEMA public CASCADE`)
107+
require.NoError(t, err)
108+
_, err = db.Exec(`CREATE SCHEMA public`)
109+
require.NoError(t, err)
110+
89111
return db
90112
}
91113

0 commit comments

Comments
 (0)