This is an automated email from the ASF dual-hosted git repository.
tuichenchuxin 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 f32301e669a Fix sql federation e2e test error when logical datasource
change (#24703)
f32301e669a is described below
commit f32301e669a5aae36d7d9059adf531382cf113ab
Author: Zhengqiang Duan <[email protected]>
AuthorDate: Tue Mar 21 10:49:16 2023 +0800
Fix sql federation e2e test error when logical datasource change (#24703)
* Fix sql federation e2e test error when logical datasource change
* Fix sharding e2e test error when actual datasource change
---
.../shardingsphere/test/e2e/engine/E2EContainerComposer.java | 7 ++++---
.../apache/shardingsphere/test/e2e/engine/dql/BaseDQLE2EIT.java | 7 ++++---
2 files changed, 8 insertions(+), 6 deletions(-)
diff --git
a/test/e2e/suite/src/test/java/org/apache/shardingsphere/test/e2e/engine/E2EContainerComposer.java
b/test/e2e/suite/src/test/java/org/apache/shardingsphere/test/e2e/engine/E2EContainerComposer.java
index 4241e8411e1..e7c6d10fb32 100644
---
a/test/e2e/suite/src/test/java/org/apache/shardingsphere/test/e2e/engine/E2EContainerComposer.java
+++
b/test/e2e/suite/src/test/java/org/apache/shardingsphere/test/e2e/engine/E2EContainerComposer.java
@@ -75,11 +75,12 @@ public final class E2EContainerComposer {
if (!logicDatabaseInitSQLFile.isPresent()) {
return;
}
- if (!INITIALIZED_SUITES.contains(testParam.getKey())) {
+ String cacheKey = testParam.getKey() + "-" +
System.identityHashCode(targetDataSource);
+ if (!INITIALIZED_SUITES.contains(cacheKey)) {
synchronized (INITIALIZED_SUITES) {
- if (!INITIALIZED_SUITES.contains(testParam.getKey())) {
+ if (!INITIALIZED_SUITES.contains(cacheKey)) {
executeInitSQL(targetDataSource,
logicDatabaseInitSQLFile.get());
- INITIALIZED_SUITES.add(testParam.getKey());
+ INITIALIZED_SUITES.add(cacheKey);
}
}
}
diff --git
a/test/e2e/suite/src/test/java/org/apache/shardingsphere/test/e2e/engine/dql/BaseDQLE2EIT.java
b/test/e2e/suite/src/test/java/org/apache/shardingsphere/test/e2e/engine/dql/BaseDQLE2EIT.java
index 594cd47777d..46953d48abb 100644
---
a/test/e2e/suite/src/test/java/org/apache/shardingsphere/test/e2e/engine/dql/BaseDQLE2EIT.java
+++
b/test/e2e/suite/src/test/java/org/apache/shardingsphere/test/e2e/engine/dql/BaseDQLE2EIT.java
@@ -75,14 +75,15 @@ public abstract class BaseDQLE2EIT {
}
private void fillDataOnlyOnce(final AssertionTestParameter testParam,
final SingleE2EITContainerComposer containerComposer) throws SQLException,
ParseException, IOException, JAXBException {
- if (!FILLED_SUITES.contains(testParam.getKey())) {
+ String cacheKey = testParam.getKey() + "-" +
System.identityHashCode(containerComposer.getContainerComposer().getActualDataSourceMap());
+ if (!FILLED_SUITES.contains(cacheKey)) {
synchronized (FILLED_SUITES) {
- if (!FILLED_SUITES.contains(testParam.getKey())) {
+ if (!FILLED_SUITES.contains(cacheKey)) {
new DataSetEnvironmentManager(
new
ScenarioDataPath(testParam.getScenario()).getDataSetFile(Type.ACTUAL),
containerComposer.getContainerComposer().getActualDataSourceMap()).fillData();
new DataSetEnvironmentManager(
new
ScenarioDataPath(testParam.getScenario()).getDataSetFile(Type.EXPECTED),
containerComposer.getContainerComposer().getExpectedDataSourceMap()).fillData();
- FILLED_SUITES.add(testParam.getKey());
+ FILLED_SUITES.add(cacheKey);
}
}
}