From 2021aedf7beb0cf24d5732db43217b3a0f42c7de Mon Sep 17 00:00:00 2001 From: Dongyang Li Date: Wed, 26 Jun 2024 15:09:26 +0800 Subject: [PATCH] [case](udf) Only one backend, skip scp udf file (#36810) ## Proposed changes [case](udf) Only one backend, skip scp udf file (#36810) Co-authored-by: stephen --- .../apache/doris/regression/suite/Suite.groovy | 15 +++++++++++---- 1 file changed, 11 insertions(+), 4 deletions(-) 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 7e746248e7ae25..f23a4d16103d4a 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 @@ -867,7 +867,7 @@ class Suite implements GroovyInterceptable { Assert.assertEquals(0, code) } - void sshExec(String username, String host, String cmd) { + void sshExec(String username, String host, String cmd, boolean alert=true) { String command = "ssh ${username}@${host} '${cmd}'" def cmds = ["/bin/bash", "-c", command] logger.info("Execute: ${cmds}".toString()) @@ -875,8 +875,10 @@ class Suite implements GroovyInterceptable { def errMsg = new StringBuilder() def msg = new StringBuilder() p.waitForProcessOutput(msg, errMsg) - assert errMsg.length() == 0: "error occurred!" + errMsg - assert p.exitValue() == 0 + if (alert) { + assert errMsg.length() == 0: "error occurred!\n" + errMsg + assert p.exitValue() == 0 + } } List getFrontendIpHttpPort() { @@ -1789,10 +1791,15 @@ class Suite implements GroovyInterceptable { def backendId_to_backendIP = [:] def backendId_to_backendHttpPort = [:] getBackendIpHttpPort(backendId_to_backendIP, backendId_to_backendHttpPort) + if(backendId_to_backendIP.size() == 1) { + logger.info("Only one backend, skip scp udf file") + return + } def udf_file_dir = new File(udf_file_path).parent backendId_to_backendIP.values().each { be_ip -> - sshExec ("root", be_ip, "ssh -o StrictHostKeyChecking=no root@${be_ip} \"mkdir -p ${udf_file_dir}\"") + sshExec("root", be_ip, "ssh-keygen -f '/root/.ssh/known_hosts' -R \"${be_ip}\"", false) + sshExec("root", be_ip, "ssh -o StrictHostKeyChecking=no root@${be_ip} \"mkdir -p ${udf_file_dir}\"", false) scpFiles("root", be_ip, udf_file_path, udf_file_path, false) } }