deniskuzZ commented on code in PR #6638:
URL: https://github.com/apache/hive/pull/6638#discussion_r3656541877


##########
itests/test-docker/src/test/java/org/apache/iceberg/rest/HiveIcebergRESTCatalogTests.java:
##########
@@ -75,4 +84,41 @@ protected boolean supportsNamesWithSlashes() {
   protected boolean supportsServerSideRetry() {
     return true;
   }
+
+  /**
+   * Checks that loading a table fails clearly when its metadata file is 
missing.
+   *
+   * <p>The base Iceberg test moves the metadata file with {@code 
Files.move()} which only works
+   * on a local disk. Docker tests store data on S3, so this override renames 
the metadata file
+   * with Hadoop {@link FileSystem} instead, then puts it back in {@code 
finally}.
+   */
+  @Test
+  @Override
+  public void testLoadTableWithMissingMetadataFile(@TempDir java.nio.file.Path 
tempDir)
+      throws IOException {
+    RESTCatalog catalog = catalog();
+
+    if (requiresNamespaceCreate()) {
+      catalog.createNamespace(TBL.namespace());
+    }
+
+    catalog.buildTable(TBL, SCHEMA).create();
+    assertThat(catalog.tableExists(TBL)).as("Table should exist").isTrue();
+
+    Table table = catalog.loadTable(TBL);
+    String metadataFileLocation =
+        ((HasTableOperations) 
table).operations().current().metadataFileLocation();
+    Path metadataPath = new Path(metadataFileLocation);
+    Path backupPath = metadataPath.suffix(".bak");
+    FileSystem fs = metadataPath.getFileSystem(client.getHadoopConf());
+
+    try {
+      assertThat(fs.rename(metadataPath, backupPath)).isTrue();

Review Comment:
   what is this double rename thingy?
   



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


---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to