Skip to content

Commit

Permalink
test: add case v040 (#2671)
Browse files Browse the repository at this point in the history
  • Loading branch information
wuyou10206 authored Oct 18, 2022
1 parent 08e520e commit 109d822
Show file tree
Hide file tree
Showing 116 changed files with 15,788 additions and 640 deletions.
3 changes: 3 additions & 0 deletions .github/ISSUE_TEMPLATE/bug_report.md
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,9 @@ assignees: aceforeverd
**Expected Behavior**


**Relation Case**



**Steps to Reproduce**

Expand Down
129 changes: 129 additions & 0 deletions .github/workflows/integration-test-src.yml
Original file line number Diff line number Diff line change
Expand Up @@ -106,6 +106,49 @@ jobs:
content_type: text/plain
attachments: allure-results.tar.gz

java-sdk-cluster-memory-task:
if: ${{ github.event.inputs.EXEC_TEST_TYPE == 'all' || github.event.inputs.EXEC_TEST_TYPE == 'java' }}
runs-on: ubuntu-latest
container:
image: ghcr.io/4paradigm/hybridsql:latest
env:
OS: linux
steps:
- uses: actions/checkout@v2
- name: build jsdk and package
run: |
make configure CMAKE_INSTALL_PREFIX=openmldb-linux
make SQL_JAVASDK_ENABLE=ON && make SQL_JAVASDK_ENABLE=ON install
tar -zcvf openmldb-linux.tar.gz openmldb-linux
echo "openmldb-pkg:"
ls -al
- name: test
run: source /root/.bashrc && bash test/steps/openmldb-sdk-test-java-src.sh -c test_out_in_cluster.xml -d cluster -l "0" -s "memory"
- name: TEST Results
if: always()
uses: EnricoMi/publish-unit-test-result-action@v1
with:
files: test/integration-test/openmldb-test-java/openmldb-sdk-test/target/surefire-reports/TEST-*.xml
check_name: "SRC java-sdk-cluster-memory-task Report"
comment_title: "SRC java-sdk-cluster-memory-task Report"
- name: tar test report
if: ${{ failure() }}
run: tar -zcvf allure-results.tar.gz test/integration-test/openmldb-test-java/openmldb-sdk-test/target/allure-results
- name: Send Email
if: ${{ failure() }}
uses: dawidd6/action-send-mail@master
with:
server_address: smtp.partner.outlook.cn
server_port: 587
username: ${{ secrets.MAIL_USERNAME }}
password: ${{ secrets.MAIL_PASSWORD }}
subject: OpenMLDB Memory Task Test
body: OpenMLDB Memory Task Test Failed
to: ${{ secrets.MAIL_TO }}
from: GitHub Actions
content_type: text/plain
attachments: allure-results.tar.gz

java-sdk-cluster-memory-1:
if: ${{ github.event.inputs.EXEC_TEST_TYPE == 'all' || github.event.inputs.EXEC_TEST_TYPE == 'java' }}
runs-on: ubuntu-latest
Expand Down Expand Up @@ -192,6 +235,49 @@ jobs:
content_type: text/plain
attachments: allure-results.tar.gz

# java-sdk-cluster-ssd-task:
# if: ${{ github.event.inputs.EXEC_TEST_TYPE == 'all' || github.event.inputs.EXEC_TEST_TYPE == 'java' }}
# runs-on: ubuntu-latest
# container:
# image: ghcr.io/4paradigm/hybridsql:latest
# env:
# OS: linux
# steps:
# - uses: actions/checkout@v2
# - name: build jsdk and package
# run: |
# make configure CMAKE_INSTALL_PREFIX=openmldb-linux
# make SQL_JAVASDK_ENABLE=ON && make SQL_JAVASDK_ENABLE=ON install
# tar -zcvf openmldb-linux.tar.gz openmldb-linux
# echo "openmldb-pkg:"
# ls -al
# - name: test
# run: source /root/.bashrc && bash test/steps/openmldb-sdk-test-java-src.sh -c test_out_in_cluster.xml -d cluster -l "0" -s "ssd"
# - name: TEST Results
# if: always()
# uses: EnricoMi/publish-unit-test-result-action@v1
# with:
# files: test/integration-test/openmldb-test-java/openmldb-sdk-test/target/surefire-reports/TEST-*.xml
# check_name: "SRC java-sdk-cluster-task-0 Report"
# comment_title: "SRC java-sdk-cluster-task-0 Report"
# - name: tar test report
# if: ${{ failure() }}
# run: tar -zcvf allure-results.tar.gz test/integration-test/openmldb-test-java/openmldb-sdk-test/target/allure-results
# - name: Send Email
# if: ${{ failure() }}
# uses: dawidd6/action-send-mail@master
# with:
# server_address: smtp.partner.outlook.cn
# server_port: 587
# username: ${{ secrets.MAIL_USERNAME }}
# password: ${{ secrets.MAIL_PASSWORD }}
# subject: OpenMLDB SSD Task Test
# body: OpenMLDB SSD Test Task Failed
# to: ${{ secrets.MAIL_TO }}
# from: GitHub Actions
# content_type: text/plain
# attachments: allure-results.tar.gz

java-sdk-cluster-hdd-0:
if: ${{ github.event.inputs.EXEC_TEST_TYPE == 'all' || github.event.inputs.EXEC_TEST_TYPE == 'java' }}
runs-on: ubuntu-latest
Expand Down Expand Up @@ -235,6 +321,49 @@ jobs:
content_type: text/plain
attachments: allure-results.tar.gz

# java-sdk-cluster-hdd-task:
# if: ${{ github.event.inputs.EXEC_TEST_TYPE == 'all' || github.event.inputs.EXEC_TEST_TYPE == 'java' }}
# runs-on: ubuntu-latest
# container:
# image: ghcr.io/4paradigm/hybridsql:latest
# env:
# OS: linux
# steps:
# - uses: actions/checkout@v2
# - name: build jsdk and package
# run: |
# make configure CMAKE_INSTALL_PREFIX=openmldb-linux
# make SQL_JAVASDK_ENABLE=ON && make SQL_JAVASDK_ENABLE=ON install
# tar -zcvf openmldb-linux.tar.gz openmldb-linux
# echo "openmldb-pkg:"
# ls -al
# - name: test
# run: source /root/.bashrc && bash test/steps/openmldb-sdk-test-java-src.sh -c test_out_in_cluster.xml -d cluster -l "0" -s "hdd"
# - name: TEST Results
# if: always()
# uses: EnricoMi/publish-unit-test-result-action@v1
# with:
# files: test/integration-test/openmldb-test-java/openmldb-sdk-test/target/surefire-reports/TEST-*.xml
# check_name: "SRC java-sdk-cluster-hdd-task Report"
# comment_title: "SRC java-sdk-cluster-hdd-task Report"
# - name: tar test report
# if: ${{ failure() }}
# run: tar -zcvf allure-results.tar.gz test/integration-test/openmldb-test-java/openmldb-sdk-test/target/allure-results
# - name: Send Email
# if: ${{ failure() }}
# uses: dawidd6/action-send-mail@master
# with:
# server_address: smtp.partner.outlook.cn
# server_port: 587
# username: ${{ secrets.MAIL_USERNAME }}
# password: ${{ secrets.MAIL_PASSWORD }}
# subject: OpenMLDB HDD Task Test
# body: OpenMLDB HDD Task Test Failed
# to: ${{ secrets.MAIL_TO }}
# from: GitHub Actions
# content_type: text/plain
# attachments: allure-results.tar.gz

# standalone-cli-test-0:
# if: ${{ github.event.inputs.EXEC_TEST_TYPE == 'all' || github.event.inputs.EXEC_TEST_TYPE == 'standalone-cli' || github.event.inputs.EXEC_TEST_TYPE == 'cli' }}
# runs-on: ubuntu-latest
Expand Down
10 changes: 10 additions & 0 deletions benchmark/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -49,6 +49,16 @@ xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xs
<artifactId>logback-classic</artifactId>
<version>1.2.8</version>
</dependency>
<dependency>
<groupId>net.sourceforge.javacsv</groupId>
<artifactId>javacsv</artifactId>
<version>2.0</version>
</dependency>
<dependency>
<groupId>org.apache.commons</groupId>
<artifactId>commons-lang3</artifactId>
<version>3.12.0</version>
</dependency>
</dependencies>

<build>
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,96 @@
/*
* 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.benchmark;

import com._4paradigm.openmldb.jdbc.CallablePreparedStatement;
import com._4paradigm.openmldb.sdk.SqlExecutor;
import org.openjdk.jmh.annotations.*;
import org.openjdk.jmh.runner.Runner;
import org.openjdk.jmh.runner.options.Options;
import org.openjdk.jmh.runner.options.OptionsBuilder;

import java.sql.ResultSet;
import java.sql.SQLException;
import java.util.*;
import java.util.concurrent.TimeUnit;

@BenchmarkMode({Mode.Throughput, Mode.SampleTime})
//@OutputTimeUnit(TimeUnit.MICROSECONDS)
@OutputTimeUnit(TimeUnit.SECONDS)
@State(Scope.Benchmark)
@Threads(10)
@Fork(value = 1, jvmArgs = {"-Xms8G", "-Xmx8G"})
@Warmup(iterations = 2)
@Measurement(iterations = 5, time = 60)

public class BenchmarkByBank {
private SqlExecutor executor;
private String database;
private String deployName;
private Random random = new Random();
private Map<String, TableSchema> tableSchema = new HashMap<>();


private List<List<String>> requestList;

public BenchmarkByBank() {
executor = BenchmarkConfig.GetSqlExecutor(false);
deployName = BenchmarkConfig.DEPLOY_NAME;
database = BenchmarkConfig.DATABASE;
}

@Setup
public void initEnv() {
requestList = CsvUtil.readCsvByCsvReader(BenchmarkConfig.CSV_PATH);
}

@TearDown
public void cleanEnv() {

}

@Benchmark
public void executeDeployment() {
List<String> values = requestList.get(random.nextInt(requestList.size()));
try(CallablePreparedStatement rps = executor.getCallablePreparedStmt(database, deployName)) {
Util.setRequestData(rps, values);
ResultSet resultSet = rps.executeQuery();
// resultSet.next();
// Map<String, String> val = Util.extractResultSet(resultSet);
// System.out.println("val = " + val);
} catch (SQLException e) {
e.printStackTrace();
}
}

public static void main(String[] args) {
/*OpenMLDBPerfBenchmark benchmark = new OpenMLDBPerfBenchmark();
benchmark.initEnv();
benchmark.executeDeployment();
benchmark.cleanEnv();*/

try {
Options opt = new OptionsBuilder()
.include(BenchmarkByBank.class.getSimpleName())
.forks(1)
.build();
new Runner(opt).run();
} catch (Exception e) {
e.printStackTrace();
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,7 @@ public class BenchmarkConfig {
public static int PK_BASE = 1000000;
public static long TS_BASE = 1652232079000l;
public static String DEPLOY_NAME;
public static String CSV_PATH;

private static SqlExecutor executor = null;
private static SdkOption option = null;
Expand All @@ -54,7 +55,10 @@ public class BenchmarkConfig {
JOIN_NUM = Integer.valueOf(prop.getProperty("JOIN_NUM"));
PK_NUM = Integer.valueOf(prop.getProperty("PK_NUM", "100000"));
PK_MAX = Integer.valueOf(prop.getProperty("PK_MAX", "0"));

CSV_PATH = prop.getProperty("CSV_PATH");
// if(!CSV_PATH.startsWith("/")){
// CSV_PATH=Util.getRootPath()+CSV_PATH;
// }
} catch (Exception e) {
e.printStackTrace();
}
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
package com._4paradigm.openmldb.benchmark;

import com.csvreader.CsvReader;

import java.io.*;
import java.nio.charset.Charset;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.List;

public class CsvUtil {
public static List<List<String>> readCsvByCsvReader(String filePath) {
List<List<String>> list = new ArrayList<>();
try {
CsvReader reader;
if (filePath.startsWith("/")) {
reader = new CsvReader(filePath, ',', Charset.forName("UTF-8"));
}else{
reader = new CsvReader(CsvUtil.class.getClassLoader().getResourceAsStream(filePath), ',', Charset.forName("UTF-8"));
}
reader.readHeaders();
while (reader.readRecord()) {
String[] values = reader.getValues();
List<String> dataList = Arrays.asList(values);
list.add(dataList); // 按行读取,并把每一行的数据添加到list集合
}
reader.close();
} catch (Exception e) {
e.printStackTrace();
}
return list;
}

public static void main(String[] args) {
List<List<String>> lists = readCsvByCsvReader("/Users/zhaowei/code/4paradigm/OpenMLDB/benchmark/src/main/resources/data/bank_flattenRequest.csv");
System.out.println("lists.size() = " + lists.size());
lists.stream().limit(10).forEach(l-> System.out.println(l));
}
}
Loading

0 comments on commit 109d822

Please sign in to comment.