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

menghaoran 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 7f65dcf862f Add more unit test for DataSourceUnitPersistServiceTest 
(#38070)
7f65dcf862f is described below

commit 7f65dcf862fb4de3cfc5014fe213bd86b9b60841
Author: Haoran Meng <[email protected]>
AuthorDate: Tue Feb 17 21:17:21 2026 +0800

    Add more unit test for DataSourceUnitPersistServiceTest (#38070)
---
 .../config/database/DataSourceUnitPersistServiceTest.java   | 13 +++++++++++++
 1 file changed, 13 insertions(+)

diff --git 
a/mode/core/src/test/java/org/apache/shardingsphere/mode/metadata/persist/config/database/DataSourceUnitPersistServiceTest.java
 
b/mode/core/src/test/java/org/apache/shardingsphere/mode/metadata/persist/config/database/DataSourceUnitPersistServiceTest.java
index 9c0030ef332..0d24af36932 100644
--- 
a/mode/core/src/test/java/org/apache/shardingsphere/mode/metadata/persist/config/database/DataSourceUnitPersistServiceTest.java
+++ 
b/mode/core/src/test/java/org/apache/shardingsphere/mode/metadata/persist/config/database/DataSourceUnitPersistServiceTest.java
@@ -60,6 +60,19 @@ class DataSourceUnitPersistServiceTest {
         assertThat(actual.get("foo_ds").getPoolClassName(), 
is("org.apache.shardingsphere.test.infra.fixture.jdbc.MockedDataSource"));
     }
     
+    @Test
+    void assertLoadWhenActiveVersionIsEmpty() {
+        
when(repository.query("/metadata/foo_db/data_sources/units/foo_ds/active_version")).thenReturn("");
+        assertFalse(persistService.load("foo_db", "foo_ds").isPresent());
+    }
+    
+    @Test
+    void assertLoadWhenDataSourceContentIsEmpty() {
+        
when(repository.query("/metadata/foo_db/data_sources/units/foo_ds/active_version")).thenReturn("10");
+        
when(repository.query("/metadata/foo_db/data_sources/units/foo_ds/versions/10")).thenReturn("");
+        assertFalse(persistService.load("foo_db", "foo_ds").isPresent());
+    }
+    
     @Test
     void assertLoadWithInvalidDataSource() {
         
when(repository.getChildrenKeys("/metadata/foo_db/data_sources/units")).thenReturn(Arrays.asList("foo_ds",
 "bar_ds"));

Reply via email to