yashmayya commented on code in PR #15733: URL: https://github.com/apache/pinot/pull/15733#discussion_r2080973032
########## 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` also returns the `Exception` so you can make the same assertions on the message string as you're doing here already? -- 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