Skip to content

Commit 2514576

Browse files
committed
Improve TiUP Playground container build reliability
- Add consistent image tag for better Docker caching - Increase timeout to 300s for Docker build + TiUP downloads - Fix int64 conversion for ulimit values
1 parent 14e97c5 commit 2514576

File tree

1 file changed

+8
-4
lines changed

1 file changed

+8
-4
lines changed

mysql/testcontainers_helper.go

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -517,11 +517,15 @@ func startSharedTiDBClusterWithTiUP(version string) (*TiDBTestCluster, error) {
517517
return nil, fmt.Errorf("Dockerfile.tiup-playground not found at %s: %v", dockerfilePath, err)
518518
}
519519

520+
// Use a consistent image tag for caching
521+
imageTag := fmt.Sprintf("terraform-provider-mysql-tiup-playground:latest")
522+
520523
req := testcontainers.ContainerRequest{
521524
FromDockerfile: testcontainers.FromDockerfile{
522525
Context: moduleRoot,
523526
Dockerfile: "Dockerfile.tiup-playground",
524-
PrintBuildLog: true, // Helpful for debugging
527+
PrintBuildLog: true, // Helpful for debugging
528+
Tag: imageTag, // Use consistent tag for caching
525529
},
526530
ExposedPorts: []string{"4000/tcp"},
527531
// TiUP Playground needs to run processes, so we need privileged mode
@@ -531,8 +535,8 @@ func startSharedTiDBClusterWithTiUP(version string) (*TiDBTestCluster, error) {
531535
hostConfig.Ulimits = []*container.Ulimit{
532536
{
533537
Name: "nofile",
534-
Soft: 250000,
535-
Hard: 250000,
538+
Soft: int64(250000),
539+
Hard: int64(250000),
536540
},
537541
}
538542
},
@@ -551,7 +555,7 @@ func startSharedTiDBClusterWithTiUP(version string) (*TiDBTestCluster, error) {
551555
wait.ForSQL(nat.Port("4000/tcp"), "mysql", func(host string, port nat.Port) string {
552556
return fmt.Sprintf("root@tcp(%s:%s)/", host, port.Port())
553557
}),
554-
).WithStartupTimeout(240 * time.Second), // Longer timeout for first-time TiUP component downloads
558+
).WithStartupTimeout(300 * time.Second), // Longer timeout for Docker build + TiUP component downloads
555559
}
556560

557561
playgroundContainer, err := testcontainers.GenericContainer(ctx, testcontainers.GenericContainerRequest{

0 commit comments

Comments
 (0)