File tree Expand file tree Collapse file tree 1 file changed +22
-0
lines changed
coderd/database/migrations Expand file tree Collapse file tree 1 file changed +22
-0
lines changed Original file line number Diff line number Diff line change @@ -20,6 +20,7 @@ import (
20
20
"github.com/stretchr/testify/require"
21
21
"go.uber.org/goleak"
22
22
"golang.org/x/exp/slices"
23
+ "golang.org/x/sync/errgroup"
23
24
24
25
"github.com/coder/coder/coderd/database/migrations"
25
26
"github.com/coder/coder/coderd/database/postgres"
@@ -47,6 +48,22 @@ func TestMigrate(t *testing.T) {
47
48
require .NoError (t , err )
48
49
})
49
50
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
+
50
67
t .Run ("Twice" , func (t * testing.T ) {
51
68
t .Parallel ()
52
69
@@ -86,6 +103,11 @@ func testSQLDB(t testing.TB) *sql.DB {
86
103
require .NoError (t , err )
87
104
t .Cleanup (func () { _ = db .Close () })
88
105
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
+
89
111
return db
90
112
}
91
113
You can’t perform that action at this time.
0 commit comments