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

hellostephen 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 fc38d1f0c65 [feature](regression-plugin) support version compare 
plugin with cloud (#56850)
fc38d1f0c65 is described below

commit fc38d1f0c656f02e378507800971f1b90737433e
Author: shuke <[email protected]>
AuthorDate: Tue Oct 14 11:18:47 2025 +0800

    [feature](regression-plugin) support version compare plugin with cloud 
(#56850)
---
 .../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