abhishekbafna commented on code in PR #15733:
URL: https://github.com/apache/pinot/pull/15733#discussion_r2080985925


##########
pinot-controller/src/test/java/org/apache/pinot/controller/api/resources/PinotLogicalTableResourceTest.java:
##########
@@ -199,15 +200,46 @@ public void testLogicalTableValidationTests()
     }
   }
 
+  @Test
+  public void testLogicalTableSchemaValidation()
+      throws IOException {
+    String addLogicalTableUrl = 
_controllerRequestURLBuilder.forLogicalTableCreate();
+    List<String> physicalTableNamesWithType = 
createHybridTables(List.of("test_table_3"));
+
+    // Test logical table schema does not exist
+    LogicalTableConfig logicalTableConfig =
+        getDummyLogicalTableConfig(LOGICAL_TABLE_NAME, 
physicalTableNamesWithType, BROKER_TENANT);
+    try {
+      ControllerTest.sendPostRequest(addLogicalTableUrl, 
logicalTableConfig.toSingleLineJsonString(), getHeaders());
+      fail("Logical Table POST request should have failed");
+    } catch (IOException e) {
+      assertTrue(e.getMessage().contains("Reason: Schema with same name as 
logical table '" + LOGICAL_TABLE_NAME
+          + "' does not exist"), e.getMessage());
+    }

Review Comment:
   I believe, you mean `expectThrows`. Final outcome:
   
   ```
       Throwable throwable1 = expectThrows(IOException.class, () -> {
         LogicalTableConfig tableConfig = 
getDummyLogicalTableConfig(LOGICAL_TABLE_NAME, List.of(), BROKER_TENANT);
         ControllerTest.sendPostRequest(_addLogicalTableUrl, 
tableConfig.toSingleLineJsonString(), getHeaders());
       });
       assertTrue(throwable1.getMessage().contains("Reason: 
'physicalTableConfigMap' should not be null or empty"),
           throwable1.getMessage());
   ```



-- 
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: commits-unsubscr...@pinot.apache.org

For queries about this service, please contact Infrastructure at:
us...@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscr...@pinot.apache.org
For additional commands, e-mail: commits-h...@pinot.apache.org

Reply via email to