This is an automated email from the ASF dual-hosted git repository.

azexin pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/shardingsphere.git


The following commit(s) were added to refs/heads/master by this push:
     new 103aec3bd2e Improve pipeline E2E registerStorageUnit (#26830)
103aec3bd2e is described below

commit 103aec3bd2ee42e64d935392c966ab3ec8426978
Author: Hongsheng Zhong <[email protected]>
AuthorDate: Sat Jul 8 14:14:20 2023 +0800

    Improve pipeline E2E registerStorageUnit (#26830)
    
    * Improve pipeline E2E registerStorageUnit
    
    * Revert AwaitTimeoutUtil
---
 .../pipeline/cases/PipelineContainerComposer.java  |  1 +
 .../test/e2e/data/pipeline/cases/cdc/CDCE2EIT.java |  3 --
 .../cases/migration/AbstractMigrationE2EIT.java    | 10 ++-----
 .../e2e/data/pipeline/util/AwaitTimeoutUtil.java   | 34 ----------------------
 4 files changed, 4 insertions(+), 44 deletions(-)

diff --git 
a/test/e2e/operation/pipeline/src/test/java/org/apache/shardingsphere/test/e2e/data/pipeline/cases/PipelineContainerComposer.java
 
b/test/e2e/operation/pipeline/src/test/java/org/apache/shardingsphere/test/e2e/data/pipeline/cases/PipelineContainerComposer.java
index dbfee4598a0..8e214531c1b 100644
--- 
a/test/e2e/operation/pipeline/src/test/java/org/apache/shardingsphere/test/e2e/data/pipeline/cases/PipelineContainerComposer.java
+++ 
b/test/e2e/operation/pipeline/src/test/java/org/apache/shardingsphere/test/e2e/data/pipeline/cases/PipelineContainerComposer.java
@@ -227,6 +227,7 @@ public final class PipelineContainerComposer implements 
AutoCloseable {
                 .replace("${password}", getPassword())
                 .replace("${url}", getActualJdbcUrlTemplate(storageUnitName, 
true));
         proxyExecuteWithLog(registerStorageUnitTemplate, 1);
+        Awaitility.await().ignoreExceptions().atMost(10, 
TimeUnit.SECONDS).pollInterval(1, TimeUnit.SECONDS).until(() -> 
showStorageUnitsName().contains(storageUnitName));
     }
     
     /**
diff --git 
a/test/e2e/operation/pipeline/src/test/java/org/apache/shardingsphere/test/e2e/data/pipeline/cases/cdc/CDCE2EIT.java
 
b/test/e2e/operation/pipeline/src/test/java/org/apache/shardingsphere/test/e2e/data/pipeline/cases/cdc/CDCE2EIT.java
index cd47ac95c63..f36d0029600 100644
--- 
a/test/e2e/operation/pipeline/src/test/java/org/apache/shardingsphere/test/e2e/data/pipeline/cases/cdc/CDCE2EIT.java
+++ 
b/test/e2e/operation/pipeline/src/test/java/org/apache/shardingsphere/test/e2e/data/pipeline/cases/cdc/CDCE2EIT.java
@@ -49,7 +49,6 @@ import 
org.apache.shardingsphere.test.e2e.data.pipeline.framework.param.Pipeline
 import 
org.apache.shardingsphere.test.e2e.data.pipeline.framework.param.PipelineE2ESettings.PipelineE2EDatabaseSettings;
 import 
org.apache.shardingsphere.test.e2e.data.pipeline.framework.param.PipelineE2ETestCaseArgumentsProvider;
 import 
org.apache.shardingsphere.test.e2e.data.pipeline.framework.param.PipelineTestParameter;
-import org.apache.shardingsphere.test.e2e.data.pipeline.util.AwaitTimeoutUtil;
 import 
org.apache.shardingsphere.test.e2e.data.pipeline.util.DataSourceExecuteUtils;
 import 
org.apache.shardingsphere.test.e2e.env.container.atomic.constants.ProxyContainerConstants;
 import org.junit.jupiter.api.condition.EnabledIf;
@@ -106,8 +105,6 @@ class CDCE2EIT {
             for (String each : Arrays.asList(PipelineContainerComposer.DS_0, 
PipelineContainerComposer.DS_1)) {
                 containerComposer.registerStorageUnit(each);
             }
-            
Awaitility.await().ignoreExceptions().atMost(AwaitTimeoutUtil.getTimeout(containerComposer.getDatabaseType()),
 TimeUnit.SECONDS).pollInterval(1, TimeUnit.SECONDS)
-                    .until(() -> 
containerComposer.showStorageUnitsName().containsAll(Arrays.asList(PipelineContainerComposer.DS_0,
 PipelineContainerComposer.DS_1)));
             createOrderTableRule(containerComposer);
             try (Connection connection = 
containerComposer.getProxyDataSource().getConnection()) {
                 initSchemaAndTable(containerComposer, connection, 3);
diff --git 
a/test/e2e/operation/pipeline/src/test/java/org/apache/shardingsphere/test/e2e/data/pipeline/cases/migration/AbstractMigrationE2EIT.java
 
b/test/e2e/operation/pipeline/src/test/java/org/apache/shardingsphere/test/e2e/data/pipeline/cases/migration/AbstractMigrationE2EIT.java
index c6baade542a..2e63a8ca13c 100644
--- 
a/test/e2e/operation/pipeline/src/test/java/org/apache/shardingsphere/test/e2e/data/pipeline/cases/migration/AbstractMigrationE2EIT.java
+++ 
b/test/e2e/operation/pipeline/src/test/java/org/apache/shardingsphere/test/e2e/data/pipeline/cases/migration/AbstractMigrationE2EIT.java
@@ -24,7 +24,6 @@ import 
org.apache.shardingsphere.test.e2e.data.pipeline.cases.PipelineContainerC
 import 
org.apache.shardingsphere.test.e2e.data.pipeline.command.MigrationDistSQLCommand;
 import 
org.apache.shardingsphere.test.e2e.data.pipeline.env.PipelineE2EEnvironment;
 import 
org.apache.shardingsphere.test.e2e.data.pipeline.env.enums.PipelineEnvTypeEnum;
-import org.apache.shardingsphere.test.e2e.data.pipeline.util.AwaitTimeoutUtil;
 import 
org.apache.shardingsphere.test.e2e.env.container.atomic.util.DatabaseTypeUtils;
 import org.awaitility.Awaitility;
 import org.opengauss.util.PSQLException;
@@ -75,8 +74,7 @@ public abstract class AbstractMigrationE2EIT {
                 .replace("${ds3}", 
containerComposer.getActualJdbcUrlTemplate(PipelineContainerComposer.DS_3, 
true))
                 .replace("${ds4}", 
containerComposer.getActualJdbcUrlTemplate(PipelineContainerComposer.DS_4, 
true));
         containerComposer.proxyExecuteWithLog(addTargetResource, 0);
-        
Awaitility.await().ignoreExceptions().atMost(AwaitTimeoutUtil.getTimeout(containerComposer.getDatabaseType()),
 TimeUnit.SECONDS).pollInterval(1L, TimeUnit.SECONDS)
-                .until(() -> 3 == 
containerComposer.showStorageUnitsName().size());
+        Awaitility.await().ignoreExceptions().atMost(5L, 
TimeUnit.SECONDS).pollInterval(1L, TimeUnit.SECONDS).until(() -> 3 == 
containerComposer.showStorageUnitsName().size());
     }
     
     protected void createSourceSchema(final PipelineContainerComposer 
containerComposer, final String schemaName) throws SQLException {
@@ -104,8 +102,7 @@ public abstract class AbstractMigrationE2EIT {
     
     protected void createTargetOrderTableRule(final PipelineContainerComposer 
containerComposer) throws SQLException {
         
containerComposer.proxyExecuteWithLog(migrationDistSQL.getCreateTargetOrderTableRule(),
 0);
-        
Awaitility.await().atMost(AwaitTimeoutUtil.getTimeout(containerComposer.getDatabaseType()),
 TimeUnit.SECONDS).pollInterval(1L, TimeUnit.SECONDS)
-                .until(() -> !containerComposer.queryForListWithLog("SHOW 
SHARDING TABLE RULE t_order").isEmpty());
+        Awaitility.await().atMost(4L, TimeUnit.SECONDS).pollInterval(1L, 
TimeUnit.SECONDS).until(() -> !containerComposer.queryForListWithLog("SHOW 
SHARDING TABLE RULE t_order").isEmpty());
     }
     
     protected void createTargetOrderTableEncryptRule(final 
PipelineContainerComposer containerComposer) throws SQLException {
@@ -114,8 +111,7 @@ public abstract class AbstractMigrationE2EIT {
     
     protected void createTargetOrderItemTableRule(final 
PipelineContainerComposer containerComposer) throws SQLException {
         
containerComposer.proxyExecuteWithLog(migrationDistSQL.getCreateTargetOrderItemTableRule(),
 0);
-        
Awaitility.await().atMost(AwaitTimeoutUtil.getTimeout(containerComposer.getDatabaseType()),
 TimeUnit.SECONDS).pollInterval(1L, TimeUnit.SECONDS)
-                .until(() -> !containerComposer.queryForListWithLog("SHOW 
SHARDING TABLE RULE t_order_item").isEmpty());
+        Awaitility.await().atMost(4L, TimeUnit.SECONDS).pollInterval(1L, 
TimeUnit.SECONDS).until(() -> !containerComposer.queryForListWithLog("SHOW 
SHARDING TABLE RULE t_order_item").isEmpty());
     }
     
     protected void startMigration(final PipelineContainerComposer 
containerComposer, final String sourceTableName, final String targetTableName) 
throws SQLException {
diff --git 
a/test/e2e/operation/pipeline/src/test/java/org/apache/shardingsphere/test/e2e/data/pipeline/util/AwaitTimeoutUtil.java
 
b/test/e2e/operation/pipeline/src/test/java/org/apache/shardingsphere/test/e2e/data/pipeline/util/AwaitTimeoutUtil.java
deleted file mode 100644
index 37f89ac7f8a..00000000000
--- 
a/test/e2e/operation/pipeline/src/test/java/org/apache/shardingsphere/test/e2e/data/pipeline/util/AwaitTimeoutUtil.java
+++ /dev/null
@@ -1,34 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements.  See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License.  You may obtain a copy of the License at
- *
- *     http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package org.apache.shardingsphere.test.e2e.data.pipeline.util;
-
-import org.apache.shardingsphere.infra.database.type.DatabaseType;
-import 
org.apache.shardingsphere.infra.database.type.dialect.OpenGaussDatabaseType;
-
-public final class AwaitTimeoutUtil {
-    
-    /**
-     * Get timeout, openGauss metadata reload slowly need special handling.
-     *
-     * @param databaseType database type.
-     * @return timeout
-     */
-    public static long getTimeout(final DatabaseType databaseType) {
-        return databaseType instanceof OpenGaussDatabaseType ? 60 : 10;
-    }
-}

Reply via email to