| // Licensed to the Apache Software Foundation (ASF) under one |
| // or more contributor license agreements. See the NOTICE file |
| // distributed with this work for additional information |
| // regarding copyright ownership. The ASF licenses this file |
| // to you under the Apache License, Version 2.0 (the |
| // "License"); you may not use this file except in compliance |
| // with the License. You may obtain a copy of the License at |
| // |
| // http://www.apache.org/licenses/LICENSE-2.0 |
| // |
| // Unless required by applicable law or agreed to in writing, |
| // software distributed under the License is distributed on an |
| // "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY |
| // KIND, either express or implied. See the License for the |
| // specific language governing permissions and limitations |
| // under the License. |
| |
| import org.codehaus.groovy.runtime.IOGroovyMethods |
| |
| suite("load") { |
| sql """ set global enable_auto_analyze = false; """ |
| |
| def table = "customer" |
| |
| def token = context.config.metaServiceToken; |
| def instance_id = context.config.multiClusterInstance |
| |
| List<String> ipList = new ArrayList<>(); |
| List<String> hbPortList = new ArrayList<>() |
| List<String> httpPortList = new ArrayList<>() |
| List<String> brpcPortList = new ArrayList<>() |
| List<String> beUniqueIdList = new ArrayList<>() |
| |
| String[] bes = context.config.multiClusterBes.split(','); |
| println("the value is " + context.config.multiClusterBes); |
| int num = 0 |
| for(String values : bes) { |
| if (num++ == 2) break; |
| println("the value is " + values); |
| String[] beInfo = values.split(':'); |
| ipList.add(beInfo[0]); |
| hbPortList.add(beInfo[1]); |
| httpPortList.add(beInfo[2]); |
| beUniqueIdList.add(beInfo[3]); |
| brpcPortList.add(beInfo[4]); |
| } |
| |
| println("the ip is " + ipList); |
| println("the heartbeat port is " + hbPortList); |
| println("the http port is " + httpPortList); |
| println("the be unique id is " + beUniqueIdList); |
| println("the brpc port is " + brpcPortList); |
| |
| for (unique_id : beUniqueIdList) { |
| def resp = get_cluster.call(unique_id); |
| for (cluster : resp) { |
| if (cluster.type == "COMPUTE") { |
| drop_cluster.call(cluster.cluster_name, cluster.cluster_id); |
| } |
| } |
| } |
| sleep(20000) |
| |
| List<List<Object>> result = sql "show clusters" |
| assertEquals(result.size(), 0); |
| |
| add_cluster.call(beUniqueIdList[0], ipList[0], hbPortList[0], |
| "regression_cluster_name0", "regression_cluster_id0"); |
| add_cluster.call(beUniqueIdList[1], ipList[1], hbPortList[1], |
| "regression_cluster_name1", "regression_cluster_id1"); |
| sleep(20000) |
| |
| def new_res = sql "show clusters" |
| sql """ SET PROPERTY 'default_cloud_cluster' = "regression_cluster_name0"; """ |
| assertEquals(new_res.size(), 2); |
| sql """ set global enable_auto_analyze = false; """ |
| sql """ drop table if exists __internal_schema.column_statistics; """ |
| sql """ drop table if exists __internal_schema.histogram_statistics; """ |
| } |