提交 65afb63a 编写于 作者: J Jin Hai 提交者: GitHub

Merge pull request #29 from del-zhenwu/0.5.0

Update README.md #27

Former-commit-id: 7b877d6a97831a209ff9315a47273fcc49511d55
# Requirements
- jdk-1.8
- testng
# How to use this Test Project
1. package and install
```shell
mvn clean install
```
2. start or deploy your milvus server
3. run tests
```shell
java -cp \"target/MilvusSDkJavaTest-1.0-SNAPSHOT.jar:lib/*\" com.MainClass -h 127.0.0.1
```
4. get test report
```shell
firefox test-output/index.html
```
# Contribution getting started
Add test cases under testng framework
\ No newline at end of file
......@@ -99,7 +99,7 @@
<dependency>
<groupId>io.milvus</groupId>
<artifactId>milvus-sdk-java</artifactId>
<version>0.1.1-SNAPSHOT</version>
<version>0.1.2-SNAPSHOT</version>
</dependency>
<!-- <dependency>-->
......@@ -134,4 +134,4 @@
</dependencies>
</project>
\ No newline at end of file
</project>
......@@ -33,7 +33,7 @@ public class MainClass {
}
@DataProvider(name="ConnectInstance")
public Object[][] connectInstance(){
public Object[][] connectInstance() throws ConnectFailedException {
MilvusClient client = new MilvusGrpcClient();
ConnectParam connectParam = new ConnectParam.Builder()
.withHost(host)
......@@ -45,7 +45,7 @@ public class MainClass {
}
@DataProvider(name="DisConnectInstance")
public Object[][] disConnectInstance(){
public Object[][] disConnectInstance() throws ConnectFailedException {
// Generate connection instance
MilvusClient client = new MilvusGrpcClient();
ConnectParam connectParam = new ConnectParam.Builder()
......@@ -63,7 +63,7 @@ public class MainClass {
}
@DataProvider(name="Table")
public Object[][] provideTable(){
public Object[][] provideTable() throws ConnectFailedException {
Object[][] tables = new Object[2][2];
MetricType metricTypes[] = { MetricType.L2, MetricType.IP };
for (Integer i = 0; i < metricTypes.length; ++i) {
......
package com;
import io.milvus.client.ConnectParam;
import io.milvus.client.MilvusClient;
import io.milvus.client.MilvusGrpcClient;
import io.milvus.client.Response;
import io.milvus.client.*;
import org.testng.Assert;
import org.testng.annotations.DataProvider;
import org.testng.annotations.Test;
public class TestConnect {
@Test(dataProvider = "DefaultConnectArgs", dataProviderClass = MainClass.class)
public void test_connect(String host, String port){
public void test_connect(String host, String port) throws ConnectFailedException {
System.out.println("Host: "+host+", Port: "+port);
MilvusClient client = new MilvusGrpcClient();
ConnectParam connectParam = new ConnectParam.Builder()
......@@ -18,31 +16,42 @@ public class TestConnect {
.build();
Response res = client.connect(connectParam);
assert(res.ok());
assert(client.connected());
assert(client.isConnected());
}
@Test(dataProvider = "DefaultConnectArgs", dataProviderClass = MainClass.class)
public void test_connect_repeat(String host, String port){
public void test_connect_repeat(String host, String port) {
MilvusGrpcClient client = new MilvusGrpcClient();
ConnectParam connectParam = new ConnectParam.Builder()
.withHost(host)
.withPort(port)
.build();
client.connect(connectParam);
Response res = client.connect(connectParam);
assert(!res.ok());
assert(client.connected());
Response res = null;
try {
res = client.connect(connectParam);
res = client.connect(connectParam);
} catch (ConnectFailedException e) {
e.printStackTrace();
}
assert (res.ok());
assert(client.isConnected());
}
@Test(dataProvider="InvalidConnectArgs")
public void test_connect_invalid_connect_args(String ip, String port) throws InterruptedException {
public void test_connect_invalid_connect_args(String ip, String port) {
MilvusClient client = new MilvusGrpcClient();
ConnectParam connectParam = new ConnectParam.Builder()
.withHost(ip)
.withPort(port)
.build();
client.connect(connectParam);
assert(!client.connected());
Response res = null;
try {
res = client.connect(connectParam);
} catch (ConnectFailedException e) {
e.printStackTrace();
}
Assert.assertEquals(res, null);
assert(!client.isConnected());
}
// TODO: MS-615
......@@ -63,18 +72,18 @@ public class TestConnect {
@Test(dataProvider = "DisConnectInstance", dataProviderClass = MainClass.class)
public void test_disconnect(MilvusClient client, String tableName){
assert(!client.connected());
assert(!client.isConnected());
}
@Test(dataProvider = "DisConnectInstance", dataProviderClass = MainClass.class)
public void test_disconnect_repeatably(MilvusClient client, String tableNam){
public void test_disconnect_repeatably(MilvusClient client, String tableName){
Response res = null;
try {
res = client.disconnect();
} catch (InterruptedException e) {
e.printStackTrace();
}
assert(res.ok());
assert(!client.connected());
assert(!res.ok());
assert(!client.isConnected());
}
}
......@@ -140,7 +140,7 @@ public class TestIndex {
@Test(dataProvider = "Table", dataProviderClass = MainClass.class)
public void test_create_index_IVFSQ8H(MilvusClient client, String tableName) throws InterruptedException {
IndexType indexType = IndexType.IVF_SQ8_H;
IndexType indexType = IndexType.IVF_SQ8H;
List<List<Float>> vectors = gen_vectors(nb);
InsertParam insertParam = new InsertParam.Builder(tableName, vectors).build();
client.insert(insertParam);
......
......@@ -71,7 +71,7 @@ public class TestMix {
}
@Test(dataProvider = "DefaultConnectArgs", dataProviderClass = MainClass.class)
public void test_connect_threads(String host, String port) throws InterruptedException {
public void test_connect_threads(String host, String port) throws ConnectFailedException {
int thread_num = 100;
ForkJoinPool executor = new ForkJoinPool();
for (int i = 0; i < thread_num; i++) {
......@@ -82,8 +82,12 @@ public class TestMix {
.withHost(host)
.withPort(port)
.build();
client.connect(connectParam);
assert(client.connected());
try {
client.connect(connectParam);
} catch (ConnectFailedException e) {
e.printStackTrace();
}
assert(client.isConnected());
try {
client.disconnect();
} catch (InterruptedException e) {
......@@ -182,7 +186,7 @@ public class TestMix {
}
@Test(dataProvider = "DefaultConnectArgs", dataProviderClass = MainClass.class)
public void test_create_insert_delete_threads(String host, String port) throws InterruptedException {
public void test_create_insert_delete_threads(String host, String port) {
int thread_num = 100;
List<List<Float>> vectors = gen_vectors(nb,false);
ForkJoinPool executor = new ForkJoinPool();
......@@ -194,7 +198,12 @@ public class TestMix {
.withHost(host)
.withPort(port)
.build();
client.connect(connectParam);
try {
client.connect(connectParam);
} catch (ConnectFailedException e) {
e.printStackTrace();
}
assert(client.isConnected());
String tableName = RandomStringUtils.randomAlphabetic(10);
TableSchema tableSchema = new TableSchema.Builder(tableName, dimension)
.withIndexFileSize(index_file_size)
......
package com;
import io.milvus.client.ConnectParam;
import io.milvus.client.MilvusClient;
import io.milvus.client.MilvusGrpcClient;
import io.milvus.client.Response;
import io.milvus.client.*;
import org.testng.annotations.Test;
public class TestPing {
@Test(dataProvider = "DefaultConnectArgs", dataProviderClass = MainClass.class)
public void test_server_status(String host, String port){
public void test_server_status(String host, String port) throws ConnectFailedException {
System.out.println("Host: "+host+", Port: "+port);
MilvusClient client = new MilvusGrpcClient();
ConnectParam connectParam = new ConnectParam.Builder()
......@@ -16,13 +13,13 @@ public class TestPing {
.withPort(port)
.build();
client.connect(connectParam);
Response res = client.serverStatus();
Response res = client.getServerStatus();
assert (res.ok());
}
@Test(dataProvider = "DisConnectInstance", dataProviderClass = MainClass.class)
public void test_server_status_without_connected(MilvusGrpcClient client, String tableName){
Response res = client.serverStatus();
Response res = client.getServerStatus();
assert (!res.ok());
}
}
\ No newline at end of file
# Requirements
- python 3.6+
- pip install -r requirements.txt
# How to use this Test Project
This project is used to test search accuracy based on the given datasets (https://github.com/erikbern/ann-benchmarks#data-sets)
1. start your milvus server
2. update your test configuration in test.py
3. run command
```shell
python test.py
```
# Contribution getting started
- Follow PEP-8 for naming and black for formatting.
numpy==1.16.3
pymilvus>=0.2.0
scikit-learn==0.19.1
h5py==2.7.1
# Quick start
# Requirements
## 运行
- python 3.6+
- pip install -r requirements.txt
### 运行示例:
# How to use this Test Project
`python3 main.py --image=registry.zilliz.com/milvus/engine:branch-0.3.1-release --run-count=2 --run-type=performance`
This project is used to test performance / accuracy / stability of milvus server
### 运行参数:
1. update your test configuration in suites_*.yaml
2. run command
--image: 容器模式,传入镜像名称,如传入,则运行测试时,会先进行pull image,基于image生成milvus server容器
```shell
### docker mode:
python main.py --image=milvusdb/milvus:latest --run-count=2 --run-type=performance
--local: 与image参数互斥,本地模式,连接使用本地启动的milvus server进行测试
### local mode:
python main.py --local --run-count=2 --run-type=performance --ip=127.0.0.1 --port=19530
```
--run-count: 重复运行次数
# Contribution getting started
--suites: 测试集配置文件,默认使用suites.yaml
--run-type: 测试类型,包括性能--performance、准确性测试--accuracy以及稳定性--stability
### 测试集配置文件:
`operations:
insert:
​ [
​ {"table.index_type": "ivf_flat", "server.index_building_threshold": 300, "table.size": 2000000, "table.ni": 100000, "table.dim": 512},
​ ]
build: []
query:
​ [
​ {"dataset": "ip_ivfsq8_1000", "top_ks": [10], "nqs": [10, 100], "server.nprobe": 1, "server.use_blas_threshold": 800},
​ {"dataset": "ip_ivfsq8_1000", "top_ks": [10], "nqs": [10, 100], "server.nprobe": 10, "server.use_blas_threshold": 20},
​ ]`
## 测试结果:
性能:
`INFO:milvus_benchmark.runner:Start warm query, query params: top-k: 1, nq: 1
INFO:milvus_benchmark.client:query run in 19.19s
INFO:milvus_benchmark.runner:Start query, query params: top-k: 64, nq: 10, actually length of vectors: 10
INFO:milvus_benchmark.runner:Start run query, run 1 of 1
INFO:milvus_benchmark.client:query run in 0.2s
INFO:milvus_benchmark.runner:Avarage query time: 0.20
INFO:milvus_benchmark.runner:[[0.2]]`
**│ 10 │ 0.2 │**
准确率:
`INFO:milvus_benchmark.runner:Avarage accuracy: 1.0`
\ No newline at end of file
- Follow PEP-8 for naming and black for formatting.
\ No newline at end of file
# Requirements
* python 3.6.8
* python 3.6.8+
* pip install -r requirements.txt
# How to use this Test Project
```shell
pytest . -q -v
```
pytest . --level=1
```
or test connect function only
```shell
pytest test_connect.py --level=1
```
with allure test report
```shell
pytest --alluredir=test_out . -q -v
allure serve test_out
```
# Contribution getting started
* Follow PEP-8 for naming and black for formatting.
\ No newline at end of file
* Follow PEP-8 for naming and black for formatting.
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册