@@ -163,21 +163,23 @@ func contains(s, substr string) bool {
163163// The image parameter is ignored - TestMain uses DOCKER_IMAGE env var
164164// This function validates that DOCKER_IMAGE is set and fails early if not
165165func getSharedMySQLContainer (t * testing.T , image string ) * MySQLTestContainer {
166- // Check if we're in TiDB mode - if so, this function shouldn't be called
167- tidbVersion := os .Getenv ("TIDB_VERSION" )
168- if tidbVersion != "" {
169- t .Fatalf ("ERROR: getSharedMySQLContainer called but TIDB_VERSION is set. " +
170- "TiDB tests should use the shared TiDB cluster from TestMain, not getSharedMySQLContainer." )
171- }
172-
173166 // Validate that DOCKER_IMAGE is set (required by TestMain for MySQL/Percona/MariaDB)
167+ // This validation must always be present - fail early if DOCKER_IMAGE is empty
174168 dockerImage := os .Getenv ("DOCKER_IMAGE" )
175169 if dockerImage == "" {
176170 t .Fatalf ("ERROR: DOCKER_IMAGE environment variable is not set. This is required for MySQL/Percona/MariaDB tests.\n " +
177171 "Please set DOCKER_IMAGE to the appropriate Docker image (e.g., mysql:5.6, percona:8.0, mariadb:10.10)\n " +
178172 "The 'image' parameter to getSharedMySQLContainer is ignored - use DOCKER_IMAGE env var instead." )
179173 }
180174
175+ // Check if we're in TiDB mode - if so, this function shouldn't be called
176+ // TiDB tests use sharedTiDBCluster, not sharedContainer
177+ tidbVersion := os .Getenv ("TIDB_VERSION" )
178+ if tidbVersion != "" {
179+ t .Fatalf ("ERROR: getSharedMySQLContainer called but TIDB_VERSION is set. " +
180+ "TiDB tests should use the shared TiDB cluster from TestMain, not getSharedMySQLContainer." )
181+ }
182+
181183 // Validate that the provided image matches DOCKER_IMAGE (if provided)
182184 if image != "" && image != dockerImage {
183185 t .Fatalf ("ERROR: getSharedMySQLContainer called with image '%s' but DOCKER_IMAGE is set to '%s'.\n " +
0 commit comments