You are viewing a plain text version of this content. The canonical link for it is here.
Posted to notifications@shardingsphere.apache.org by GitBox <gi...@apache.org> on 2022/04/27 08:26:25 UTC

[GitHub] [shardingsphere] azexcy commented on a diff in pull request #17140: Improvement scaling IT test

azexcy commented on code in PR #17140:
URL: https://github.com/apache/shardingsphere/pull/17140#discussion_r859522917


##########
shardingsphere-test/shardingsphere-integration-test/shardingsphere-integration-test-scaling/src/test/java/org/apache/shardingsphere/integration/data/pipeline/container/proxy/ShardingSphereProxyDockerContainer.java:
##########
@@ -47,34 +44,22 @@ public ShardingSphereProxyDockerContainer(final DatabaseType databaseType) {
     @Override
     protected void configure() {
         mapConfigurationFiles();
-        withExposedPorts(3307);
-        setWaitStrategy(new JDBCConnectionWaitStrategy(() -> DriverManager.getConnection(DataSourceEnvironment.getURL(databaseType, getHost(), getMappedPort(3307), ""), "root", "root")));
+        if (DatabaseTypeUtil.isPostgreSQL(databaseType)) {
+            setWaitStrategy(new JDBCConnectionWaitStrategy(() -> DriverManager.getConnection(DataSourceEnvironment.getURL(databaseType, getHost(), getMappedPort(3307), "postgres"), "root", "root")));
+        } else {
+            setWaitStrategy(new JDBCConnectionWaitStrategy(() -> DriverManager.getConnection(DataSourceEnvironment.getURL(databaseType, getHost(), getMappedPort(3307), ""), "root", "root")));
+        }
     }
     
     private void mapConfigurationFiles() {
-        withClasspathResourceMapping("/env/conf/", "/opt/shardingsphere-proxy/conf", BindMode.READ_ONLY);
-    }
-    
-    @Slf4j
-    @RequiredArgsConstructor
-    private static class JDBCConnectionWaitStrategy extends AbstractWaitStrategy {
-        
-        private final Callable<Connection> connectionSupplier;
-        
-        @Override
-        protected void waitUntilReady() {
-            Unreliables.retryUntilSuccess((int) startupTimeout.getSeconds(), TimeUnit.SECONDS, () -> {
-                getRateLimiter().doWhenReady(() -> {
-                    try (Connection unused = connectionSupplier.call()) {
-                        log.info("Container ready");
-                        // CHECKSTYLE:OFF
-                    } catch (final Exception ex) {
-                        // CHECKSTYLE:ON
-                        throw new RuntimeException("Not Ready yet.", ex);
-                    }
-                });
-                return true;
-            });
+        // TODO PostgreSQL JDBC create databases not success, use config file instead. need to fix it.
+        if (DatabaseTypeUtil.isPostgreSQL(databaseType)) {
+            withClasspathResourceMapping("/env/postgresql/config-sharding.yaml", "/opt/shardingsphere-proxy/conf/config-sharding.yaml", BindMode.READ_ONLY);
+        }
+        withClasspathResourceMapping(String.format("/env/%s/server.yaml", databaseType.getName().toLowerCase()), "/opt/shardingsphere-proxy/conf/server.yaml", BindMode.READ_ONLY);
+        if (IntegrationTestEnvironment.getInstance().getItEnvType() == ITEnvTypeEnum.LOCAL) {
+            addFixedExposedPort(3307, 3307);
+            addFixedExposedPort(3308, 3308);
         }

Review Comment:
   It's hopeful for debug at LOCAL mode



-- 
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