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 d990258d49f Add more unit test for
TableMetaDataPersistEnabledServiceTest (#38068)
d990258d49f is described below
commit d990258d49fd16f597e7cc73c38cd06ddf1b44c1
Author: Haoran Meng <[email protected]>
AuthorDate: Tue Feb 17 21:16:32 2026 +0800
Add more unit test for TableMetaDataPersistEnabledServiceTest (#38068)
---
.../service/TableMetaDataPersistEnabledServiceTest.java | 14 ++++++++++++++
1 file changed, 14 insertions(+)
diff --git
a/mode/core/src/test/java/org/apache/shardingsphere/mode/metadata/persist/metadata/service/TableMetaDataPersistEnabledServiceTest.java
b/mode/core/src/test/java/org/apache/shardingsphere/mode/metadata/persist/metadata/service/TableMetaDataPersistEnabledServiceTest.java
index d222b377367..4c52a9987b6 100644
---
a/mode/core/src/test/java/org/apache/shardingsphere/mode/metadata/persist/metadata/service/TableMetaDataPersistEnabledServiceTest.java
+++
b/mode/core/src/test/java/org/apache/shardingsphere/mode/metadata/persist/metadata/service/TableMetaDataPersistEnabledServiceTest.java
@@ -31,6 +31,7 @@ import java.util.Collections;
import static org.hamcrest.Matchers.is;
import static org.hamcrest.MatcherAssert.assertThat;
+import static org.junit.jupiter.api.Assertions.assertFalse;
import static org.mockito.Mockito.mock;
import static org.mockito.Mockito.verify;
import static org.mockito.Mockito.when;
@@ -59,6 +60,19 @@ class TableMetaDataPersistEnabledServiceTest {
assertThat(actual.iterator().next().getName(), is("foo_tbl"));
}
+ @Test
+ void assertLoadWhenActiveVersionIsEmpty() {
+
when(repository.query("/metadata/foo_db/schemas/foo_schema/tables/foo_tbl/active_version")).thenReturn("");
+ assertFalse(persistService.load("foo_db", "foo_schema",
"foo_tbl").isPresent());
+ }
+
+ @Test
+ void assertLoadWhenTableContentIsEmpty() {
+
when(repository.query("/metadata/foo_db/schemas/foo_schema/tables/foo_tbl/active_version")).thenReturn("0");
+
when(repository.query("/metadata/foo_db/schemas/foo_schema/tables/foo_tbl/versions/0")).thenReturn("");
+ assertFalse(persistService.load("foo_db", "foo_schema",
"foo_tbl").isPresent());
+ }
+
@Test
void assertPersistWithoutVersion() {
ShardingSphereTable table = mock(ShardingSphereTable.class);