Quellcode durchsuchen

add concurrent testcase (#482)

Signed-off-by: yongpengli-z <yongpeng.li@zilliz.com>
yongpengli-z vor 1 Jahr
Ursprung
Commit
10b81829e3

+ 3 - 56
tests/milvustest/README.md

@@ -28,8 +28,6 @@
 
 
 #### 仓库(maven)
 #### 仓库(maven)
 
 
-![img.png](src/main/resources/images/img.png)
-
 #### 中央仓库
 #### 中央仓库
 
 
 ```xml
 ```xml
@@ -37,64 +35,13 @@
 <dependency>
 <dependency>
     <groupId>io.milvus</groupId>
     <groupId>io.milvus</groupId>
     <artifactId>milvus-sdk-java</artifactId>
     <artifactId>milvus-sdk-java</artifactId>
-    <version>2.0.4</version>
+    <version>2.2.4</version>
 </dependency>
 </dependency>
 ```
 ```
 
 
-#### 私库
-
-- 仓库地址:http://10.13.0.84:9081/#browse/browse:nexus-snapshots:io
-
 - 参考开发环境:https://zilliverse.feishu.cn/wiki/wikcnjtrUdSxgjcG3nLXe8C7bKf#
 - 参考开发环境:https://zilliverse.feishu.cn/wiki/wikcnjtrUdSxgjcG3nLXe8C7bKf#
 
 
-- 打开Maven安装目录下\conf文件,编辑settings.xml,在<services>标签下添加
 
 
-```xml
-
-<servers>
-    <server>
-        <id>nexus-releases</id>  <!--对应pom.xml的id=releases的仓库-->
-        <username>admin</username>
-        <password>admin123</password>
-    </server>
-    <server>
-        <id>nexus-snapshots</id> <!--对应pom.xml中id=snapshots的仓库-->
-        <username>admin</username>
-        <password>admin123</password>
-    </server>
-</servers>
-```
-
-- 在pom文件中加入distributionManagement节点
-
-```xml
-
-<distributionManagement>
-    <!--正式版本-->
-    <repository>
-        <!-- nexus服务器中用户名:在settings.xml中<server>的id-->
-        <id>nexus-snapshots</id>
-        <name>Snapshots repository</name>
-        <url>http://10.13.0.84:9081/repository/nexus-snapshot/</url>
-    </repository>
-    <snapshotRepository>
-        <id>nexus-snapshots</id>
-        <name>Snapshots repository</name>
-        <url>http://10.13.0.84:9081/repository/nexus-snapshot/</url>
-    </snapshotRepository>
-</distributionManagement>
-```
-
-- 修改milvus-sdk-java坐标version
-
-```xml
-
-<dependency>
-    <groupId>io.milvus</groupId>
-    <artifactId>milvus-sdk-java</artifactId>
-    <version>2.0.5-SNAPSHOT</version>
-</dependency>
-```
 
 
 ## 模块介绍
 ## 模块介绍
 
 
@@ -122,12 +69,12 @@
 ### 设计思路
 ### 设计思路
 
 
 - BaseTest类,继承AbstractTestNGSpringContextTests类,为每个测试类提供MilvusServiceClient,方便调用。通过@BeforeSuite提供默认的Collection、Index、Partition
 - BaseTest类,继承AbstractTestNGSpringContextTests类,为每个测试类提供MilvusServiceClient,方便调用。通过@BeforeSuite提供默认的Collection、Index、Partition
-等供测试类使用。
+  等供测试类使用。
 
 
 - test文件里,每一个测试类对应一个接口,每个类之间相互解耦,非必要,不依赖。同类型接口放到同一个文件夹下。接口类的串行测试放到单独文件。
 - test文件里,每一个测试类对应一个接口,每个类之间相互解耦,非必要,不依赖。同类型接口放到同一个文件夹下。接口类的串行测试放到单独文件。
 
 
 - CommonData,CommonFunction提供公用的参数和方法。
 - CommonData,CommonFunction提供公用的参数和方法。
-  
+
 - tesgng.xml文件,提供测试运行配置和测试数据的参数化。
 - tesgng.xml文件,提供测试运行配置和测试数据的参数化。
 
 
 - allure-results文件夹,负责测试运行数据的收集和测试报告的创建。
 - allure-results文件夹,负责测试运行数据的收集和测试报告的创建。

+ 12 - 0
tests/milvustest/src/main/java/com/zilliz/milvustest/common/CommonFunction.java

@@ -19,8 +19,10 @@ import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
 import org.slf4j.LoggerFactory;
 import org.springframework.stereotype.Component;
 import org.springframework.stereotype.Component;
 
 
+import javax.swing.text.FlowView;
 import java.nio.ByteBuffer;
 import java.nio.ByteBuffer;
 import java.util.ArrayList;
 import java.util.ArrayList;
+import java.util.Arrays;
 import java.util.List;
 import java.util.List;
 import java.util.Random;
 import java.util.Random;
 
 
@@ -354,6 +356,16 @@ public class CommonFunction {
     return vectors;
     return vectors;
   }
   }
 
 
+  public static List<List<Float>> generateFloatVectors(int count, int dimension) {
+    Random ran = new Random();
+    List<List<Float>> vectors = new ArrayList<>();
+    for(int i = 0; i < count; i++) {
+      List<Float> item= Arrays.asList(MathUtil.generateFloat(dimension));
+      vectors.add(item);
+    }
+    return vectors;
+  }
+
   public static List<InsertParam.Field> generateStringData(int num) {
   public static List<InsertParam.Field> generateStringData(int num) {
     Random ran = new Random();
     Random ran = new Random();
     List<String> book_name_array = new ArrayList<>();
     List<String> book_name_array = new ArrayList<>();

+ 216 - 49
tests/milvustest/src/test/java/com/zilliz/milvustest/businessflow/ConcurrentTest.java

@@ -1,27 +1,34 @@
 package com.zilliz.milvustest.businessflow;
 package com.zilliz.milvustest.businessflow;
 
 
+import com.alibaba.fastjson.JSONArray;
+import com.alibaba.fastjson.JSONObject;
 import com.zilliz.milvustest.common.CommonData;
 import com.zilliz.milvustest.common.CommonData;
+import com.zilliz.milvustest.common.CommonFunction;
+import com.zilliz.milvustest.util.FileUtils;
+import com.zilliz.milvustest.util.MathUtil;
 import com.zilliz.milvustest.util.PropertyFilesUtil;
 import com.zilliz.milvustest.util.PropertyFilesUtil;
 import io.milvus.client.MilvusServiceClient;
 import io.milvus.client.MilvusServiceClient;
-import io.milvus.grpc.DataType;
-import io.milvus.grpc.ShowCollectionsResponse;
-import io.milvus.grpc.ShowType;
-import io.milvus.param.ConnectParam;
-import io.milvus.param.R;
-import io.milvus.param.RpcStatus;
-import io.milvus.param.collection.CreateCollectionParam;
-import io.milvus.param.collection.FieldType;
-import io.milvus.param.collection.ShowCollectionsParam;
+import io.milvus.common.clientenum.ConsistencyLevelEnum;
+import io.milvus.grpc.*;
+import io.milvus.param.*;
+import io.milvus.param.collection.*;
 import io.milvus.param.credential.CreateCredentialParam;
 import io.milvus.param.credential.CreateCredentialParam;
-import io.milvus.param.role.AddUserToRoleParam;
-import io.milvus.param.role.CreateRoleParam;
-import io.milvus.param.role.GrantRolePrivilegeParam;
+import io.milvus.param.credential.DeleteCredentialParam;
+import io.milvus.param.dml.InsertParam;
+import io.milvus.param.dml.SearchParam;
+import io.milvus.param.index.CreateIndexParam;
+import io.milvus.param.role.*;
+import io.milvus.response.SearchResultsWrapper;
+import lombok.extern.slf4j.Slf4j;
 import org.testng.Assert;
 import org.testng.Assert;
+import org.testng.annotations.AfterClass;
 import org.testng.annotations.BeforeClass;
 import org.testng.annotations.BeforeClass;
 import org.testng.annotations.DataProvider;
 import org.testng.annotations.DataProvider;
 import org.testng.annotations.Test;
 import org.testng.annotations.Test;
 
 
+import java.io.File;
 import java.util.ArrayList;
 import java.util.ArrayList;
+import java.util.Arrays;
 import java.util.List;
 import java.util.List;
 import java.util.concurrent.*;
 import java.util.concurrent.*;
 
 
@@ -29,67 +36,108 @@ import java.util.concurrent.*;
  * @Author yongpeng.li
  * @Author yongpeng.li
  * @Date 2023/5/5 11:27
  * @Date 2023/5/5 11:27
  */
  */
+@Slf4j
 
 
 public class ConcurrentTest {
 public class ConcurrentTest {
-
+     int THREAD=System.getProperty("thread") == null?10: Integer.parseInt(System.getProperty("thread"));
+     int dataNum=System.getProperty("dataNum") == null?10000: Integer.parseInt(System.getProperty("dataNum"));
+     int searchNum=System.getProperty("searchNum") == null?10: Integer.parseInt(System.getProperty("searchNum"));
+     int TopK=System.getProperty("TopK") == null?2: Integer.parseInt(System.getProperty("TopK"));
+     int nprobe=System.getProperty("nprobe") == null?10: Integer.parseInt(System.getProperty("nprobe"));
+     int nq=System.getProperty("nq") == null?10: Integer.parseInt(System.getProperty("nq"));
+     String host=System.getProperty("host") == null?"10.102.9.108": System.getProperty("host");
+     int port=System.getProperty("port") == null?19530: Integer.parseInt(System.getProperty("port"));
+    Object[][] objects=new Object[][]{};
     @DataProvider(name = "UserInfo")
     @DataProvider(name = "UserInfo")
     public Object[][] provideUser(){
     public Object[][] provideUser(){
-        String[][] userinfo=new String[20][2];
-        for(int i = 0; i < 20; i++) {
+        String[][] userinfo=new String[THREAD][2];
+        for(int i = 0; i < THREAD; i++) {
          userinfo[i][0]="Username"+i;
          userinfo[i][0]="Username"+i;
          userinfo[i][1]="Password"+i;
          userinfo[i][1]="Password"+i;
         }
         }
         return userinfo;
         return userinfo;
     }
     }
+    /*@DataProvider(name = "providerPrivilegeList")
+    public Object[][] providerPrivilegeList() {
+        File jsonFile=new File("./src/test/java/resources/testdata/privilege.json");
+        String str = FileUtils.getStr(jsonFile);
+        JSONArray jsonArray = JSONObject.parseArray(str);
+        objects=new Object[jsonArray.size()][3];
+        for (int i = 0; i < jsonArray.size(); i++) {
+            objects[i][0]=((JSONObject)jsonArray.get(i)).getString("object");
+            objects[i][1]=((JSONObject)jsonArray.get(i)).getString("objectName");
+            objects[i][2]=((JSONObject)jsonArray.get(i)).getString("privilege");
+        }
+
+        return objects;
+    }*/
+
+    @AfterClass()
+    public void cleanTestData(){
+        MilvusServiceClient milvusClient =
+                new MilvusServiceClient(
+                        ConnectParam.newBuilder()
+                                .withHost(host)
+                                .withPort(port)
+                                .withSecure(false)
+                                .withAuthorization("root","Milvus")
+                                .build());
+        for(int i = 0; i < THREAD; i++) {
+            milvusClient.dropCollection(DropCollectionParam.newBuilder().withCollectionName("collection"+i).build());
+            milvusClient.deleteCredential(DeleteCredentialParam.newBuilder().withUsername("Username"+i).build());
+        }
+    }
 
 
     @Test(dataProvider = "UserInfo")
     @Test(dataProvider = "UserInfo")
     public void registerUserInfo(String username,String password){
     public void registerUserInfo(String username,String password){
         MilvusServiceClient milvusClient =
         MilvusServiceClient milvusClient =
                 new MilvusServiceClient(
                 new MilvusServiceClient(
                         ConnectParam.newBuilder()
                         ConnectParam.newBuilder()
-                                .withHost("10.102.9.108")
-                                .withPort(19530)
+                                .withHost(host)
+                                .withPort(port)
                                 .withSecure(false)
                                 .withSecure(false)
                                 .withAuthorization("root","Milvus")
                                 .withAuthorization("root","Milvus")
                                 .build());
                                 .build());
         R<RpcStatus> credential = milvusClient.createCredential(CreateCredentialParam.newBuilder().withUsername(username).withPassword(password).build());
         R<RpcStatus> credential = milvusClient.createCredential(CreateCredentialParam.newBuilder().withUsername(username).withPassword(password).build());
-        System.out.println(credential.getStatus());
-        System.out.println(credential.getData().toString());
+        log.info(String.valueOf(credential.getStatus()));
+        log.info(credential.getData().toString());
 
 
     }
     }
 
 
-    @Test(description = "Create role")
-    public void createRole() {
+    /*@Test(description = "Create role",dataProvider = "providerPrivilegeList",dependsOnMethods = "registerUserInfo")
+    public void createAndGrantRole(String object,String objectName,String privilege) {
         MilvusServiceClient milvusClient =
         MilvusServiceClient milvusClient =
                 new MilvusServiceClient(
                 new MilvusServiceClient(
                         ConnectParam.newBuilder()
                         ConnectParam.newBuilder()
-                                .withHost("10.102.9.108")
-                                .withPort(19530)
+                                .withHost(host)
+                                .withPort(port)
                                 .withSecure(false)
                                 .withSecure(false)
                                 .withAuthorization("root","Milvus")
                                 .withAuthorization("root","Milvus")
                                 .build());
                                 .build());
-        /*R<RpcStatus> role =
+        R<RpcStatus> role =
                 milvusClient.createRole(
                 milvusClient.createRole(
                         CreateRoleParam.newBuilder().withRoleName("newRole").build());
                         CreateRoleParam.newBuilder().withRoleName("newRole").build());
         Assert.assertEquals(role.getStatus().intValue(), 0);
         Assert.assertEquals(role.getStatus().intValue(), 0);
-        Assert.assertEquals(role.getData().getMsg(), "Success");*/
+        Assert.assertEquals(role.getData().getMsg(), "Success");
         R<RpcStatus> rpcStatusR =
         R<RpcStatus> rpcStatusR =
                 milvusClient.grantRolePrivilege(
                 milvusClient.grantRolePrivilege(
                         GrantRolePrivilegeParam.newBuilder()
                         GrantRolePrivilegeParam.newBuilder()
                                 .withRoleName("newRole")
                                 .withRoleName("newRole")
-                                .withObject("Collection")
-                                .withObjectName("*")
-                                .withPrivilege("GetStatistics")
+                                .withObject(object)
+                                .withObjectName(objectName)
+                                .withPrivilege(privilege)
                                 .build());
                                 .build());
-    }
+        Assert.assertEquals(rpcStatusR.getStatus().intValue(),0);
+        milvusClient.close();
+    }*/
 
 
-    @Test(dataProvider = "UserInfo")
+    @Test(dataProvider = "UserInfo",dependsOnMethods = "registerUserInfo")
     public void addUserToRole(String username,String password){
     public void addUserToRole(String username,String password){
         MilvusServiceClient milvusClient =
         MilvusServiceClient milvusClient =
                 new MilvusServiceClient(
                 new MilvusServiceClient(
                         ConnectParam.newBuilder()
                         ConnectParam.newBuilder()
-                                .withHost("10.102.9.108")
-                                .withPort(19530)
+                                .withHost(host)
+                                .withPort(port)
                                 .withSecure(false)
                                 .withSecure(false)
                                 .withAuthorization("root","Milvus")
                                 .withAuthorization("root","Milvus")
                                 .build());
                                 .build());
@@ -97,14 +145,15 @@ public class ConcurrentTest {
                 milvusClient.addUserToRole(
                 milvusClient.addUserToRole(
                         AddUserToRoleParam.newBuilder()
                         AddUserToRoleParam.newBuilder()
                                 .withUserName(username)
                                 .withUserName(username)
-                                .withRoleName("newRole")
+                                .withRoleName("admin")
                                 .build());
                                 .build());
         Assert.assertEquals(rpcStatusR.getStatus().intValue(), 0);
         Assert.assertEquals(rpcStatusR.getStatus().intValue(), 0);
+        milvusClient.close();
     }
     }
 
 
-    @Test
+    @Test(dependsOnMethods = "addUserToRole")
     public void createCollection() throws ExecutionException, InterruptedException {
     public void createCollection() throws ExecutionException, InterruptedException {
-        int threads=20;
+        int threads=THREAD;
         ArrayList<Future> list = new ArrayList<>();
         ArrayList<Future> list = new ArrayList<>();
         ExecutorService executorService = Executors.newFixedThreadPool(threads);
         ExecutorService executorService = Executors.newFixedThreadPool(threads);
         for (int e = 0; e < threads; e++) {
         for (int e = 0; e < threads; e++) {
@@ -113,8 +162,8 @@ public class ConcurrentTest {
                 MilvusServiceClient milvusClient =
                 MilvusServiceClient milvusClient =
                         new MilvusServiceClient(
                         new MilvusServiceClient(
                                 ConnectParam.newBuilder()
                                 ConnectParam.newBuilder()
-                                        .withHost("10.102.9.108")
-                                        .withPort(19530)
+                                        .withHost(host)
+                                        .withPort(port)
                                         .withSecure(false)
                                         .withSecure(false)
                                         .withAuthorization("Username"+finalE,"Password"+finalE)
                                         .withAuthorization("Username"+finalE,"Password"+finalE)
                                         .build());
                                         .build());
@@ -145,8 +194,8 @@ public class ConcurrentTest {
                                 .addFieldType(fieldType3)
                                 .addFieldType(fieldType3)
                                 .build();
                                 .build();
                 R<RpcStatus> collection = milvusClient.createCollection(createCollectionReq);
                 R<RpcStatus> collection = milvusClient.createCollection(createCollectionReq);
-                System.out.println("线程"+finalE+":用户Username"+finalE+"创建collection:"+collectionName);
-                System.out.println(collection.getStatus());
+                log.info("线程"+finalE+":用户Username"+finalE+"创建collection:"+collectionName);
+                log.info(String.valueOf(collection.getStatus()));
                 milvusClient.close();
                 milvusClient.close();
                 return collection;
                 return collection;
             };
             };
@@ -154,15 +203,50 @@ public class ConcurrentTest {
             list.add(future);
             list.add(future);
     }
     }
         for (Future future : list) {
         for (Future future : list) {
-            System.out.println("运行结果:"+future.get().toString());
+            log.info("运行结果:"+future.get().toString());
         }
         }
         executorService.shutdown();
         executorService.shutdown();
 
 
     }
     }
 
 
-    @Test
-    public void showCollection() throws ExecutionException, InterruptedException {
-        int threads=10;
+    @Test(dependsOnMethods = "createCollection")
+    public void insertData() throws ExecutionException, InterruptedException {
+        int threads=THREAD;
+        ArrayList<Future> list = new ArrayList<>();
+        ExecutorService executorService = Executors.newFixedThreadPool(threads);
+        for (int e = 0; e < threads; e++) {
+            int finalE = e;
+            Callable callable = () -> {
+                MilvusServiceClient milvusClient =
+                        new MilvusServiceClient(
+                                ConnectParam.newBuilder()
+                                        .withHost(host)
+                                        .withPort(port)
+                                        .withSecure(false)
+                                        .withAuthorization("Username"+finalE,"Password"+finalE)
+                                        .build());
+                List<InsertParam.Field> fields = CommonFunction.generateData(dataNum);
+                long startTime = System.currentTimeMillis();
+                R<MutationResult> insert = milvusClient.insert(InsertParam.newBuilder().withCollectionName("collection" + finalE).withFields(fields).build());
+                long endTime = System.currentTimeMillis();
+                Assert.assertEquals(insert.getStatus().intValue(),0);
+                log.info("线程"+finalE+"-用户:Username"+finalE+"导入"+dataNum+"条数据耗时"+(endTime-startTime));
+                milvusClient.close();
+                return insert;
+            };
+            Future future = executorService.submit(callable);
+            list.add(future);
+
+        }
+        for (Future future : list) {
+            log.info("运行结果:"+future.get().toString());
+        }
+        executorService.shutdown();
+        }
+
+    @Test(dependsOnMethods = "insertData")
+    public void createIndexAndLoadData() throws ExecutionException, InterruptedException {
+        int threads=THREAD;
         ArrayList<Future> list = new ArrayList<>();
         ArrayList<Future> list = new ArrayList<>();
         ExecutorService executorService = Executors.newFixedThreadPool(threads);
         ExecutorService executorService = Executors.newFixedThreadPool(threads);
         for (int e = 0; e < threads; e++) {
         for (int e = 0; e < threads; e++) {
@@ -171,23 +255,106 @@ public class ConcurrentTest {
                 MilvusServiceClient milvusClient =
                 MilvusServiceClient milvusClient =
                         new MilvusServiceClient(
                         new MilvusServiceClient(
                                 ConnectParam.newBuilder()
                                 ConnectParam.newBuilder()
-                                        .withHost("10.102.9.108")
-                                        .withPort(19530)
+                                        .withHost(host)
+                                        .withPort(port)
                                         .withSecure(false)
                                         .withSecure(false)
                                         .withAuthorization("Username"+finalE,"Password"+finalE)
                                         .withAuthorization("Username"+finalE,"Password"+finalE)
                                         .build());
                                         .build());
-                R<ShowCollectionsResponse> showCollectionsResponseR = milvusClient.showCollections(ShowCollectionsParam.newBuilder().withShowType(ShowType.All).build());
-                System.out.println("线程"+finalE+":用户Username"+finalE+"show collection:"+showCollectionsResponseR.getData());
+                long startTime = System.currentTimeMillis();
+                R<RpcStatus> rpcStatusR =
+                        milvusClient.createIndex(
+                                CreateIndexParam.newBuilder()
+                                        .withCollectionName("collection"+finalE)
+                                        .withFieldName(CommonData.defaultVectorField)
+                                        .withIndexName(CommonData.defaultIndex)
+                                        .withMetricType(MetricType.L2)
+                                        .withIndexType(IndexType.HNSW)
+                                        .withExtraParam(CommonFunction.provideExtraParam(IndexType.HNSW))
+                                        .withSyncMode(Boolean.TRUE)
+                                        .withSyncWaitingTimeout(30L)
+                                        .withSyncWaitingInterval(500L)
+                                        .build());
+                long endTime = System.currentTimeMillis();
+                Assert.assertEquals(rpcStatusR.getStatus().intValue(), 0);
+                log.info("线程"+finalE+"-用户:Username"+finalE+"创建索引"+dataNum+"条数据耗时"+(endTime-startTime)+"ms");
+                long startTimeLoad = System.currentTimeMillis();
+                R<RpcStatus> rpcStatusLoad = milvusClient.loadCollection(LoadCollectionParam.newBuilder().withCollectionName("collection" + finalE)
+                        .withSyncLoad(true)
+                        .withSyncLoadWaitingInterval(500L)
+                        .withSyncLoadWaitingTimeout(300L).build());
+                long endTimeLoad = System.currentTimeMillis();
+                log.info("线程"+finalE+"-用户:Username"+finalE+"Load"+dataNum+"条数据耗时"+(endTimeLoad-startTimeLoad)+"ms");
+                Assert.assertEquals(rpcStatusLoad.getStatus().intValue(), 0);
                 milvusClient.close();
                 milvusClient.close();
-                return showCollectionsResponseR;
+                return rpcStatusR;
             };
             };
             Future future = executorService.submit(callable);
             Future future = executorService.submit(callable);
             list.add(future);
             list.add(future);
 
 
         }
         }
         for (Future future : list) {
         for (Future future : list) {
-            System.out.println("运行结果:"+future.get().toString());
+            log.info("运行结果:"+future.get().toString());
         }
         }
         executorService.shutdown();
         executorService.shutdown();
+    }
+
+
+    @Test(dependsOnMethods = "createIndexAndLoadData")
+    public void searchData() throws ExecutionException, InterruptedException {
+        int threads=THREAD;
+        ArrayList<Future> list = new ArrayList<>();
+        ExecutorService executorService = Executors.newFixedThreadPool(threads);
+        for (int e = 0; e < threads; e++) {
+            int finalE = e;
+            Callable callable = () -> {
+                MilvusServiceClient milvusClient =
+                        new MilvusServiceClient(
+                                ConnectParam.newBuilder()
+                                        .withHost(host)
+                                        .withPort(port)
+                                        .withSecure(false)
+                                        .withAuthorization("Username"+finalE,"Password"+finalE)
+                                        .build());
+                List<Integer> result=new ArrayList<>();
+                int vectorNq=2*finalE>=threads?100*nq:nq;
+                for(int i = 0; i < searchNum; i++) {
+                Integer SEARCH_K = TopK; // TopK
+                String SEARCH_PARAM = "{\"nprobe\":"+nprobe+"}";
+                List<String> search_output_fields = Arrays.asList("book_id");
+
+                List<List<Float>> search_vectors = CommonFunction.generateFloatVectors(vectorNq,128);
+                SearchParam searchParam =
+                        SearchParam.newBuilder()
+                                .withCollectionName("collection"+finalE)
+                                .withMetricType(MetricType.L2)
+                                .withOutFields(search_output_fields)
+                                .withTopK(SEARCH_K)
+                                .withVectors(search_vectors)
+                                .withVectorFieldName(CommonData.defaultVectorField)
+                                .withParams(SEARCH_PARAM)
+                                .withConsistencyLevel(ConsistencyLevelEnum.BOUNDED)
+                                .build();
+                long startTime = System.currentTimeMillis();
+                R<SearchResults> searchResultsR = milvusClient.search(searchParam);
+                long endTime = System.currentTimeMillis();
+                Assert.assertEquals(searchResultsR.getStatus().intValue(), 0);
+                SearchResultsWrapper searchResultsWrapper =
+                        new SearchResultsWrapper(searchResultsR.getData().getResults());
+                Assert.assertEquals(searchResultsWrapper.getFieldData("book_id", 0).size(), TopK);
+                log.info("线程"+finalE+"-用户:Username"+finalE+""+"第"+i+"次查询(nq:"+vectorNq+",TopK:"+TopK+")耗时"+(endTime-startTime)+"ms");
+                result.add((int) (endTime-startTime));
+                }
+                milvusClient.close();
+                return "线程"+finalE+"测试(nq:"+vectorNq+",TopK:"+TopK+")结果集:"+result;
+            };
+            Future future = executorService.submit(callable);
+            list.add(future);
+        }
+        for (Future future : list) {
+            log.info("运行结果:"+future.get().toString());
         }
         }
+        executorService.shutdown();
+    }
+
+
 }
 }

+ 0 - 19
tests/milvustest/src/test/java/resources/config/k8s.config

@@ -1,19 +0,0 @@
-apiVersion: v1
-clusters:
-- cluster:
-    insecure-skip-tls-verify: true
-    server: https://devops.apiserver.zilliz.cc:6443
-  name: kubernetes
-contexts:
-- context:
-    cluster: kubernetes
-    namespace: qa
-    user: qa-admin
-  name: qa
-current-context: qa
-kind: Config
-preferences: {}
-users:
-- name: qa-admin
-  user:
-    token: eyJhbGciOiJSUzI1NiIsImtpZCI6ImN1SjZtbE00dTJxUWE3RHhnUUQ3MjVONUVRY3NpWlgzc1FEN09iNVV5d2sifQ.eyJhdWQiOlsiaHR0cHM6Ly9rdWJlcm5ldGVzLmRlZmF1bHQuc3ZjLmNsdXN0ZXIubG9jYWwiXSwiZXhwIjo1MjU4NzE2MDU5LCJpYXQiOjE2NTg3MTk2NTksImlzcyI6Imh0dHBzOi8va3ViZXJuZXRlcy5kZWZhdWx0LnN2Yy5jbHVzdGVyLmxvY2FsIiwia3ViZXJuZXRlcy5pbyI6eyJuYW1lc3BhY2UiOiJxYSIsInNlcnZpY2VhY2NvdW50Ijp7Im5hbWUiOiJxYS1hZG1pbiIsInVpZCI6ImI3MWRkNmI4LTMxOGUtNGQzNi1hNjE1LWZmZDI1MGQ3NjI3MiJ9fSwibmJmIjoxNjU4NzE5NjU5LCJzdWIiOiJzeXN0ZW06c2VydmljZWFjY291bnQ6cWE6cWEtYWRtaW4ifQ.JwMQJ2bUKjXHSd2brWBKwKGlrtXTgZre1vJZ1j0hy5AK1JzhhC4QSfuU7QDdkksAF4xPPj7DJ31e2Qclvs3F4WviRBr0v8fYRDgEqNpSKdIJ9KGTqJEjD2UwsITJC4_P8sNKtX8yw4-eVitha7Bf2na7eorOQas-ebjGvNf4usUHGQh9eQDfR7DMebUn4dzJfE2ArQn5Ua6dKNkdO-7uQpOuqPIKytEfzIk_ZrWmbWTbzNMaq2z-zb_yd8iTU3sfpMaZLgOAkLtl1XxnDwvFMapJJcPFEqPMVvR98O7BkRkobQ4SngZmwEui9U2I-ann8cS_yjKB4DeajCxCvCoJBw

+ 1 - 1
tests/milvustest/testngAll.xml

@@ -1,6 +1,6 @@
 <?xml version="1.0" encoding="UTF-8"?>
 <?xml version="1.0" encoding="UTF-8"?>
 <!DOCTYPE suite SYSTEM "http://testng.org/testng-1.0.dtd">
 <!DOCTYPE suite SYSTEM "http://testng.org/testng-1.0.dtd">
-<suite name="Milvus Java SDK test Suite" parallel="classes" thread-count="6">
+<suite name="Milvus Java SDK test Suite" parallel="classes" thread-count="1">
 
 
     <!--folder-->
     <!--folder-->
     <test name="connection">
     <test name="connection">

+ 12 - 0
tests/milvustest/testngConcurrent.xml

@@ -0,0 +1,12 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!DOCTYPE suite SYSTEM "http://testng.org/testng-1.0.dtd">
+<suite name="Concurrent test for Java SDK">
+    <test name="Concurrent Test">
+        <classes>
+            <class name="com.zilliz.milvustest.businessflow.ConcurrentTest"/>
+        </classes>
+    </test>
+    <listeners>
+        <listener class-name="com.zilliz.milvustest.service.CustomerListener"/>
+    </listeners>
+</suite>