Skip to content

Commit

Permalink
add test
Browse files Browse the repository at this point in the history
  • Loading branch information
zhengkezhou1 committed Mar 2, 2025
1 parent bb4a296 commit 72a9039
Showing 1 changed file with 15 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -79,6 +79,7 @@
import org.apache.gravitino.meta.TopicEntity;
import org.apache.gravitino.meta.UserEntity;
import org.apache.gravitino.storage.RandomIdGenerator;
import org.apache.gravitino.storage.relational.mapper.CatalogMetaMapper;
import org.apache.gravitino.storage.relational.mapper.GroupMetaMapper;
import org.apache.gravitino.storage.relational.mapper.UserMetaMapper;
import org.apache.gravitino.storage.relational.service.MetalakeMetaService;
Expand Down Expand Up @@ -759,6 +760,13 @@ public void testMetaLifeCycleFromCreationToDeletion() throws IOException {
backend.list(catalog.namespace(), Entity.EntityType.CATALOG, true);
assertTrue(catalogs.contains(catalog));

assertEquals(
1,
SessionUtils.doWithCommitAndFetchResult(
CatalogMetaMapper.class,
mapper -> mapper.listCatalogPOsByMetalakeName(metalake.name()))
.size());

List<SchemaEntity> schemas = backend.list(schema.namespace(), Entity.EntityType.SCHEMA, true);
assertTrue(schemas.contains(schema));

Expand Down Expand Up @@ -856,6 +864,13 @@ public void testMetaLifeCycleFromCreationToDeletion() throws IOException {
// meta data soft delete
backend.delete(metalake.nameIdentifier(), Entity.EntityType.METALAKE, true);

assertEquals(
0,
SessionUtils.doWithCommitAndFetchResult(
CatalogMetaMapper.class,
mapper -> mapper.listCatalogPOsByMetalakeName(metalake.name()))
.size());

// check existence after soft delete
assertFalse(backend.exists(metalake.nameIdentifier(), Entity.EntityType.METALAKE));
assertTrue(backend.exists(anotherMetaLake.nameIdentifier(), Entity.EntityType.METALAKE));
Expand Down

0 comments on commit 72a9039

Please sign in to comment.