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


##########
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:
   assertThrows(Exception) would not help as all the error are converted into 
IOException so we need to differentiate between errors.
   
   For assertThrows(String, Exception) we would need to match the complete 
string, so I just used it.



-- 
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