Skip to content

Commit c51cdff

Browse files
committed
Update Makefile and test-runner to use DOCKER_IMAGE for TiDB
- Makefile: Change testtidb targets to use DOCKER_IMAGE=tidb:VERSION format - test-runner.go: Set DOCKER_IMAGE=tidb:VERSION for TiDB tests instead of TIDB_VERSION
1 parent 101c1ce commit c51cdff

File tree

2 files changed

+11
-8
lines changed

2 files changed

+11
-8
lines changed

Makefile

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -62,8 +62,8 @@ testcontainers-matrix: fmtcheck bin/terraform ## Run test matrix across all data
6262

6363
# Run testcontainers tests for a specific database image
6464
# Usage: make testcontainers-image DOCKER_IMAGE=mysql:8.0
65-
# make testcontainers-image TIDB_VERSION=8.5.3
66-
testcontainers-image: fmtcheck bin/terraform ## Run tests for a specific database image (set DOCKER_IMAGE or TIDB_VERSION)
65+
# make testcontainers-image DOCKER_IMAGE=tidb:8.5.3
66+
testcontainers-image: fmtcheck bin/terraform ## Run tests for a specific database image (set DOCKER_IMAGE)
6767
@PATH="$(CURDIR)/bin:${PATH}" TF_ACC=1 GOTOOLCHAIN=auto go test -tags=testcontainers $(TEST) -v $(TESTARGS) -timeout=15m
6868

6969
bin/terraform: ## Download Terraform binary
@@ -102,10 +102,10 @@ testrdsdb: ## Run tests against Amazon RDS (requires MYSQL_ENDPOINT env vars)
102102

103103
# TiDB test targets - use testcontainers
104104
testtidb%: ## Run tests against TiDB version (e.g., testtidb8.5.3)
105-
@TIDB_VERSION=$* PATH="$(CURDIR)/bin:${PATH}" TF_ACC=1 GOTOOLCHAIN=auto go test -tags=testcontainers ./mysql/... -v $(if $(TESTARGS),-run "$(TESTARGS).*WithTestcontainers",-run WithTestcontainers) -timeout=30m
105+
@DOCKER_IMAGE=tidb:$* PATH="$(CURDIR)/bin:${PATH}" TF_ACC=1 GOTOOLCHAIN=auto go test -tags=testcontainers ./mysql/... -v $(if $(TESTARGS),-run "$(TESTARGS).*WithTestcontainers",-run WithTestcontainers) -timeout=30m
106106

107107
testtidb: ## Run tests against TiDB version (set MYSQL_VERSION)
108-
@TIDB_VERSION=$(MYSQL_VERSION) PATH="$(CURDIR)/bin:${PATH}" TF_ACC=1 GOTOOLCHAIN=auto go test -tags=testcontainers ./mysql/... -v $(if $(TESTARGS),-run "$(TESTARGS).*WithTestcontainers",-run WithTestcontainers) -timeout=30m
108+
@DOCKER_IMAGE=tidb:$(MYSQL_VERSION) PATH="$(CURDIR)/bin:${PATH}" TF_ACC=1 GOTOOLCHAIN=auto go test -tags=testcontainers ./mysql/... -v $(if $(TESTARGS),-run "$(TESTARGS).*WithTestcontainers",-run WithTestcontainers) -timeout=30m
109109

110110
# MariaDB test targets - use testcontainers
111111
testmariadb%: ## Run tests against MariaDB version (e.g., testmariadb10.10)

scripts/test-runner.go

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -294,12 +294,15 @@ func runTest(job testJob) testResult {
294294

295295
// Set environment variables
296296
envVars := os.Environ()
297+
// All database types use DOCKER_IMAGE
298+
// For TiDB, format is tidb:VERSION (e.g., tidb:6.1.7)
299+
// For MySQL/Percona/MariaDB, format is already full image name (e.g., mysql:8.0)
300+
dockerImage := job.image
297301
if job.dbType == "TiDB" {
298-
// TiDB uses version number, not full image name
299-
envVars = append(envVars, "TIDB_VERSION="+job.image)
300-
} else {
301-
envVars = append(envVars, "DOCKER_IMAGE="+job.image)
302+
// TiDB image is just version number, prepend "tidb:" prefix
303+
dockerImage = "tidb:" + job.image
302304
}
305+
envVars = append(envVars, "DOCKER_IMAGE="+dockerImage)
303306
envVars = append(envVars, "TF_ACC=1", "GOTOOLCHAIN=auto")
304307
cmd.Env = envVars
305308

0 commit comments

Comments
 (0)