@@ -147,8 +147,9 @@ private void dropSchema() {
147
147
}
148
148
149
149
@ Test
150
- void testAlterCatalogLocation () {
150
+ void testAlterCatalogLocation () throws IOException {
151
151
String catalogName = GravitinoITUtils .genRandomName ("test_alter_catalog_location" );
152
+ String filesetName = "test_fileset1" ;
152
153
String location = defaultBaseLocation ();
153
154
String newLocation = location + "/new_location" ;
154
155
@@ -157,14 +158,26 @@ void testAlterCatalogLocation() {
157
158
Catalog filesetCatalog =
158
159
metalake .createCatalog (
159
160
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 );
160
165
161
166
Assertions .assertEquals (location , filesetCatalog .properties ().get ("location" ));
167
+ Assertions .assertTrue (
168
+ fileSystem .exists (new Path (location + "/" + schemaName + "/" + filesetName )));
162
169
163
170
// Now try to alter the location and change it to `newLocation`.
164
171
Catalog modifiedCatalog =
165
172
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 );
166
177
167
178
Assertions .assertEquals (newLocation , modifiedCatalog .properties ().get ("location" ));
179
+ Assertions .assertTrue (
180
+ fileSystem .exists (new Path (newLocation + "/" + schemaName + "/" + newFilesetName )));
168
181
169
182
metalake .dropCatalog (catalogName , true );
170
183
}
0 commit comments