Skip to content

Commit be58c2b

Browse files
committed
Fix test compilation errors and test failures
- Add missing helper functions and constants to test files - Fix TestAccGrant_role test to skip on TiDB (roles not supported) - Remove conflicting privileges from role grant configs - Update test assertions to use roles.0 instead of role attribute - Add missing imports (terraform, errors, database/sql, log, strings) - Fix all compilation errors introduced during testcontainers migration
1 parent 2588d38 commit be58c2b

27 files changed

+1189
-3272
lines changed

GORELEASER_GPGSIGNING_PLAN.md

Lines changed: 0 additions & 329 deletions
This file was deleted.

Makefile

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -123,13 +123,13 @@ testversion%: ## Run tests against MySQL version (e.g., testversion8.0) [backwar
123123
docker rmi mysql:$* 2>/dev/null || true; \
124124
docker manifest rm mysql:$* 2>/dev/null || true; \
125125
docker pull --platform linux/amd64 mysql:$* 2>&1 | grep -v "no match" || true; \
126-
DOCKER_DEFAULT_PLATFORM=linux/amd64 DOCKER_IMAGE=mysql:$* PATH="$(CURDIR)/bin:${PATH}" TF_ACC=1 GOTOOLCHAIN=auto go test -tags=testcontainers ./mysql/... -v $(if $(TESTARGS),-run "$(TESTARGS).*WithTestcontainers",-run WithTestcontainers) -timeout=30m; \
126+
DOCKER_DEFAULT_PLATFORM=linux/amd64 DOCKER_IMAGE=mysql:$* PATH="$(CURDIR)/bin:${PATH}" TF_ACC=1 GOTOOLCHAIN=auto go test -tags=testcontainers ./mysql/... -v $(if $(TESTARGS),-run "$(TESTARGS)",) -timeout=30m; \
127127
else \
128-
DOCKER_IMAGE=mysql:$* PATH="$(CURDIR)/bin:${PATH}" TF_ACC=1 GOTOOLCHAIN=auto go test -tags=testcontainers ./mysql/... -v $(if $(TESTARGS),-run "$(TESTARGS).*WithTestcontainers",-run WithTestcontainers) -timeout=30m; \
128+
DOCKER_IMAGE=mysql:$* PATH="$(CURDIR)/bin:${PATH}" TF_ACC=1 GOTOOLCHAIN=auto go test -tags=testcontainers ./mysql/... -v $(if $(TESTARGS),-run "$(TESTARGS)",) -timeout=30m; \
129129
fi
130130

131131
testversion: ## Run tests against MySQL version (set MYSQL_VERSION)
132-
@DOCKER_IMAGE=mysql:$(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
132+
@DOCKER_IMAGE=mysql:$(MYSQL_VERSION) PATH="$(CURDIR)/bin:${PATH}" TF_ACC=1 GOTOOLCHAIN=auto go test -tags=testcontainers ./mysql/... -v $(if $(TESTARGS),-run "$(TESTARGS)",) -timeout=30m
133133

134134
# Percona test targets - use testcontainers
135135
# Preferred format: test-percona-VERSION (e.g., test-percona-8.0)
@@ -144,10 +144,10 @@ testpercona%: ## Run tests against Percona version (e.g., testpercona8.0) [backw
144144
docker manifest rm percona:$* 2>/dev/null || true; \
145145
docker pull --platform linux/amd64 percona:$* || true; \
146146
fi
147-
@DOCKER_IMAGE=percona:$* PATH="$(CURDIR)/bin:${PATH}" TF_ACC=1 GOTOOLCHAIN=auto go test -tags=testcontainers ./mysql/... -v $(if $(TESTARGS),-run "$(TESTARGS).*WithTestcontainers",-run WithTestcontainers) -timeout=30m
147+
@DOCKER_IMAGE=percona:$* PATH="$(CURDIR)/bin:${PATH}" TF_ACC=1 GOTOOLCHAIN=auto go test -tags=testcontainers ./mysql/... -v $(if $(TESTARGS),-run "$(TESTARGS)",) -timeout=30m
148148

149149
testpercona: ## Run tests against Percona version (set MYSQL_VERSION)
150-
@DOCKER_IMAGE=percona:$(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
150+
@DOCKER_IMAGE=percona:$(MYSQL_VERSION) PATH="$(CURDIR)/bin:${PATH}" TF_ACC=1 GOTOOLCHAIN=auto go test -tags=testcontainers ./mysql/... -v $(if $(TESTARGS),-run "$(TESTARGS)",) -timeout=30m
151151

152152
testrdsdb%: ## Run tests against RDS MySQL version (requires MYSQL_ENDPOINT env vars)
153153
$(MAKE) MYSQL_VERSION=$* MYSQL_USERNAME=${MYSQL_USERNAME} MYSQL_HOST=$(shell echo ${MYSQL_ENDPOINT} | cut -d: -f1) MYSQL_PASSWORD=${MYSQL_PASSWORD} MYSQL_PORT=$(shell echo ${MYSQL_ENDPOINT} | cut -d: -f2) testrdsdb
@@ -163,21 +163,21 @@ test-tidb-%: ## Run tests against TiDB version (e.g., test-tidb-8.5.3)
163163
@$(MAKE) testtidb$*
164164

165165
testtidb%: ## Run tests against TiDB version (e.g., testtidb8.5.3) [backwards compatible]
166-
@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
166+
@DOCKER_IMAGE=tidb:$* PATH="$(CURDIR)/bin:${PATH}" TF_ACC=1 GOTOOLCHAIN=auto go test -tags=testcontainers ./mysql/... -v $(if $(TESTARGS),-run "$(TESTARGS)",) -timeout=30m
167167

168168
testtidb: ## Run tests against TiDB version (set MYSQL_VERSION)
169-
@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
169+
@DOCKER_IMAGE=tidb:$(MYSQL_VERSION) PATH="$(CURDIR)/bin:${PATH}" TF_ACC=1 GOTOOLCHAIN=auto go test -tags=testcontainers ./mysql/... -v $(if $(TESTARGS),-run "$(TESTARGS)",) -timeout=30m
170170

171171
# MariaDB test targets - use testcontainers
172172
# Preferred format: test-mariadb-VERSION (e.g., test-mariadb-10.10)
173173
test-mariadb-%: ## Run tests against MariaDB version (e.g., test-mariadb-10.10)
174174
@$(MAKE) testmariadb$*
175175

176176
testmariadb%: ## Run tests against MariaDB version (e.g., testmariadb10.10) [backwards compatible]
177-
@DOCKER_IMAGE=mariadb:$* PATH="$(CURDIR)/bin:${PATH}" TF_ACC=1 GOTOOLCHAIN=auto go test -tags=testcontainers ./mysql/... -v $(if $(TESTARGS),-run "$(TESTARGS).*WithTestcontainers",-run WithTestcontainers) -timeout=30m
177+
@DOCKER_IMAGE=mariadb:$* PATH="$(CURDIR)/bin:${PATH}" TF_ACC=1 GOTOOLCHAIN=auto go test -tags=testcontainers ./mysql/... -v $(if $(TESTARGS),-run "$(TESTARGS)",) -timeout=30m
178178

179179
testmariadb: ## Run tests against MariaDB version (set MYSQL_VERSION)
180-
@DOCKER_IMAGE=mariadb:$(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
180+
@DOCKER_IMAGE=mariadb:$(MYSQL_VERSION) PATH="$(CURDIR)/bin:${PATH}" TF_ACC=1 GOTOOLCHAIN=auto go test -tags=testcontainers ./mysql/... -v $(if $(TESTARGS),-run "$(TESTARGS)",) -timeout=30m
181181

182182
vet: ## Run go vet
183183
@echo "go vet ."

0 commit comments

Comments
 (0)