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 2023/05/14 13:16:57 UTC
[shardingsphere] branch master updated: Fix sonar issue of Add at least one assertion to this test case (#25660)
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 9b363dcb5d9 Fix sonar issue of Add at least one assertion to this test case (#25660)
9b363dcb5d9 is described below
commit 9b363dcb5d984565b4e496d2f90539f0369f6a2b
Author: Liang Zhang <zh...@apache.org>
AuthorDate: Sun May 14 21:16:46 2023 +0800
Fix sonar issue of Add at least one assertion to this test case (#25660)
---
.../test/e2e/driver/statement/ShardingPreparedStatementTest.java | 4 +++-
.../it/data/pipeline/core/prepare/InventoryTaskSplitterTest.java | 7 ++++++-
.../test/it/data/pipeline/core/task/IncrementalTaskTest.java | 6 ++++--
3 files changed, 13 insertions(+), 4 deletions(-)
diff --git a/test/e2e/driver/src/test/java/org/apache/shardingsphere/test/e2e/driver/statement/ShardingPreparedStatementTest.java b/test/e2e/driver/src/test/java/org/apache/shardingsphere/test/e2e/driver/statement/ShardingPreparedStatementTest.java
index 7bcaf63f4f4..771997b5790 100644
--- a/test/e2e/driver/src/test/java/org/apache/shardingsphere/test/e2e/driver/statement/ShardingPreparedStatementTest.java
+++ b/test/e2e/driver/src/test/java/org/apache/shardingsphere/test/e2e/driver/statement/ShardingPreparedStatementTest.java
@@ -507,7 +507,9 @@ class ShardingPreparedStatementTest extends AbstractShardingDriverTest {
void assertExecuteSelectColumnGetResultSet() throws SQLException {
try (PreparedStatement preparedStatement = getShardingSphereDataSource().getConnection().prepareStatement(SELECT_SQL_COLUMN_WITH_PARAMETER_MARKER)) {
preparedStatement.setString(1, "item_id");
- preparedStatement.executeQuery();
+ try (ResultSet resultSet = preparedStatement.executeQuery()) {
+ assertThat(resultSet.getMetaData().getColumnCount(), is(3));
+ }
}
}
diff --git a/test/it/pipeline/src/test/java/org/apache/shardingsphere/test/it/data/pipeline/core/prepare/InventoryTaskSplitterTest.java b/test/it/pipeline/src/test/java/org/apache/shardingsphere/test/it/data/pipeline/core/prepare/InventoryTaskSplitterTest.java
index bfa0ed95b5f..be205ea76ca 100644
--- a/test/it/pipeline/src/test/java/org/apache/shardingsphere/test/it/data/pipeline/core/prepare/InventoryTaskSplitterTest.java
+++ b/test/it/pipeline/src/test/java/org/apache/shardingsphere/test/it/data/pipeline/core/prepare/InventoryTaskSplitterTest.java
@@ -106,7 +106,12 @@ class InventoryTaskSplitterTest {
@Test
void assertSplitInventoryDataWithCharPrimary() throws SQLException {
initCharPrimaryEnvironment(dumperConfig);
- inventoryTaskSplitter.splitInventoryData(jobItemContext);
+ List<InventoryTask> actual = inventoryTaskSplitter.splitInventoryData(jobItemContext);
+ assertThat(actual.size(), is(1));
+ assertThat(actual.get(0).getTaskId(), is("ds_0.t_order#0"));
+ IntegerPrimaryKeyPosition keyPosition = (IntegerPrimaryKeyPosition) actual.get(0).getTaskProgress().getPosition();
+ assertThat(keyPosition.getBeginValue(), is(0L));
+ assertThat(keyPosition.getEndValue(), is(999L));
}
@Test
diff --git a/test/it/pipeline/src/test/java/org/apache/shardingsphere/test/it/data/pipeline/core/task/IncrementalTaskTest.java b/test/it/pipeline/src/test/java/org/apache/shardingsphere/test/it/data/pipeline/core/task/IncrementalTaskTest.java
index 66dc8fbee93..49d84f74c7a 100644
--- a/test/it/pipeline/src/test/java/org/apache/shardingsphere/test/it/data/pipeline/core/task/IncrementalTaskTest.java
+++ b/test/it/pipeline/src/test/java/org/apache/shardingsphere/test/it/data/pipeline/core/task/IncrementalTaskTest.java
@@ -30,6 +30,8 @@ import org.apache.shardingsphere.test.it.data.pipeline.core.util.PipelineContext
import org.junit.jupiter.api.AfterEach;
import org.junit.jupiter.api.BeforeAll;
import org.junit.jupiter.api.BeforeEach;
+import org.junit.jupiter.api.Disabled;
+import org.junit.jupiter.api.Test;
import java.util.concurrent.CompletableFuture;
import java.util.concurrent.ExecutionException;
@@ -65,8 +67,8 @@ class IncrementalTaskTest {
incrementalTask.stop();
}
- // TODO H2 doesn't support incremental
- // @Test
+ @Test
+ @Disabled("H2 doesn't support incremental")
void assertStart() throws ExecutionException, InterruptedException, TimeoutException {
CompletableFuture.allOf(incrementalTask.start().toArray(new CompletableFuture[0])).get(10, TimeUnit.SECONDS);
assertThat(incrementalTask.getTaskId(), is("ds_0"));