dimas-b commented on code in PR #4638:
URL: https://github.com/apache/polaris/pull/4638#discussion_r3377311841


##########
runtime/service/src/test/java/org/apache/polaris/service/catalog/common/CatalogUtilsTest.java:
##########
@@ -0,0 +1,57 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *   http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.apache.polaris.service.catalog.common;
+
+import static org.mockito.Mockito.mock;
+import static org.mockito.Mockito.when;
+
+import java.util.List;
+import java.util.Set;
+import org.apache.iceberg.catalog.TableIdentifier;
+import org.apache.iceberg.exceptions.ForbiddenException;
+import org.apache.polaris.core.config.FeatureConfiguration;
+import org.apache.polaris.core.config.RealmConfig;
+import org.apache.polaris.core.persistence.PolarisResolvedPathWrapper;
+import org.assertj.core.api.Assertions;
+import org.junit.jupiter.params.ParameterizedTest;
+import org.junit.jupiter.params.provider.ValueSource;
+
+public class CatalogUtilsTest {
+
+  @ParameterizedTest
+  @ValueSource(strings = {"file:/tmp/test", "http://example.com/table"})
+  public void testRejectLocationsWhenFileStorageDisabled(String location) {
+    RealmConfig realmConfig = mock(RealmConfig.class);
+    
when(realmConfig.getConfig(FeatureConfiguration.SUPPORTED_CATALOG_STORAGE_TYPES))
+        .thenReturn(List.of("S3"));
+
+    PolarisResolvedPathWrapper resolvedStorageEntity = 
mock(PolarisResolvedPathWrapper.class);
+    when(resolvedStorageEntity.getRawFullPath()).thenReturn(List.of());
+
+    Assertions.assertThatThrownBy(
+            () ->
+                CatalogUtils.validateLocationsForTableLike(

Review Comment:
   This is a correct test, but I'm not sure it is worth adding, TBH 🤷 
   
   In runtime, these locations would be rejected by 
`PolarisServiceImpl.validateStorageConfig()` and associated child location 
checks.
   
   Do you actually have a use case where the exception triggered by this test 
happens in a deployed Polaris Server?



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]

Reply via email to