This is an automated email from the ASF dual-hosted git repository.

jackie pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/pinot.git


The following commit(s) were added to refs/heads/master by this push:
     new 3424a51be9 add unit test for S3PinotFS move operation (#13608)
3424a51be9 is described below

commit 3424a51be9e345bbaab45994d9a2970dae0d005d
Author: sullis <[email protected]>
AuthorDate: Mon Jul 15 16:10:47 2024 -0700

    add unit test for S3PinotFS move operation (#13608)
---
 .../pinot/plugin/filesystem/S3PinotFSTest.java     | 31 ++++++++++++++++++++++
 1 file changed, 31 insertions(+)

diff --git 
a/pinot-plugins/pinot-file-system/pinot-s3/src/test/java/org/apache/pinot/plugin/filesystem/S3PinotFSTest.java
 
b/pinot-plugins/pinot-file-system/pinot-s3/src/test/java/org/apache/pinot/plugin/filesystem/S3PinotFSTest.java
index 226254e769..a41391034d 100644
--- 
a/pinot-plugins/pinot-file-system/pinot-s3/src/test/java/org/apache/pinot/plugin/filesystem/S3PinotFSTest.java
+++ 
b/pinot-plugins/pinot-file-system/pinot-s3/src/test/java/org/apache/pinot/plugin/filesystem/S3PinotFSTest.java
@@ -418,6 +418,37 @@ public class S3PinotFSTest {
     Assert.assertTrue(headObjectResponse.sdkHttpResponse().isSuccessful());
   }
 
+  @Test
+  public void testMoveFile()
+      throws Exception {
+
+    String fileName = "file-to-move";
+    int fileSize = 5000;
+
+    File file = new File(TEMP_FILE, fileName);
+
+    try {
+      createDummyFile(file, fileSize);
+      URI sourceUri = URI.create(String.format(FILE_FORMAT, SCHEME, BUCKET, 
fileName));
+
+      _s3PinotFS.copyFromLocalFile(file, sourceUri);
+
+      URI targetUri = URI.create(String.format(FILE_FORMAT, SCHEME, BUCKET, 
"move-target"));
+
+      boolean moveResult = _s3PinotFS.move(sourceUri, targetUri, false);
+      Assert.assertTrue(moveResult);
+
+      Assert.assertFalse(_s3PinotFS.exists(sourceUri));
+      Assert.assertTrue(_s3PinotFS.exists(targetUri));
+
+      HeadObjectResponse headObjectResponse =
+          _s3Client.headObject(S3TestUtils.getHeadObjectRequest(BUCKET, 
"move-target"));
+      Assert.assertEquals(headObjectResponse.contentLength(), fileSize);
+    } finally {
+      FileUtils.deleteQuietly(file);
+    }
+  }
+
   private static void createDummyFile(File file, int size)
       throws IOException {
     FileUtils.deleteQuietly(file);


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

Reply via email to