You are viewing a plain text version of this content. The canonical link for it is here.
Posted to notifications@shardingsphere.apache.org by "sandynz (via GitHub)" <gi...@apache.org> on 2023/05/10 07:03:57 UTC

[GitHub] [shardingsphere] sandynz commented on a diff in pull request #25549: Fix pipeline ci failed when using mysql:8

sandynz commented on code in PR #25549:
URL: https://github.com/apache/shardingsphere/pull/25549#discussion_r1189442635


##########
test/e2e/operation/pipeline/src/test/java/org/apache/shardingsphere/test/e2e/data/pipeline/framework/container/compose/DockerContainerComposer.java:
##########
@@ -66,15 +67,18 @@ public DockerContainerComposer(final DatabaseType databaseType, final String sto
         }
         for (int i = 0; i < storageContainerCount; i++) {
             StorageContainerConfiguration storageContainerConfig;
+            int majorVersion = new DockerImageVersion(storageContainerImage).getMajorVersion();
             if (DatabaseTypeUtils.isMySQL(databaseType)) {
-                int majorVersion = new DockerImageVersion(storageContainerImage).getMajorVersion();
                 Map<String, String> mountedResources = Collections.singletonMap(String.format("/env/mysql/mysql%s/my.cnf", majorVersion), MySQLContainer.MYSQL_CONF_IN_CONTAINER);
                 storageContainerConfig = MySQLContainerConfigurationFactory.newInstance(null, null, mountedResources);
             } else {
                 storageContainerConfig = StorageContainerConfigurationFactory.newInstance(databaseType);
             }
             DockerStorageContainer storageContainer = getContainers().registerContainer((DockerStorageContainer) StorageContainerFactory.newInstance(databaseType, storageContainerImage, null,
                     storageContainerConfig));
+            if (majorVersion > 5 && DatabaseTypeUtils.isMySQL(databaseType)) {
+                storageContainer.withClasspathResourceMapping("/env/mysql/mysql8/02-initdb.sql", "/docker-entrypoint-initdb.d/02-initdb.sql", BindMode.READ_ONLY);
+            }

Review Comment:
   There're duplicated `DatabaseTypeUtils.isMySQL(databaseType)`, could we merge these code blocks for better readability?



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: notifications-unsubscribe@shardingsphere.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org