You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@dolphinscheduler.apache.org by GitBox <gi...@apache.org> on 2022/01/24 01:44:54 UTC

[GitHub] [dolphinscheduler] SbloodyS commented on a change in pull request #8160: [E2E][CI] Add remaining file management E2E tests

SbloodyS commented on a change in pull request #8160:
URL: https://github.com/apache/dolphinscheduler/pull/8160#discussion_r790367920



##########
File path: dolphinscheduler-e2e/dolphinscheduler-e2e-case/src/test/java/org/apache/dolphinscheduler/e2e/cases/FileManageE2ETest.java
##########
@@ -116,4 +176,130 @@ void testDeleteDirectory() {
             );
         });
     }
+
+    @Test
+    @Order(40)
+    void testCreateFile() {
+        final FileManagePage page = new FileManagePage(browser);
+        String scripts = "echo 123";
+
+        page.createFile(testFileName, scripts);
+
+        await().untilAsserted(() -> assertThat(page.fileList())
+            .as("File list should contain newly-created file")
+            .extracting(WebElement::getText)
+            .anyMatch(it -> it.contains(testFileName)));
+    }
+
+    @Test
+    @Order(41)
+    void testRenameFile() {
+        final FileManagePage page = new FileManagePage(browser);
+
+        page.rename(testFileName, testRenameFileName);
+
+        await().untilAsserted(() -> {
+            browser.navigate().refresh();
+
+            assertThat(page.fileList())
+                .as("File list should contain newly-created file")
+                .extracting(WebElement::getText)
+                .anyMatch(it -> it.contains(testRenameFileName));
+        });
+    }
+
+    @Test
+    @Order(42)
+    void testEditFile() {
+        final FileManagePage page = new FileManagePage(browser);
+        String scripts = "echo 456";
+
+        page.editFile(testRenameFileName, scripts);
+
+        await().untilAsserted(() -> assertThat(page.fileList())
+            .as("File list should contain newly-created file")
+            .extracting(WebElement::getText)
+            .anyMatch(it -> it.contains(testRenameFileName)));
+    }
+
+    @Test
+    @Order(45)
+    void testDeleteFile() {
+        final FileManagePage page = new FileManagePage(browser);
+
+        page.delete(testRenameFileName);
+
+        await().untilAsserted(() -> {
+            browser.navigate().refresh();
+
+            assertThat(
+                page.fileList()
+            ).noneMatch(
+                it -> it.getText().contains(testRenameFileName)
+            );
+        });
+    }
+
+    @Test
+    @Order(60)
+    void testUploadOver1GBFile() {
+        final FileManagePage page = new FileManagePage(browser);
+
+        String command = String.format("fallocate -l 1.5G %s", testOver1GBFilePath);
+        try {
+            Process pro = Runtime.getRuntime().exec(command);
+            int status = pro.waitFor();
+            if (status != 0)
+            {
+                System.out.println("Failed to call shell's command ");
+            }
+        } catch (Exception e) {
+            throw new RuntimeException(e);
+        }
+
+        page.uploadFile(testOver1GBFilePath);
+
+        await().untilAsserted(() ->
+            assertThat(browser.findElement(By.tagName("body")).getText())
+                .contains("Upload File size cannot exceed 1g")
+        );
+    }
+
+    @Test
+    @Order(65)
+    void testUploadUnder1GBFile() {
+        final FileManagePage page = new FileManagePage(browser);
+
+        browser.navigate().refresh();
+
+        String command = String.format("fallocate -l 0.01G %s", testUnder1GBFilePath);

Review comment:
       Create a file smaller than 1GB by using Linux command ```fallocate```. So that we can test upload file. Same as testUploadOver1GBFile.




-- 
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: commits-unsubscribe@dolphinscheduler.apache.org

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