Skip to content

Commit 7f054a0

Browse files
committed
roachtest: create required test schemas for SQLAlchemy test suite
Release note: None
1 parent e3770b8 commit 7f054a0

File tree

1 file changed

+16
-0
lines changed

1 file changed

+16
-0
lines changed

pkg/cmd/roachtest/tests/sqlalchemy.go

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -128,6 +128,22 @@ func runSQLAlchemy(ctx context.Context, t test.Test, c cluster.Cluster) {
128128
t.Fatal(err)
129129
}
130130

131+
// The test suite requires two schemas to be created ahead of time.
132+
// See https://github.com/sqlalchemy/sqlalchemy/blob/b3feb9cd3e87960ee65968b712e73d8464385a4a/README.unittests.rst?plain=1#L139.
133+
db, err := c.ConnE(ctx, t.L(), node[0], option.DBName("defaultdb"))
134+
if err != nil {
135+
t.Fatal(err)
136+
}
137+
defer db.Close()
138+
for _, cmd := range []string{
139+
`CREATE SCHEMA IF NOT EXISTS test_schema`,
140+
`CREATE SCHEMA IF NOT EXISTS test_schema_2`,
141+
} {
142+
if _, err := db.ExecContext(ctx, cmd); err != nil {
143+
t.Fatal(err)
144+
}
145+
}
146+
131147
blocklistName, expectedFailures := "sqlAlchemyBlocklist", sqlAlchemyBlocklist
132148
ignoredlistName, ignoredlist := "sqlAlchemyIgnoreList", sqlAlchemyIgnoreList
133149
t.L().Printf("Running cockroach version %s, using blocklist %s, using ignoredlist %s",

0 commit comments

Comments
 (0)