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:40:00 UTC

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

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



##########
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:
       Can you elaborate why we need this command?

##########
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);
+        try {
+            Process pro = Runtime.getRuntime().exec(command);
+            int status = pro.waitFor();
+            if (status != 0)
+            {

Review comment:
       Please keep the code styles consistent
   
   ```suggestion
               if (status != 0) {
   ```

##########
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 ");
+            }

Review comment:
       same here

##########
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);
+        try {
+            Process pro = Runtime.getRuntime().exec(command);
+            int status = pro.waitFor();
+            if (status != 0)
+            {
+                System.out.println("Failed to call shell's command ");

Review comment:
       Never call `System.out.println` in codes

##########
File path: dolphinscheduler-e2e/dolphinscheduler-e2e-case/src/test/java/org/apache/dolphinscheduler/e2e/cases/FileManageE2ETest.java
##########
@@ -38,6 +38,7 @@
 import static org.assertj.core.api.Assertions.assertThat;
 import static org.awaitility.Awaitility.await;
 
+

Review comment:
       Please pay attention to this code style: don't keep >1 consecutive blank lines




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