52
52
import org .junit .jupiter .api .Assumptions ;
53
53
import org .junit .jupiter .api .BeforeAll ;
54
54
import org .junit .jupiter .api .BeforeEach ;
55
- import org .junit .jupiter .api .Disabled ;
56
55
import org .junit .jupiter .api .Test ;
57
56
import org .junit .jupiter .api .TestInfo ;
58
57
import org .junit .jupiter .api .extension .ExtendWith ;
@@ -179,10 +178,8 @@ protected boolean overridesRequestedLocation() {
179
178
return true ;
180
179
}
181
180
182
- /** TODO: Unblock this test, see: https://github.com/apache/polaris/issues/1273 */
183
181
@ Override
184
182
@ Test
185
- @ Disabled
186
183
public void createViewWithCustomMetadataLocation () {
187
184
Assertions .assertThatThrownBy (super ::createViewWithCustomMetadataLocation )
188
185
.isInstanceOf (ForbiddenException .class )
@@ -209,6 +206,8 @@ public void createViewWithCustomMetadataLocationUsingPolaris(@TempDir Path tempD
209
206
210
207
assertThat (catalog ().viewExists (identifier )).as ("View should not exist" ).isFalse ();
211
208
209
+ // CAN create a view with a custom metadata location `baseLocation/customLocation`,
210
+ // as long as the location is within the parent namespace's `write.metadata.path=baseLocation`
212
211
View view =
213
212
catalog ()
214
213
.buildView (identifier )
@@ -228,6 +227,9 @@ public void createViewWithCustomMetadataLocationUsingPolaris(@TempDir Path tempD
228
227
.isNotNull ()
229
228
.startsWith (customLocation );
230
229
230
+ // CANNOT update the view with a new metadata location `baseLocation/customLocation2`,
231
+ // even though the new location is still under the parent namespace's
232
+ // `write.metadata.path=baseLocation`.
231
233
Assertions .assertThatThrownBy (
232
234
() ->
233
235
catalog ()
@@ -240,15 +242,19 @@ public void createViewWithCustomMetadataLocationUsingPolaris(@TempDir Path tempD
240
242
.isInstanceOf (ForbiddenException .class )
241
243
.hasMessageContaining ("Forbidden: Invalid locations" );
242
244
243
- catalog ()
244
- .loadView (identifier )
245
- .updateProperties ()
246
- .set (IcebergTableLikeEntity .USER_SPECIFIED_WRITE_METADATA_LOCATION_KEY , customLocationChild )
247
- .commit ();
248
- View childView = catalog ().loadView (identifier );
249
- assertThat (childView .properties ()).containsEntry ("write.metadata.path" , customLocationChild );
250
- assertThat (((BaseView ) childView ).operations ().current ().metadataFileLocation ())
251
- .isNotNull ()
252
- .startsWith (customLocationChild );
245
+ // CANNOT update the view with a child metadata location `baseLocation/customLocation/child`,
246
+ // even though it is a subpath of the original view's
247
+ // `write.metadata.path=baseLocation/customLocation`.
248
+ Assertions .assertThatThrownBy (
249
+ () ->
250
+ catalog ()
251
+ .loadView (identifier )
252
+ .updateProperties ()
253
+ .set (
254
+ IcebergTableLikeEntity .USER_SPECIFIED_WRITE_METADATA_LOCATION_KEY ,
255
+ customLocationChild )
256
+ .commit ())
257
+ .isInstanceOf (ForbiddenException .class )
258
+ .hasMessageContaining ("Forbidden: Invalid locations" );
253
259
}
254
260
}
0 commit comments