This is an automated email from the ASF dual-hosted git repository.
zhonghongsheng 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 8e14a02d840 Improve Scaling IT case, add unit test (#20048)
8e14a02d840 is described below
commit 8e14a02d840e8de64522fa961787079bb9e0697d
Author: Xinze Guo <[email protected]>
AuthorDate: Wed Aug 10 12:48:15 2022 +0800
Improve Scaling IT case, add unit test (#20048)
* Fix BaseITCase config time too short
* Add unit test
---
.../data/pipeline/cases/base/BaseITCase.java | 3 +-
.../progress/yaml/YamlJobProgressSwapperTest.java | 15 ++++++++++
.../src/test/resources/job-progress-running.yaml | 32 ++++++++++++++++++++++
3 files changed, 48 insertions(+), 2 deletions(-)
diff --git
a/shardingsphere-test/shardingsphere-integration-test/shardingsphere-integration-test-scaling/src/test/java/org/apache/shardingsphere/integration/data/pipeline/cases/base/BaseITCase.java
b/shardingsphere-test/shardingsphere-integration-test/shardingsphere-integration-test-scaling/src/test/java/org/apache/shardingsphere/integration/data/pipeline/cases/base/BaseITCase.java
index 91f267f5d38..3fddc3ca0c0 100644
---
a/shardingsphere-test/shardingsphere-integration-test/shardingsphere-integration-test-scaling/src/test/java/org/apache/shardingsphere/integration/data/pipeline/cases/base/BaseITCase.java
+++
b/shardingsphere-test/shardingsphere-integration-test/shardingsphere-integration-test-scaling/src/test/java/org/apache/shardingsphere/integration/data/pipeline/cases/base/BaseITCase.java
@@ -365,8 +365,7 @@ public abstract class BaseITCase {
if (actualStatus.size() == 1 &&
actualStatus.contains(JobStatus.EXECUTE_INCREMENTAL_TASK.name())) {
break;
} else if (actualStatus.size() >= 1 &&
actualStatus.containsAll(new HashSet<>(Arrays.asList("",
JobStatus.EXECUTE_INCREMENTAL_TASK.name())))) {
- log.error("one of the shardingItem was not started correctly");
- break;
+ log.warn("one of the shardingItem was not started correctly");
}
ThreadUtil.sleep(2, TimeUnit.SECONDS);
}
diff --git
a/shardingsphere-test/shardingsphere-pipeline-test/src/test/java/org/apache/shardingsphere/data/pipeline/core/job/progress/yaml/YamlJobProgressSwapperTest.java
b/shardingsphere-test/shardingsphere-pipeline-test/src/test/java/org/apache/shardingsphere/data/pipeline/core/job/progress/yaml/YamlJobProgressSwapperTest.java
index 2cf2e59b4bd..2ab8aed28c8 100644
---
a/shardingsphere-test/shardingsphere-pipeline-test/src/test/java/org/apache/shardingsphere/data/pipeline/core/job/progress/yaml/YamlJobProgressSwapperTest.java
+++
b/shardingsphere-test/shardingsphere-pipeline-test/src/test/java/org/apache/shardingsphere/data/pipeline/core/job/progress/yaml/YamlJobProgressSwapperTest.java
@@ -67,4 +67,19 @@ public final class YamlJobProgressSwapperTest {
assertNotNull(actual.getIncremental());
assertThat(YamlEngine.marshal(actual),
is(YamlEngine.marshal(yamlProgress)));
}
+
+ @Test
+ public void assertSwapWithRunningConfig() {
+ YamlJobProgress yamlProgress =
YamlEngine.unmarshal(ConfigurationFileUtil.readFile("job-progress-running.yaml"),
YamlJobProgress.class);
+ JobProgress progress = SWAPPER.swapToObject(yamlProgress);
+ assertNotNull(progress.getInventory());
+ assertNotNull(progress.getIncremental());
+ assertThat(progress.getInventory().getInventoryFinishedPercentage(),
is(0));
+ assertThat(progress.getIncremental().getDataSourceName(), is("ds_0"));
+
assertThat(progress.getIncremental().getIncrementalLatestActiveTimeMillis(),
is(0L));
+ YamlJobProgress actual = SWAPPER.swapToYamlConfiguration(progress);
+ assertNotNull(actual.getInventory());
+ assertNotNull(actual.getIncremental());
+ assertThat(YamlEngine.marshal(actual),
is(YamlEngine.marshal(yamlProgress)));
+ }
}
diff --git
a/shardingsphere-test/shardingsphere-pipeline-test/src/test/resources/job-progress-running.yaml
b/shardingsphere-test/shardingsphere-pipeline-test/src/test/resources/job-progress-running.yaml
new file mode 100644
index 00000000000..c71ae9fd49f
--- /dev/null
+++
b/shardingsphere-test/shardingsphere-pipeline-test/src/test/resources/job-progress-running.yaml
@@ -0,0 +1,32 @@
+#
+# 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.
+#
+#
+
+incremental:
+ dataSourceName: ds_0
+ delay:
+ lastEventTimestamps: 0
+ latestActiveTimeMillis: 0
+ position: ''
+inventory:
+ unfinished:
+ ds_0.t_order_2#0: i,0,763960186544062464
+ ds_0.t_order_0#0: i,0,763960186435010560
+ ds_0.t_order_item_0#0: i,0,763960165278941186
+ ds_0.t_order_item_2#0: i,0,763960165274747144
+sourceDatabaseType: H2
+status: RUNNING