Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Update README.md #27 #29

Merged
merged 1 commit into from
Oct 17, 2019
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
29 changes: 29 additions & 0 deletions tests/milvus-java-test/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
# 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
4 changes: 2 additions & 2 deletions tests/milvus-java-test/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -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>-->
Expand Down Expand Up @@ -134,4 +134,4 @@

</dependencies>

</project>
</project>
6 changes: 3 additions & 3 deletions tests/milvus-java-test/src/main/java/com/MainClass.java
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ public static Object[][] defaultConnectArgs(){
}

@DataProvider(name="ConnectInstance")
public Object[][] connectInstance(){
public Object[][] connectInstance() throws ConnectFailedException {
MilvusClient client = new MilvusGrpcClient();
ConnectParam connectParam = new ConnectParam.Builder()
.withHost(host)
Expand All @@ -45,7 +45,7 @@ public Object[][] connectInstance(){
}

@DataProvider(name="DisConnectInstance")
public Object[][] disConnectInstance(){
public Object[][] disConnectInstance() throws ConnectFailedException {
// Generate connection instance
MilvusClient client = new MilvusGrpcClient();
ConnectParam connectParam = new ConnectParam.Builder()
Expand All @@ -63,7 +63,7 @@ public Object[][] disConnectInstance(){
}

@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) {
Expand Down
45 changes: 27 additions & 18 deletions tests/milvus-java-test/src/main/java/com/TestConnect.java
Original file line number Diff line number Diff line change
@@ -1,15 +1,13 @@
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()
Expand All @@ -18,31 +16,42 @@ public void test_connect(String host, String port){
.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
Expand All @@ -63,18 +72,18 @@ public Object[][] generate_invalid_connect_args() {

@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());
}
}
2 changes: 1 addition & 1 deletion tests/milvus-java-test/src/main/java/com/TestIndex.java
Original file line number Diff line number Diff line change
Expand Up @@ -140,7 +140,7 @@ public void test_create_index_IVFSQ8(MilvusClient client, String tableName) thro

@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);
Expand Down
19 changes: 14 additions & 5 deletions tests/milvus-java-test/src/main/java/com/TestMix.java
Original file line number Diff line number Diff line change
Expand Up @@ -71,7 +71,7 @@ public void test_search_vectors_threads(MilvusClient client, String tableName) t
}

@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++) {
Expand All @@ -82,8 +82,12 @@ public void test_connect_threads(String host, String port) throws InterruptedExc
.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) {
Expand Down Expand Up @@ -182,7 +186,7 @@ public void test_add_search_vectors_threads(MilvusClient client, String tableNam
}

@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();
Expand All @@ -194,7 +198,12 @@ public void test_create_insert_delete_threads(String host, String port) throws I
.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)
Expand Down
11 changes: 4 additions & 7 deletions tests/milvus-java-test/src/main/java/com/TestPing.java
Original file line number Diff line number Diff line change
@@ -1,28 +1,25 @@
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()
.withHost(host)
.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());
}
}
21 changes: 21 additions & 0 deletions tests/milvus_ann_acc/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
# 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.

4 changes: 4 additions & 0 deletions tests/milvus_ann_acc/requirements.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
numpy==1.16.3
pymilvus>=0.2.0
scikit-learn==0.19.1
h5py==2.7.1
64 changes: 15 additions & 49 deletions tests/milvus_benchmark/README.md
Original file line number Diff line number Diff line change
@@ -1,57 +1,23 @@
# 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`
- Follow PEP-8 for naming and black for formatting.
17 changes: 13 additions & 4 deletions tests/milvus_python_test/README.md
Original file line number Diff line number Diff line change
@@ -1,14 +1,23 @@
# 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.
* Follow PEP-8 for naming and black for formatting.