From 7604401b06d90df988a4c9c623cb606fc595dc00 Mon Sep 17 00:00:00 2001 From: zhangguoqiang <18372634969@163.com> Date: Fri, 29 Dec 2023 17:59:20 +0800 Subject: [PATCH] [Enhance](regression)Do path creation ahead of time for case test_export_external_table (#28616) Do path creation ahead of time for case test_export_external_table --- .../org/apache/doris/regression/suite/Suite.groovy | 8 ++++++++ .../export/test_export_external_table.groovy | 10 ++++++++++ 2 files changed, 18 insertions(+) diff --git a/regression-test/framework/src/main/groovy/org/apache/doris/regression/suite/Suite.groovy b/regression-test/framework/src/main/groovy/org/apache/doris/regression/suite/Suite.groovy index a299f0a01d..942f44f8d8 100644 --- a/regression-test/framework/src/main/groovy/org/apache/doris/regression/suite/Suite.groovy +++ b/regression-test/framework/src/main/groovy/org/apache/doris/regression/suite/Suite.groovy @@ -575,6 +575,14 @@ class Suite implements GroovyInterceptable { Assert.assertEquals(0, code) } + void mkdirRemote(String username, String host, String path) { + String cmd = "ssh ${username}@${host} 'mkdir -p ${path}'" + logger.info("Execute: ${cmd}".toString()) + Process process = cmd.execute() + def code = process.waitFor() + Assert.assertEquals(0, code) + } + void sshExec(String username, String host, String cmd) { String command = "ssh ${username}@${host} '${cmd}'" def cmds = ["/bin/bash", "-c", command] diff --git a/regression-test/suites/external_table_p0/export/test_export_external_table.groovy b/regression-test/suites/external_table_p0/export/test_export_external_table.groovy index 48cfb9e83e..69b29b14e2 100644 --- a/regression-test/suites/external_table_p0/export/test_export_external_table.groovy +++ b/regression-test/suites/external_table_p0/export/test_export_external_table.groovy @@ -55,12 +55,22 @@ suite("test_export_external_table", "p0,external,mysql,external_docker,external_ } def check_path_exists = { dir_path -> + List> backends = sql """ show backends """ + assertTrue(backends.size() > 0) File path = new File(dir_path) if (!path.exists()) { assert path.mkdirs() } else { throw new IllegalStateException("""${dir_path} already exists! """) } + if (backends.size() > 1) { + for (List backend : backends) { + def be_host = backend[1] + def cmd="""mkdir -p ${dir_path}""" + sshExec("root", be_host, cmd.toString()) + } + } + } def check_file_amounts = { dir_path, amount -> File path = new File(dir_path)