nastra commented on code in PR #10369:
URL: https://github.com/apache/iceberg/pull/10369#discussion_r1624509499


##########
core/src/test/java/org/apache/iceberg/rest/TestRESTCatalog.java:
##########
@@ -2655,6 +2656,68 @@ public void testCleanupCleanableExceptionsReplace() {
         .isInstanceOf(NotFoundException.class);
   }
 
+  @ParameterizedTest
+  @ValueSource(strings = {"1", "2"})
+  public void testCreateTableTransaction(String formatVersion) {
+    RESTCatalogAdapter adapter = Mockito.spy(new 
RESTCatalogAdapter(backendCatalog));
+    RESTCatalog catalog = catalog(adapter);
+
+    if (requiresNamespaceCreate()) {
+      catalog.createNamespace(NS);
+    }
+
+    // Test create table transaction with no data file
+    Transaction createTableTransaction1 =
+        catalog.newCreateTableTransaction(
+            TableIdentifier.of(NS, "table1"),
+            SCHEMA,
+            PartitionSpec.unpartitioned(),
+            ImmutableMap.of("format-version", formatVersion));
+    assertThatNoException().isThrownBy(() -> 
createTableTransaction1.commitTransaction());

Review Comment:
   In fact we should move this to `CatalogTests`, so that we make sure this 
works across different catalog implementations:
   
   ```
   @ParameterizedTest
     @ValueSource(ints = {1, 2})
     public void createTableTransaction(int formatVersion) {
       if (requiresNamespaceCreate()) {
         catalog().createNamespace(NS);
       }
   
       catalog()
               .newCreateTableTransaction(
                       TABLE,
                       SCHEMA,
                       PartitionSpec.unpartitioned(),
                       ImmutableMap.of("format-version", 
String.valueOf(formatVersion)))
               .commitTransaction();
   
       BaseTable table = (BaseTable) catalog().loadTable(TABLE);
       
assertThat(table.operations().current().formatVersion()).isEqualTo(formatVersion);
     }
   ```



-- 
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: issues-unsubscr...@iceberg.apache.org

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


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

Reply via email to