Skip to content

Commit

Permalink
add apiserver mulitiDB test
Browse files Browse the repository at this point in the history
  • Loading branch information
liuqiyuan committed Dec 11, 2023
1 parent a3b28bb commit 04baed9
Show file tree
Hide file tree
Showing 3 changed files with 43 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,8 @@ public RestfulOnlineExecutor(SQLCase sqlCase) {
protected HttpResult httpresult;
protected String deploy;
protected OpenMLDBInfo openMLDBInfo= YamlUtil.getObject(Tool.openMLDBDir().getAbsolutePath()+"/out/openmldb_info.yaml",OpenMLDBInfo.class);
String dbName = "test_apiserver";
protected String defaultDb = sqlCase.getDb();
String dbName = defaultDb.equals(null)?"test_apiserver":defaultDb;
String apiServerUrl;
OpenMLDBHttp openMLDBHttp = new OpenMLDBHttp();

Expand Down Expand Up @@ -92,7 +93,8 @@ public void prepare() {
for (int i=1;i<tables.size();i++){
for (int j=0;j<tables.get(i).getRows().size();j++){
String body = HttpUtil.formatInputs("value",tables.get(i),j,false);
uri = "/dbs/"+dbName+"/tables/"+tableNames.get(i);
String curDb = tables.get(i).getDb().length()>0? tables.get(i).getDb(): dbName;
uri = "/dbs/"+curDb+"/tables/"+tableNames.get(i);
OpenMLDBHttp openMLDBHttp = new OpenMLDBHttp();
openMLDBHttp.restfulJsonRequest(apiServerUrl,uri,body,HttpMethod.PUT);
}
Expand Down Expand Up @@ -122,7 +124,8 @@ public void execute(){
tmpResults.add(tmpResult);
} else {break;}
body = HttpUtil.formatInputs("value",tables.get(0),i,false);
uri = "/dbs/"+dbName+"/tables/"+tableNames.get(0);
String curDb = tables.get(0).getDb().length()>0? tables.get(0).getDb(): dbName;
uri = "/dbs/"+curDb+"/tables/"+tableNames.get(0);
openMLDBHttp.restfulJsonRequest(apiServerUrl,uri,body,HttpMethod.PUT);
}

Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
/*
* Copyright 2021 4Paradigm
*
* Licensed 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.
*/
package com._4paradigm.openmldb.http_test.tmp;

import com._4paradigm.openmldb.http_test.executor.RestfulOnlineExecutor;
import com._4paradigm.openmldb.test_common.provider.Yaml;
import io.qameta.allure.Feature;
import io.qameta.allure.Story;
import org.testng.annotations.Test;
import com._4paradigm.openmldb.test_common.common.BaseTest;
import com._4paradigm.openmldb.test_common.model.SQLCase;

@Feature("MultiDB api request")
public class TestMultiDB {
@Test(dataProvider = "getCase",dataProviderClass = BaseTest.class)
@Yaml(filePaths = "integration_test/multiple_databases/")
@Story("MultiDB api request")
public void testBatch(SQLCase sqlCase){
new RestfulOnlineExecutor(sqlCase).run();
}


}
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
<parameter name="fedbPath" value=""/>

<classes>
<!-- <class name="com._4paradigm.openmldb.http_test.tmp.TestTmp"/> -->
<class name="com._4paradigm.openmldb.http_test.tmp.TestMultiDB"/>
<class name="com._4paradigm.openmldb.http_test.tmp.TestExpression"/>
<class name="com._4paradigm.openmldb.http_test.tmp.TestCluster"/>
<class name="com._4paradigm.openmldb.http_test.tmp.TestFunction"/>
Expand Down

0 comments on commit 04baed9

Please sign in to comment.