Skip to content

Commit 8f62be1

Browse files
steveyeggeclaude
andcommitted
fix: testcontainers dolt setup — add mysql driver, downgrade image, fix stale API refs
- Import go-sql-driver/mysql in doltserver.go so testcontainers can initialize - Use Dolt 1.43.0 Docker image (1.82.4 has broken auth handshake for root connections via go-sql-driver) - Use default test/test credentials instead of root - Update rig_park_persistence_test.go to use new container API names Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
1 parent 04f31e9 commit 8f62be1

2 files changed

Lines changed: 10 additions & 8 deletions

File tree

internal/cmd/rig_park_persistence_test.go

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -38,18 +38,18 @@ func randomTestPrefix(t *testing.T) string {
3838
func setupRigBeadsDB(t *testing.T, rigPath, prefix string) *beads.Beads {
3939
t.Helper()
4040
requireBdCLI(t)
41-
testutil.RequireDoltServer(t)
41+
testutil.RequireDoltContainer(t)
4242

43-
port, _ := strconv.Atoi(testutil.DoltTestPort())
43+
port, _ := strconv.Atoi(testutil.DoltContainerPort())
4444
b := beads.NewIsolatedWithPort(rigPath, port)
4545
if err := b.Init(prefix); err != nil {
4646
t.Fatalf("bd init failed: %v", err)
4747
}
4848

49-
// Keep the shared test Dolt server clean.
49+
// Keep the test container clean.
5050
dbName := "beads_" + prefix
5151
t.Cleanup(func() {
52-
dsn := "root:@tcp(127.0.0.1:" + testutil.DoltTestPort() + ")/"
52+
dsn := "root:@tcp(127.0.0.1:" + testutil.DoltContainerPort() + ")/"
5353
db, err := sql.Open("mysql", dsn)
5454
if err != nil {
5555
t.Logf("cleanup: sql.Open failed for %s: %v", dbName, err)

internal/testutil/doltserver.go

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -10,13 +10,15 @@ import (
1010
"sync"
1111
"testing"
1212

13+
_ "github.com/go-sql-driver/mysql" // required by testcontainers Dolt module
1314
"github.com/testcontainers/testcontainers-go"
1415
"github.com/testcontainers/testcontainers-go/modules/dolt"
1516
)
1617

1718
// DoltDockerImage is the Docker image used for Dolt test containers.
18-
// Matches MinDoltVersion in internal/deps/dolt.go.
19-
const DoltDockerImage = "dolthub/dolt-sql-server:1.82.4"
19+
// Note: 1.82.4 has a broken auth handshake for root connections via
20+
// the MySQL wire protocol with go-sql-driver. Use 1.43.0 which works.
21+
const DoltDockerImage = "dolthub/dolt-sql-server:1.43.0"
2022

2123
var (
2224
doltCtr *dolt.DoltContainer
@@ -41,7 +43,7 @@ func isDockerAvailable() bool {
4143
func startSharedDoltContainer() {
4244
ctx := context.Background()
4345
ctr, err := dolt.Run(ctx, DoltDockerImage,
44-
dolt.WithUsername("root"),
46+
dolt.WithDatabase("gt_test"),
4547
)
4648
if err != nil {
4749
doltCtrErr = fmt.Errorf("starting Dolt container: %w", err)
@@ -72,7 +74,7 @@ func StartIsolatedDoltContainer(t *testing.T) string {
7274

7375
ctx := context.Background()
7476
ctr, err := dolt.Run(ctx, DoltDockerImage,
75-
dolt.WithUsername("root"),
77+
dolt.WithDatabase("gt_test"),
7678
)
7779
if err != nil {
7880
t.Fatalf("starting Dolt container: %v", err)

0 commit comments

Comments
 (0)