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


##########
modules/catalog/src/test/java/org/apache/ignite/internal/catalog/CatalogManagerSelfTest.java:
##########
@@ -1938,19 +1622,81 @@ void testDropNotExistingIndex() {
         
assertThat(manager.dropIndex(DropIndexParams.builder().indexName(INDEX_NAME).build()),
 willThrowFast(IndexNotFoundException.class));
     }
 
-    private void createSomeTable(String tableName) {
-        CreateTableParams params = CreateTableParams.builder()
-                .schemaName(SCHEMA_NAME)
-                .tableName(tableName)
-                .zone(ZONE_NAME)
-                .columns(List.of(
-                        
ColumnParams.builder().name("key1").type(ColumnType.INT32).build(),
-                        
ColumnParams.builder().name("val1").type(ColumnType.INT32).build()
-                ))
-                .primaryKeyColumns(List.of("key1"))
-                .build();
+    @Test
+    void testDropNotExistingTable() {
+        assertThat(manager.dropTable(dropTableParams(TABLE_NAME)), 
willThrowFast(TableNotFoundException.class));
+    }
+
+    @Test
+    void testCreateTableWithAlreadyExistingName() {
+        assertThat(manager.createTable(simpleTable(TABLE_NAME)), 
willCompleteSuccessfully());
 
-        assertThat(manager.createTable(params), willCompleteSuccessfully());
+        assertThat(manager.createTable(simpleTable(TABLE_NAME)), 
willThrowFast(TableAlreadyExistsException.class));
+    }
+
+    @Test
+    void testCreateTableWithSameNameAsExistingIndex() {
+        assertThat(manager.createTable(simpleTable(TABLE_NAME)), 
willCompleteSuccessfully());
+        assertThat(manager.createIndex(simpleIndex()), 
willCompleteSuccessfully());
+
+        assertThat(manager.createTable(simpleTable(INDEX_NAME)), 
willThrowFast(IndexAlreadyExistsException.class));
+    }
+
+    @Test
+    void testDropColumnWithNotExistingTable() {
+        assertThat(manager.dropColumn(dropColumnParams("key")), 
willThrowFast(TableNotFoundException.class));
+    }
+
+    @Test
+    void testDropColumnWithMissingTableColumns() {
+        assertThat(manager.createTable(simpleTable(TABLE_NAME)), 
willCompleteSuccessfully());
+
+        assertThat(manager.dropColumn(dropColumnParams("fake")), 
willThrowFast(ColumnNotFoundException.class));
+    }
+
+    @Test
+    void testDropColumnWithPrimaryKeyColumns() {
+        assertThat(manager.createTable(simpleTable(TABLE_NAME)), 
willCompleteSuccessfully());
+
+        assertThat(
+                manager.dropColumn(dropColumnParams("ID")),
+                willThrowFast(IgniteException.class, "Can't drop primary key 
columns: [ID]")
+        );
+    }
+
+    @Test
+    void testDropColumnWithIndexColumns() {
+        assertThat(manager.createTable(simpleTable(TABLE_NAME)), 
willCompleteSuccessfully());
+        assertThat(manager.createIndex(simpleIndex()), 
willCompleteSuccessfully());
+
+        assertThat(
+                manager.dropColumn(dropColumnParams("VAL")),
+                willThrowFast(IgniteException.class, String.format("Can't drop 
indexed column: [columnName=VAL, indexName=%s]", INDEX_NAME))
+        );
+    }
+
+    @Test
+    void testAddColumnWithNotExistingTable() {
+        assertThat(manager.addColumn(addColumnParams(columnParams("key", 
INT32))), willThrowFast(TableNotFoundException.class));
+    }
+
+    @Test
+    void testAddColumnWithExistsColumn() {

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