Skip to content

Commit b76a7dc

Browse files
committed
add catalog location test
1 parent 0e41493 commit b76a7dc

File tree

1 file changed

+14
-1
lines changed
  • catalogs/catalog-hadoop/src/test/java/org/apache/gravitino/catalog/hadoop/integration/test

1 file changed

+14
-1
lines changed

catalogs/catalog-hadoop/src/test/java/org/apache/gravitino/catalog/hadoop/integration/test/HadoopCatalogIT.java

+14-1
Original file line numberDiff line numberDiff line change
@@ -147,8 +147,9 @@ private void dropSchema() {
147147
}
148148

149149
@Test
150-
void testAlterCatalogLocation() {
150+
void testAlterCatalogLocation() throws IOException {
151151
String catalogName = GravitinoITUtils.genRandomName("test_alter_catalog_location");
152+
String filesetName = "test_fileset1";
152153
String location = defaultBaseLocation();
153154
String newLocation = location + "/new_location";
154155

@@ -157,14 +158,26 @@ void testAlterCatalogLocation() {
157158
Catalog filesetCatalog =
158159
metalake.createCatalog(
159160
catalogName, Catalog.Type.FILESET, provider, "comment", catalogProperties);
161+
filesetCatalog.asSchemas().createSchema(schemaName, null, null);
162+
filesetCatalog
163+
.asFilesetCatalog()
164+
.createFileset(NameIdentifier.of(schemaName, filesetName), null, MANAGED, null, null);
160165

161166
Assertions.assertEquals(location, filesetCatalog.properties().get("location"));
167+
Assertions.assertTrue(
168+
fileSystem.exists(new Path(location + "/" + schemaName + "/" + filesetName)));
162169

163170
// Now try to alter the location and change it to `newLocation`.
164171
Catalog modifiedCatalog =
165172
metalake.alterCatalog(catalogName, CatalogChange.setProperty("location", newLocation));
173+
String newFilesetName = "test_fileset2";
174+
modifiedCatalog
175+
.asFilesetCatalog()
176+
.createFileset(NameIdentifier.of(schemaName, newFilesetName), null, MANAGED, null, null);
166177

167178
Assertions.assertEquals(newLocation, modifiedCatalog.properties().get("location"));
179+
Assertions.assertTrue(
180+
fileSystem.exists(new Path(newLocation + "/" + schemaName + "/" + newFilesetName)));
168181

169182
metalake.dropCatalog(catalogName, true);
170183
}

0 commit comments

Comments
 (0)