This is an automated email from the ASF dual-hosted git repository.
zhangliang 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 5ec883dcef5 Fix ReadwriteSplittingSQLRouterTest (#33147)
5ec883dcef5 is described below
commit 5ec883dcef5a872d16b58774629f2f2d4350a48b
Author: Liang Zhang <[email protected]>
AuthorDate: Mon Oct 7 19:25:08 2024 +0800
Fix ReadwriteSplittingSQLRouterTest (#33147)
---
.../readwritesplitting/route/ReadwriteSplittingSQLRouterTest.java | 6 +++---
1 file changed, 3 insertions(+), 3 deletions(-)
diff --git
a/features/readwrite-splitting/core/src/test/java/org/apache/shardingsphere/readwritesplitting/route/ReadwriteSplittingSQLRouterTest.java
b/features/readwrite-splitting/core/src/test/java/org/apache/shardingsphere/readwritesplitting/route/ReadwriteSplittingSQLRouterTest.java
index 9f6b3eac202..e0df7dd33d8 100644
---
a/features/readwrite-splitting/core/src/test/java/org/apache/shardingsphere/readwritesplitting/route/ReadwriteSplittingSQLRouterTest.java
+++
b/features/readwrite-splitting/core/src/test/java/org/apache/shardingsphere/readwritesplitting/route/ReadwriteSplittingSQLRouterTest.java
@@ -47,7 +47,9 @@ import org.junit.jupiter.api.extension.ExtendWith;
import org.mockito.Mock;
import org.mockito.junit.jupiter.MockitoExtension;
+import java.util.Arrays;
import java.util.Collections;
+import java.util.HashSet;
import java.util.Iterator;
import java.util.Optional;
import java.util.Properties;
@@ -110,9 +112,7 @@ class ReadwriteSplittingSQLRouterTest {
mock(DatabaseType.class), mock(ResourceMetaData.class,
RETURNS_DEEP_STUBS), ruleMetaData, Collections.emptyMap());
RouteContext actual = mockRouteContext();
sqlRouter.decorateRouteContext(actual, queryContext, database,
staticRule, new ConfigurationProperties(new Properties()));
- Iterator<String> routedDataSourceNames =
actual.getActualDataSourceNames().iterator();
- assertThat(routedDataSourceNames.next(),
is(NONE_READWRITE_SPLITTING_DATASOURCE_NAME));
- assertThat(routedDataSourceNames.next(), is(READ_DATASOURCE));
+ assertThat(actual.getActualDataSourceNames(), is(new
HashSet<>(Arrays.asList(NONE_READWRITE_SPLITTING_DATASOURCE_NAME,
READ_DATASOURCE))));
}
@Test