You are viewing a plain text version of this content. The canonical link for it is here.
Posted to notifications@shardingsphere.apache.org by pa...@apache.org on 2022/02/11 03:29:48 UTC

[shardingsphere] branch master updated: Fix test error for fill data issue (#15348)

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

panjuan 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 375361c  Fix test error for fill data issue (#15348)
375361c is described below

commit 375361cef4fdc1c03b7744765d823c2390abdf90
Author: Liang Zhang <zh...@apache.org>
AuthorDate: Fri Feb 11 11:28:27 2022 +0800

    Fix test error for fill data issue (#15348)
    
    * Fix test error for fill data issue
    
    * Fix test error for fill data issue
---
 .../shardingsphere/test/integration/engine/dql/BaseDQLIT.java | 11 ++++++-----
 1 file changed, 6 insertions(+), 5 deletions(-)

diff --git a/shardingsphere-test/shardingsphere-integration-test/shardingsphere-integration-test-suite/src/test/java/org/apache/shardingsphere/test/integration/engine/dql/BaseDQLIT.java b/shardingsphere-test/shardingsphere-integration-test/shardingsphere-integration-test-suite/src/test/java/org/apache/shardingsphere/test/integration/engine/dql/BaseDQLIT.java
index 7c189ed..3c366ee 100644
--- a/shardingsphere-test/shardingsphere-integration-test/shardingsphere-integration-test-suite/src/test/java/org/apache/shardingsphere/test/integration/engine/dql/BaseDQLIT.java
+++ b/shardingsphere-test/shardingsphere-integration-test/shardingsphere-integration-test-suite/src/test/java/org/apache/shardingsphere/test/integration/engine/dql/BaseDQLIT.java
@@ -34,6 +34,7 @@ import java.sql.Types;
 import java.text.ParseException;
 import java.text.SimpleDateFormat;
 import java.util.Collection;
+import java.util.HashSet;
 import java.util.LinkedList;
 import java.util.List;
 
@@ -43,7 +44,7 @@ import static org.junit.Assert.assertTrue;
 
 public abstract class BaseDQLIT extends SingleITCase {
     
-    private static volatile boolean filled;
+    private static final Collection<String> FILLED_SCENARIOS = new HashSet<>();
     
     public BaseDQLIT(final AssertionParameterizedArray parameter) {
         super(parameter);
@@ -56,11 +57,11 @@ public abstract class BaseDQLIT extends SingleITCase {
     }
     
     private void fillDataOnlyOnce() throws SQLException, ParseException, IOException, JAXBException {
-        if (!filled) {
-            synchronized (this) {
-                if (!filled) {
+        if (!FILLED_SCENARIOS.contains(getScenario())) {
+            synchronized (FILLED_SCENARIOS) {
+                if (!FILLED_SCENARIOS.contains(getScenario())) {
                     new DataSetEnvironmentManager(EnvironmentPath.getDataSetFile(getScenario()), getStorageContainer().getDataSourceMap()).fillData();
-                    filled = true;
+                    FILLED_SCENARIOS.add(getScenario());
                 }
             }
         }