This is an automated email from the ASF dual-hosted git repository.

yiguolei pushed a commit to branch branch-4.0
in repository https://gitbox.apache.org/repos/asf/doris.git


The following commit(s) were added to refs/heads/branch-4.0 by this push:
     new 7ce3d6a63b1 branch-4.0: [feature](regression-plugin) support version 
compare plugin with cloud #56850 (#58244)
7ce3d6a63b1 is described below

commit 7ce3d6a63b1fe24445172c7b925b25f852ae61c5
Author: github-actions[bot] 
<41898282+github-actions[bot]@users.noreply.github.com>
AuthorDate: Sat Nov 22 11:05:38 2025 +0800

    branch-4.0: [feature](regression-plugin) support version compare plugin 
with cloud #56850 (#58244)
    
    Cherry-picked from #56850
    
    Co-authored-by: shuke <[email protected]>
---
 .../plugins/plugin_cluster_version.groovy          | 46 +++++++++++-----------
 1 file changed, 24 insertions(+), 22 deletions(-)

diff --git a/regression-test/plugins/plugin_cluster_version.groovy 
b/regression-test/plugins/plugin_cluster_version.groovy
index 499015e05c8..dd58a2a52c2 100644
--- a/regression-test/plugins/plugin_cluster_version.groovy
+++ b/regression-test/plugins/plugin_cluster_version.groovy
@@ -18,37 +18,39 @@
 import org.apache.doris.regression.suite.Suite
 
 Suite.metaClass.is_cluster_newer_than = { int mainVersion, int midVersion, int 
thirdVersion ->
-    def version = get_cluster_version()
-    def versionParts = version.split(/\./)[0..2].collect { it.toInteger() }
+    def result = sql_return_maparray "show frontends"
+    def version = result[0]["Version"]
+    // doris-0.0.0-354efae
+    def pattern = /-(\d+\.\d+\.\d+(?:\.\d+)?)-/
+    def matcher = (version =~ pattern) 
+    if (matcher.find() == false) {
+        throw new IllegalArgumentException("invalid version string: 
${version}")
+    }
+
+    def versionParts = matcher.group(1).split("\\.")*.toInteger()
+    if (versionParts.size() < 3) {
+        throw new IllegalArgumentException("invalid version string: 
${version}")
+    }
+    if (version.toLowerCase().contains("cloud") && versionParts[0] > 0) {
+        versionParts[0] -= 1
+    } 
+
     if ( versionParts[0] == 0 ) {
         // trunk
         return true
-    } 
-    
-    if (mainVersion > versionParts[0]) {
+    }
+
+    if (versionParts[0] > mainVersion) {
         return true
-    } else if (mainVersion < versionParts[0]) {
+    } else if (versionParts[0] < mainVersion) {
         return false
     }
 
-    if (midVersion > versionParts[1]) {
+    if (versionParts[1] > midVersion) {
         return true
-    } else if (midVersion < versionParts[1]) {
+    } else if (versionParts[1] < midVersion) {
         return false
     }
 
-    return thirdVersion >= versionParts[2]
-}
-
-Suite.metaClass.get_cluster_version = {
-    def result = sql_return_maparray "show frontends"
-    def version = result["Version"]
-    // doris-0.0.0-354efae
-    def pattern = /-(\d+\.\d+\.\d+(?:\.\d+)?)-/
-    def matcher = (version =~ pattern) 
-    if (matcher.find()) {
-        return matcher.group(1)
-    } else {
-        throw new IllegalArgumentException("invalid version string: 
${version}")
-    }
+    return versionParts[2] >= thirdVersion
 }


---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to