This is an automated email from the ASF dual-hosted git repository.
jshao pushed a commit to branch main
in repository https://gitbox.apache.org/repos/asf/gravitino.git
The following commit(s) were added to refs/heads/main by this push:
new 10252e77ee [#6650] improvement(test): add IT to cover altering catalog
location (#6653)
10252e77ee is described below
commit 10252e77ee67b00f3022fafde7c5f49eaab5e00d
Author: mchades <[email protected]>
AuthorDate: Mon Mar 10 19:40:02 2025 +0800
[#6650] improvement(test): add IT to cover altering catalog location (#6653)
### What changes were proposed in this pull request?
add IT to cover altering catalog location
### Why are the changes needed?
Fix: #6650
### Does this PR introduce _any_ user-facing change?
no
### How was this patch tested?
test added
---
.../hadoop/integration/test/HadoopCatalogIT.java | 17 ++++++++++++++++-
1 file changed, 16 insertions(+), 1 deletion(-)
diff --git
a/catalogs/catalog-hadoop/src/test/java/org/apache/gravitino/catalog/hadoop/integration/test/HadoopCatalogIT.java
b/catalogs/catalog-hadoop/src/test/java/org/apache/gravitino/catalog/hadoop/integration/test/HadoopCatalogIT.java
index 73a967b61a..25952bb4ab 100644
---
a/catalogs/catalog-hadoop/src/test/java/org/apache/gravitino/catalog/hadoop/integration/test/HadoopCatalogIT.java
+++
b/catalogs/catalog-hadoop/src/test/java/org/apache/gravitino/catalog/hadoop/integration/test/HadoopCatalogIT.java
@@ -52,6 +52,7 @@ import org.apache.hadoop.fs.FileSystem;
import org.apache.hadoop.fs.Path;
import org.junit.jupiter.api.AfterAll;
import org.junit.jupiter.api.Assertions;
+import org.junit.jupiter.api.Assumptions;
import org.junit.jupiter.api.BeforeAll;
import org.junit.jupiter.api.Tag;
import org.junit.jupiter.api.Test;
@@ -147,8 +148,10 @@ public class HadoopCatalogIT extends BaseIT {
}
@Test
- void testAlterCatalogLocation() {
+ void testAlterCatalogLocation() throws IOException {
+ Assumptions.assumeTrue(getClass() == HadoopCatalogIT.class);
String catalogName =
GravitinoITUtils.genRandomName("test_alter_catalog_location");
+ String filesetName = "test_fileset1";
String location = defaultBaseLocation();
String newLocation = location + "/new_location";
@@ -157,14 +160,26 @@ public class HadoopCatalogIT extends BaseIT {
Catalog filesetCatalog =
metalake.createCatalog(
catalogName, Catalog.Type.FILESET, provider, "comment",
catalogProperties);
+ filesetCatalog.asSchemas().createSchema(schemaName, null, null);
+ filesetCatalog
+ .asFilesetCatalog()
+ .createFileset(NameIdentifier.of(schemaName, filesetName), null,
MANAGED, null, null);
Assertions.assertEquals(location,
filesetCatalog.properties().get("location"));
+ Assertions.assertTrue(
+ fileSystem.exists(new Path(location + "/" + schemaName + "/" +
filesetName)));
// Now try to alter the location and change it to `newLocation`.
Catalog modifiedCatalog =
metalake.alterCatalog(catalogName,
CatalogChange.setProperty("location", newLocation));
+ String newFilesetName = "test_fileset2";
+ modifiedCatalog
+ .asFilesetCatalog()
+ .createFileset(NameIdentifier.of(schemaName, newFilesetName), null,
MANAGED, null, null);
Assertions.assertEquals(newLocation,
modifiedCatalog.properties().get("location"));
+ Assertions.assertTrue(
+ fileSystem.exists(new Path(newLocation + "/" + schemaName + "/" +
newFilesetName)));
metalake.dropCatalog(catalogName, true);
}