SbloodyS commented on a change in pull request #8160:
URL: https://github.com/apache/dolphinscheduler/pull/8160#discussion_r790371913
##########
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 not a good idea to me. Bear in mind that not all systems running
our E2E tests are Linux system, at least mine is MacOS and there is no
`fallocate` command, I know many developers are using MacOS in DolphinScheduler
and please don't narrow down the supported systems to only Linux.
>
> We are writing Java codes so why not just use the same language to do the
things?
>
> ```java
> RandomAccessFile f = new RandomAccessFile("/tmp/file_size_1.5GB",
"rw");
> f.setLength((int) (1.5 * 1024 * 1024 * 1024));
> ```
I didn't think of these problems. I'll fix it. Thanks.
--
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]