Skip to content

Commit 037a1e7

Browse files
committed
fix(doltserver): resolve pre-existing integration test failures
Two fixes for nightly integration test failures: 1. wl_commons "database exists" error: InitRig now uses CREATE DATABASE IF NOT EXISTS when the Dolt server is running, preventing failures when the database was already created by a prior test run sharing the same container. Also adds t.Cleanup to drop the wl_commons database after TestRealWLCommonsStore_Conformance, matching the cleanup pattern already used by scheduler tests (setupMultiRigSchedulerTown). 2. wisps schema drift: Remove the crystallizes column from wispsCreateDDL. beads v1.0.0 actively drops this column via migration 012 (MigrateDropHOPColumns). The GT-side DDL was out of sync with what bd expects, causing schema mismatches when GT creates the wisps table directly.
1 parent bdbe8c4 commit 037a1e7

3 files changed

Lines changed: 13 additions & 4 deletions

File tree

internal/doltserver/doltserver.go

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2290,9 +2290,12 @@ func InitRig(townRoot, rigName string) (serverWasRunning bool, created bool, err
22902290
}
22912291

22922292
if running {
2293-
// Server is running: use CREATE DATABASE which both creates the
2294-
// directory and registers the database with the live server.
2295-
if err := serverExecSQL(townRoot, fmt.Sprintf("CREATE DATABASE `%s`", rigName)); err != nil {
2293+
// Server is running: use CREATE DATABASE IF NOT EXISTS which both
2294+
// creates the directory and registers the database with the live
2295+
// server. IF NOT EXISTS prevents failures when the database was
2296+
// already created (e.g., by a prior test run sharing the same
2297+
// Dolt container).
2298+
if err := serverExecSQL(townRoot, fmt.Sprintf("CREATE DATABASE IF NOT EXISTS `%s`", rigName)); err != nil {
22962299
return true, false, fmt.Errorf("creating database on running server: %w", err)
22972300
}
22982301
// Wait for the new database to appear in the server's in-memory catalog.

internal/doltserver/wisps_migrate.go

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -380,7 +380,6 @@ var wispsCreateDDL = `CREATE TABLE wisps (
380380
ephemeral tinyint(1) DEFAULT 1,
381381
pinned tinyint(1) DEFAULT 0,
382382
is_template tinyint(1) DEFAULT 0,
383-
crystallizes tinyint(1) DEFAULT 0,
384383
mol_type varchar(32) DEFAULT '',
385384
work_type varchar(32) DEFAULT 'mutex',
386385
quality_score double,

internal/doltserver/wl_commons_integration_test.go

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -33,6 +33,13 @@ func startIsolatedDoltContainer(t *testing.T) string {
3333
func TestRealWLCommonsStore_Conformance(t *testing.T) {
3434
townRoot := startIsolatedDoltContainer(t)
3535

36+
// Drop the wl_commons database on cleanup to prevent "database exists"
37+
// errors when the container is shared across test runs (same pattern as
38+
// scheduler tests — see setupMultiRigSchedulerTown).
39+
t.Cleanup(func() {
40+
_ = serverExecSQL(townRoot, fmt.Sprintf("DROP DATABASE IF EXISTS `%s`", WLCommonsDB))
41+
})
42+
3643
// Pre-create the database before parallel subtests to avoid
3744
// concurrent CREATE DATABASE races.
3845
store := NewWLCommons(townRoot)

0 commit comments

Comments
 (0)