Skip to content

Commit 5c44365

Browse files
Make migrations_test.go tests consistent with other tests in pkg/migrations (#568)
Update the tests in `migrations_test.go`: * Put them in the `migrations_test` package * Add `t.Parallel()` to each test This makes the tests in this file consistent with the other tests in `pkg/migrations`.
1 parent e6e4523 commit 5c44365

File tree

1 file changed

+20
-13
lines changed

1 file changed

+20
-13
lines changed

pkg/migrations/migrations_test.go

Lines changed: 20 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -1,36 +1,41 @@
11
// SPDX-License-Identifier: Apache-2.0
22

3-
package migrations
3+
package migrations_test
44

55
import (
66
"context"
77
"testing"
88

99
"github.com/stretchr/testify/assert"
10+
"github.com/xataio/pgroll/pkg/migrations"
1011
"github.com/xataio/pgroll/pkg/schema"
1112
)
1213

1314
func TestMigrationsIsolated(t *testing.T) {
14-
migration := Migration{
15+
t.Parallel()
16+
17+
migration := migrations.Migration{
1518
Name: "sql",
16-
Operations: Operations{
17-
&OpRawSQL{
19+
Operations: migrations.Operations{
20+
&migrations.OpRawSQL{
1821
Up: `foo`,
1922
},
20-
&OpCreateTable{Name: "foo"},
23+
&migrations.OpCreateTable{Name: "foo"},
2124
},
2225
}
2326

2427
err := migration.Validate(context.TODO(), schema.New())
25-
var wantErr InvalidMigrationError
28+
var wantErr migrations.InvalidMigrationError
2629
assert.ErrorAs(t, err, &wantErr)
2730
}
2831

2932
func TestMigrationsIsolatedValid(t *testing.T) {
30-
migration := Migration{
33+
t.Parallel()
34+
35+
migration := migrations.Migration{
3136
Name: "sql",
32-
Operations: Operations{
33-
&OpRawSQL{
37+
Operations: migrations.Operations{
38+
&migrations.OpRawSQL{
3439
Up: `foo`,
3540
},
3641
},
@@ -40,14 +45,16 @@ func TestMigrationsIsolatedValid(t *testing.T) {
4045
}
4146

4247
func TestOnCompleteSQLMigrationsAreNotIsolated(t *testing.T) {
43-
migration := Migration{
48+
t.Parallel()
49+
50+
migration := migrations.Migration{
4451
Name: "sql",
45-
Operations: Operations{
46-
&OpRawSQL{
52+
Operations: migrations.Operations{
53+
&migrations.OpRawSQL{
4754
Up: `foo`,
4855
OnComplete: true,
4956
},
50-
&OpCreateTable{Name: "foo"},
57+
&migrations.OpCreateTable{Name: "foo"},
5158
},
5259
}
5360
err := migration.Validate(context.TODO(), schema.New())

0 commit comments

Comments
 (0)