tkalkirill commented on code in PR #2485:
URL: https://github.com/apache/ignite-3/pull/2485#discussion_r1303800651


##########
modules/catalog/src/test/java/org/apache/ignite/internal/catalog/CatalogManagerValidationTest.java:
##########
@@ -550,6 +557,118 @@ void testValidateZoneNamesOnRenameZone() {
         );
     }
 
+    @Test
+    void testValidateTableNameOnIndexCreate() {
+        assertThat(
+                
manager.createIndex(CreateHashIndexParams.builder().schemaName(DEFAULT_SCHEMA_NAME).indexName(INDEX_NAME).build()),
+                willThrowFast(CatalogValidationException.class, "Missing table 
name")
+        );
+
+        assertThat(
+                
manager.createIndex(CreateSortedIndexParams.builder().schemaName(DEFAULT_SCHEMA_NAME).indexName(INDEX_NAME).build()),
+                willThrowFast(CatalogValidationException.class, "Missing table 
name")
+        );
+    }
+
+    @Test
+    void testValidateIndexNameOnIndexCreate() {
+        assertThat(
+                
manager.createIndex(CreateHashIndexParams.builder().schemaName(DEFAULT_SCHEMA_NAME).tableName(TABLE_NAME).build()),
+                willThrowFast(CatalogValidationException.class, "Missing index 
name")
+        );
+
+        assertThat(
+                
manager.createIndex(CreateSortedIndexParams.builder().schemaName(DEFAULT_SCHEMA_NAME).tableName(TABLE_NAME).build()),
+                willThrowFast(CatalogValidationException.class, "Missing index 
name")
+        );
+    }
+
+    @Test
+    void testValidateIndexColumnsNotSpecifiedOnIndexCreate() {
+        assertThat(
+                manager.createIndex(createHashIndexParams(INDEX_NAME, null)),
+                willThrowFast(CatalogValidationException.class, "Columns not 
specified")
+        );
+
+        assertThat(
+                manager.createIndex(createSortedIndexParams(INDEX_NAME, null, 
null)),
+                willThrowFast(CatalogValidationException.class, "Columns not 
specified")
+        );
+
+        assertThat(
+                manager.createIndex(createHashIndexParams(INDEX_NAME, 
List.of())),
+                willThrowFast(CatalogValidationException.class, "Columns not 
specified")
+        );
+
+        assertThat(
+                manager.createIndex(createSortedIndexParams(INDEX_NAME, 
List.of(), null)),
+                willThrowFast(CatalogValidationException.class, "Columns not 
specified")
+        );
+    }
+
+    @Test
+    void testValidateIndexColumnsContainsNullOnIndexCreate() {
+        assertThat(
+                manager.createIndex(createHashIndexParams(INDEX_NAME, 
Arrays.asList("key", null))),
+                willThrowFast(CatalogValidationException.class, "One of the 
columns is null")
+        );
+
+        assertThat(
+                manager.createIndex(createSortedIndexParams(INDEX_NAME, 
Arrays.asList("key", null), null)),
+                willThrowFast(CatalogValidationException.class, "One of the 
columns is null")
+        );
+    }
+
+    @Test
+    void testValidateIndexColumnsDuplicatesOnIndexCreate() {

Review Comment:
   fix 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: [email protected]

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

Reply via email to