This is an automated email from the ASF dual-hosted git repository.
yiguolei pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/doris.git
The following commit(s) were added to refs/heads/master by this push:
new 467e48053b [FIX](regresstest) fix regress test for export with scp
files (#23417)
467e48053b is described below
commit 467e48053beed59be569280000c0a34c63fdf3ae
Author: amory <[email protected]>
AuthorDate: Fri Aug 25 09:22:34 2023 +0800
[FIX](regresstest) fix regress test for export with scp files (#23417)
* fix regress test for export with scp
* fix outfile and outputfilepath
---
.../suites/export/test_array_export.groovy | 27 +++++++++++++++-------
.../suites/export/test_map_export.groovy | 22 +++++++++++++-----
.../suites/export/test_struct_export.groovy | 23 +++++++++++++-----
3 files changed, 52 insertions(+), 20 deletions(-)
diff --git a/regression-test/suites/export/test_array_export.groovy
b/regression-test/suites/export/test_array_export.groovy
index af17ab32fb..1ee097cefb 100644
--- a/regression-test/suites/export/test_array_export.groovy
+++ b/regression-test/suites/export/test_array_export.groovy
@@ -52,10 +52,15 @@ suite("test_array_export", "export") {
// define the table and out file path
def tableName = "array_outfile_test"
def outFilePath = """${context.file.parent}/test_array_export"""
- def outFile = "/tmp"
+ List<List<Object>> backends = sql """ show backends """
+ assertTrue(backends.size() > 0)
+ def outFile = outFilePath
+ if (backends.size() > 1) {
+ outFile = "/tmp"
+ }
def urlHost = ""
def csvFiles = ""
- logger.warn("test_array_export the outFilePath=" + outFilePath)
+ logger.warn("test_array_export the outFile=" + outFile)
def create_test_table = {testTablex ->
sql """ DROP TABLE IF EXISTS ${tableName} """
@@ -171,10 +176,14 @@ suite("test_array_export", "export") {
"""
url = result[0][3]
urlHost = url.substring(8, url.indexOf("${outFile}"))
- def filePrifix = url.split("${outFile}")[1]
- csvFiles = "${outFile}${filePrifix}*.csv"
- scpFiles ("root", urlHost, csvFiles, outFilePath);
+ if (backends.size() > 1) {
+ // custer will scp files
+ def filePrifix = url.split("${outFile}")[1]
+ csvFiles = "${outFile}${filePrifix}*.csv"
+ scpFiles ("root", urlHost, csvFiles, outFilePath)
+ }
+ // path is from outputfilepath
File[] files = path.listFiles()
assert files.length == 1
List<String> outLines =
Files.readAllLines(Paths.get(files[0].getAbsolutePath()),
StandardCharsets.UTF_8);
@@ -193,8 +202,10 @@ suite("test_array_export", "export") {
}
path.delete();
}
- cmd = "rm -rf ${csvFiles}"
- sshExec ("root", urlHost, cmd)
+ if (csvFiles != "") {
+ cmd = "rm -rf ${csvFiles}"
+ sshExec("root", urlHost, cmd)
+ }
}
@@ -235,4 +246,4 @@ suite("test_array_export", "export") {
try_sql("DROP TABLE IF EXISTS ${tableName}")
}
}
-}
\ No newline at end of file
+}
diff --git a/regression-test/suites/export/test_map_export.groovy
b/regression-test/suites/export/test_map_export.groovy
index c2bcb4661a..ba371fb3a1 100644
--- a/regression-test/suites/export/test_map_export.groovy
+++ b/regression-test/suites/export/test_map_export.groovy
@@ -78,7 +78,12 @@ suite("test_map_export", "export") {
qt_select_count """SELECT COUNT(m) FROM ${testTable}"""
def outFilePath = """${context.file.parent}/test_map_export"""
- def outFile = "/tmp"
+ List<List<Object>> backends = sql """ show backends """
+ assertTrue(backends.size() > 0)
+ def outFile = outFilePath
+ if (backends.size() > 1) {
+ outFile = "/tmp"
+ }
def urlHost = ""
def csvFiles = ""
logger.info("test_map_export the outFilePath=" + outFilePath)
@@ -95,9 +100,12 @@ suite("test_map_export", "export") {
"""
url = result[0][3]
urlHost = url.substring(8, url.indexOf("${outFile}"))
- def filePrifix = url.split("${outFile}")[1]
- csvFiles = "${outFile}${filePrifix}*.csv"
- scpFiles ("root", urlHost, csvFiles, outFilePath);
+ if (backends.size() > 1) {
+ // custer will scp files
+ def filePrifix = url.split("${outFile}")[1]
+ csvFiles = "${outFile}${filePrifix}*.csv"
+ scpFiles ("root", urlHost, csvFiles, outFilePath)
+ }
File[] files = path.listFiles()
assert files.length == 1
@@ -137,7 +145,9 @@ suite("test_map_export", "export") {
}
path.delete();
}
- cmd = "rm -rf ${csvFiles}"
- sshExec ("root", urlHost, cmd)
+ if (csvFiles != "") {
+ cmd = "rm -rf ${csvFiles}"
+ sshExec("root", urlHost, cmd)
+ }
}
}
diff --git a/regression-test/suites/export/test_struct_export.groovy
b/regression-test/suites/export/test_struct_export.groovy
index e709bd7254..18ef26b834 100644
--- a/regression-test/suites/export/test_struct_export.groovy
+++ b/regression-test/suites/export/test_struct_export.groovy
@@ -80,7 +80,12 @@ suite("test_struct_export", "export") {
qt_select_count """SELECT COUNT(k2), COUNT(k4) FROM ${testTable}"""
def outFilePath = """${context.file.parent}/test_struct_export"""
- def outFile = "/tmp"
+ List<List<Object>> backends = sql """ show backends """
+ assertTrue(backends.size() > 0)
+ def outFile = outFilePath
+ if (backends.size() > 1) {
+ outFile = "/tmp"
+ }
def urlHost = ""
def csvFiles = ""
logger.info("test_struct_export the outFilePath=" + outFilePath)
@@ -97,9 +102,13 @@ suite("test_struct_export", "export") {
"""
url = result[0][3]
urlHost = url.substring(8, url.indexOf("${outFile}"))
- def filePrifix = url.split("${outFile}")[1]
- csvFiles = "${outFile}${filePrifix}*.csv"
- scpFiles ("root", urlHost, csvFiles, outFilePath);
+ if (backends.size() > 1) {
+ // custer will scp files
+ def filePrifix = url.split("${outFile}")[1]
+ csvFiles = "${outFile}${filePrifix}*.csv"
+ scpFiles ("root", urlHost, csvFiles, outFilePath)
+ }
+
File[] files = path.listFiles()
assert files.length == 1
@@ -140,7 +149,9 @@ suite("test_struct_export", "export") {
}
path.delete();
}
- cmd = "rm -rf ${csvFiles}"
- sshExec ("root", urlHost, cmd)
+ if (csvFiles != "") {
+ cmd = "rm -rf ${csvFiles}"
+ sshExec("root", urlHost, cmd)
+ }
}
}
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]