未验证 提交 fae67ee4 编写于 作者: D del-zhenwu 提交者: GitHub

Rename methods (#2312)

* rename interfaces in cases
Signed-off-by: Nzw <zw@zilliz.com>

* rename search_by_id
Signed-off-by: Nzw <zw@zilliz.com>

* remove test search_by_id
Signed-off-by: Nzw <zw@zilliz.com>

* [skip ci] Update CHANGELOG
Signed-off-by: NJinHai-CN <hai.jin@zilliz.com>

* rename methods
Signed-off-by: Nzw <zw@zilliz.com>

* rename methods
Signed-off-by: Nzw <zw@milvus.io>

* fix rename issue
Signed-off-by: Nzw <zw@zilliz.com>

* update hnsw default index param
Signed-off-by: Nzw <zw@zilliz.com>

* Update CHANGELOG.md
Co-authored-by: NJinHai-CN <hai.jin@zilliz.com>
Co-authored-by: Nzw <zw@milvus.io>
上级 ff4c1a07
...@@ -60,5 +60,9 @@ ...@@ -60,5 +60,9 @@
<orderEntry type="library" name="Maven: org.apache.commons:commons-text:1.6" level="project" /> <orderEntry type="library" name="Maven: org.apache.commons:commons-text:1.6" level="project" />
<orderEntry type="library" name="Maven: org.apache.commons:commons-collections4:4.4" level="project" /> <orderEntry type="library" name="Maven: org.apache.commons:commons-collections4:4.4" level="project" />
<orderEntry type="library" name="Maven: org.json:json:20190722" level="project" /> <orderEntry type="library" name="Maven: org.json:json:20190722" level="project" />
<orderEntry type="library" name="Maven: org.slf4j:slf4j-api:1.7.30" level="project" />
<orderEntry type="library" name="Maven: org.apache.logging.log4j:log4j-slf4j-impl:2.12.1" level="project" />
<orderEntry type="library" name="Maven: org.apache.logging.log4j:log4j-api:2.12.1" level="project" />
<orderEntry type="library" scope="RUNTIME" name="Maven: org.apache.logging.log4j:log4j-core:2.12.1" level="project" />
</component> </component>
</module> </module>
\ No newline at end of file
...@@ -75,7 +75,7 @@ public class MainClass { ...@@ -75,7 +75,7 @@ public class MainClass {
.withPort(port) .withPort(port)
.build(); .build();
client.connect(connectParam); client.connect(connectParam);
// List<String> tableNames = client.showCollections().getCollectionNames(); // List<String> tableNames = client.listCollections().getCollectionNames();
// for (int j = 0; j < tableNames.size(); ++j // for (int j = 0; j < tableNames.size(); ++j
// ) { // ) {
// client.dropCollection(tableNames.get(j)); // client.dropCollection(tableNames.get(j));
...@@ -108,7 +108,7 @@ public class MainClass { ...@@ -108,7 +108,7 @@ public class MainClass {
.withPort(port) .withPort(port)
.build(); .build();
client.connect(connectParam); client.connect(connectParam);
// List<String> tableNames = client.showCollections().getCollectionNames(); // List<String> tableNames = client.listCollections().getCollectionNames();
// for (int j = 0; j < tableNames.size(); ++j // for (int j = 0; j < tableNames.size(); ++j
// ) { // ) {
// client.dropCollection(tableNames.get(j)); // client.dropCollection(tableNames.get(j));
...@@ -170,7 +170,7 @@ public class MainClass { ...@@ -170,7 +170,7 @@ public class MainClass {
classes.add(new XmlClass("com.TestPartition")); classes.add(new XmlClass("com.TestPartition"));
classes.add(new XmlClass("com.TestGetVectorByID")); classes.add(new XmlClass("com.TestGetVectorByID"));
classes.add(new XmlClass("com.TestCollectionInfo")); classes.add(new XmlClass("com.TestCollectionInfo"));
classes.add(new XmlClass("com.TestSearchByIds")); // classes.add(new XmlClass("com.TestSearchByIds"));
test.setXmlClasses(classes) ; test.setXmlClasses(classes) ;
......
...@@ -40,7 +40,7 @@ public class TestAddVectors { ...@@ -40,7 +40,7 @@ public class TestAddVectors {
Response res_flush = client.flush(collectionName); Response res_flush = client.flush(collectionName);
assert(res_flush.ok()); assert(res_flush.ok());
// Assert collection row count // Assert collection row count
Assert.assertEquals(client.getCollectionRowCount(collectionName).getCollectionRowCount(), nb); Assert.assertEquals(client.countEntities(collectionName).getCollectionEntityCount(), nb);
} }
@Test(dataProvider = "Collection", dataProviderClass = MainClass.class) @Test(dataProvider = "Collection", dataProviderClass = MainClass.class)
...@@ -56,7 +56,7 @@ public class TestAddVectors { ...@@ -56,7 +56,7 @@ public class TestAddVectors {
Response res_flush = client.flush(collectionName); Response res_flush = client.flush(collectionName);
assert(res_flush.ok()); assert(res_flush.ok());
// Assert collection row count // Assert collection row count
Assert.assertEquals(client.getCollectionRowCount(collectionName).getCollectionRowCount(), nb); Assert.assertEquals(client.countEntities(collectionName).getCollectionEntityCount(), nb);
} }
@Test(dataProvider = "Collection", dataProviderClass = MainClass.class) @Test(dataProvider = "Collection", dataProviderClass = MainClass.class)
...@@ -99,7 +99,7 @@ public class TestAddVectors { ...@@ -99,7 +99,7 @@ public class TestAddVectors {
Response res_flush = client.flush(collectionName); Response res_flush = client.flush(collectionName);
assert(res_flush.ok()); assert(res_flush.ok());
// Assert collection row count // Assert collection row count
Assert.assertEquals(client.getCollectionRowCount(collectionName).getCollectionRowCount(), nb); Assert.assertEquals(client.countEntities(collectionName).getCollectionEntityCount(), nb);
} }
// Add vectors into collection, which tag not existed // Add vectors into collection, which tag not existed
...@@ -123,7 +123,7 @@ public class TestAddVectors { ...@@ -123,7 +123,7 @@ public class TestAddVectors {
Response res_flush = client.flush(collectionName); Response res_flush = client.flush(collectionName);
assert(res_flush.ok()); assert(res_flush.ok());
// Assert collection row count // Assert collection row count
Assert.assertEquals(client.getCollectionRowCount(collectionName).getCollectionRowCount(), nb); Assert.assertEquals(client.countEntities(collectionName).getCollectionEntityCount(), nb);
} }
@Test(dataProvider = "BinaryCollection", dataProviderClass = MainClass.class) @Test(dataProvider = "BinaryCollection", dataProviderClass = MainClass.class)
...@@ -135,7 +135,7 @@ public class TestAddVectors { ...@@ -135,7 +135,7 @@ public class TestAddVectors {
Response res_flush = client.flush(collectionName); Response res_flush = client.flush(collectionName);
assert(res_flush.ok()); assert(res_flush.ok());
// Assert collection row count // Assert collection row count
Assert.assertEquals(client.getCollectionRowCount(collectionName).getCollectionRowCount(), nb); Assert.assertEquals(client.countEntities(collectionName).getCollectionEntityCount(), nb);
} }
@Test(dataProvider = "BinaryCollection", dataProviderClass = MainClass.class) @Test(dataProvider = "BinaryCollection", dataProviderClass = MainClass.class)
...@@ -151,7 +151,7 @@ public class TestAddVectors { ...@@ -151,7 +151,7 @@ public class TestAddVectors {
Response res_flush = client.flush(collectionName); Response res_flush = client.flush(collectionName);
assert(res_flush.ok()); assert(res_flush.ok());
// Assert collection row count // Assert collection row count
Assert.assertEquals(client.getCollectionRowCount(collectionName).getCollectionRowCount(), nb); Assert.assertEquals(client.countEntities(collectionName).getCollectionEntityCount(), nb);
} }
@Test(dataProvider = "BinaryCollection", dataProviderClass = MainClass.class) @Test(dataProvider = "BinaryCollection", dataProviderClass = MainClass.class)
......
...@@ -59,7 +59,7 @@ public class TestCollection { ...@@ -59,7 +59,7 @@ public class TestCollection {
@Test(dataProvider = "ConnectInstance", dataProviderClass = MainClass.class) @Test(dataProvider = "ConnectInstance", dataProviderClass = MainClass.class)
public void test_show_tables(MilvusClient client, String collectionName){ public void test_show_tables(MilvusClient client, String collectionName){
Integer tableNum = 10; Integer tableNum = 10;
ShowCollectionsResponse res = null; ListCollectionsResponse res = null;
for (int i = 0; i < tableNum; ++i) { for (int i = 0; i < tableNum; ++i) {
String collectionNameNew = collectionName+"_"+Integer.toString(i); String collectionNameNew = collectionName+"_"+Integer.toString(i);
CollectionMapping tableSchema = new CollectionMapping.Builder(collectionNameNew, dimension) CollectionMapping tableSchema = new CollectionMapping.Builder(collectionNameNew, dimension)
...@@ -67,14 +67,14 @@ public class TestCollection { ...@@ -67,14 +67,14 @@ public class TestCollection {
.withMetricType(MetricType.L2) .withMetricType(MetricType.L2)
.build(); .build();
client.createCollection(tableSchema); client.createCollection(tableSchema);
List<String> collectionNames = client.showCollections().getCollectionNames(); List<String> collectionNames = client.listCollections().getCollectionNames();
Assert.assertTrue(collectionNames.contains(collectionNameNew)); Assert.assertTrue(collectionNames.contains(collectionNameNew));
} }
} }
@Test(dataProvider = "DisConnectInstance", dataProviderClass = MainClass.class) @Test(dataProvider = "DisConnectInstance", dataProviderClass = MainClass.class)
public void test_show_tables_without_connect(MilvusClient client, String collectionName){ public void test_show_tables_without_connect(MilvusClient client, String collectionName){
ShowCollectionsResponse res = client.showCollections(); ListCollectionsResponse res = client.listCollections();
assert(!res.getResponse().ok()); assert(!res.getResponse().ok());
} }
...@@ -83,7 +83,7 @@ public class TestCollection { ...@@ -83,7 +83,7 @@ public class TestCollection {
Response res = client.dropCollection(collectionName); Response res = client.dropCollection(collectionName);
assert(res.ok()); assert(res.ok());
Thread.currentThread().sleep(1000); Thread.currentThread().sleep(1000);
List<String> collectionNames = client.showCollections().getCollectionNames(); List<String> collectionNames = client.listCollections().getCollectionNames();
Assert.assertFalse(collectionNames.contains(collectionName)); Assert.assertFalse(collectionNames.contains(collectionName));
} }
...@@ -91,7 +91,7 @@ public class TestCollection { ...@@ -91,7 +91,7 @@ public class TestCollection {
public void test_drop_table_not_existed(MilvusClient client, String collectionName) { public void test_drop_table_not_existed(MilvusClient client, String collectionName) {
Response res = client.dropCollection(collectionName+"_"); Response res = client.dropCollection(collectionName+"_");
assert(!res.ok()); assert(!res.ok());
List<String> collectionNames = client.showCollections().getCollectionNames(); List<String> collectionNames = client.listCollections().getCollectionNames();
Assert.assertTrue(collectionNames.contains(collectionName)); Assert.assertTrue(collectionNames.contains(collectionName));
} }
...@@ -103,7 +103,7 @@ public class TestCollection { ...@@ -103,7 +103,7 @@ public class TestCollection {
@Test(dataProvider = "Collection", dataProviderClass = MainClass.class) @Test(dataProvider = "Collection", dataProviderClass = MainClass.class)
public void test_describe_table(MilvusClient client, String collectionName) { public void test_describe_table(MilvusClient client, String collectionName) {
DescribeCollectionResponse res = client.describeCollection(collectionName); GetCollectionInfoResponse res = client.getCollectionInfo(collectionName);
assert(res.getResponse().ok()); assert(res.getResponse().ok());
CollectionMapping tableSchema = res.getCollectionMapping().get(); CollectionMapping tableSchema = res.getCollectionMapping().get();
Assert.assertEquals(tableSchema.getDimension(), dimension); Assert.assertEquals(tableSchema.getDimension(), dimension);
...@@ -114,7 +114,7 @@ public class TestCollection { ...@@ -114,7 +114,7 @@ public class TestCollection {
@Test(dataProvider = "DisConnectInstance", dataProviderClass = MainClass.class) @Test(dataProvider = "DisConnectInstance", dataProviderClass = MainClass.class)
public void test_describe_table_without_connect(MilvusClient client, String collectionName) { public void test_describe_table_without_connect(MilvusClient client, String collectionName) {
DescribeCollectionResponse res = client.describeCollection(collectionName); GetCollectionInfoResponse res = client.getCollectionInfo(collectionName);
assert(!res.getResponse().ok()); assert(!res.getResponse().ok());
} }
......
...@@ -16,18 +16,18 @@ public class TestCollectionCount { ...@@ -16,18 +16,18 @@ public class TestCollectionCount {
@Test(dataProvider = "Collection", dataProviderClass = MainClass.class) @Test(dataProvider = "Collection", dataProviderClass = MainClass.class)
public void test_collection_count_no_vectors(MilvusClient client, String collectionName) { public void test_collection_count_no_vectors(MilvusClient client, String collectionName) {
Assert.assertEquals(client.getCollectionRowCount(collectionName).getCollectionRowCount(), 0); Assert.assertEquals(client.countEntities(collectionName).getCollectionEntityCount(), 0);
} }
@Test(dataProvider = "Collection", dataProviderClass = MainClass.class) @Test(dataProvider = "Collection", dataProviderClass = MainClass.class)
public void test_collection_count_collection_not_existed(MilvusClient client, String collectionName) { public void test_collection_count_collection_not_existed(MilvusClient client, String collectionName) {
GetCollectionRowCountResponse res = client.getCollectionRowCount(collectionName+"_"); CountEntitiesResponse res = client.countEntities(collectionName+"_");
assert(!res.getResponse().ok()); assert(!res.getResponse().ok());
} }
@Test(dataProvider = "DisConnectInstance", dataProviderClass = MainClass.class) @Test(dataProvider = "DisConnectInstance", dataProviderClass = MainClass.class)
public void test_collection_count_without_connect(MilvusClient client, String collectionName) { public void test_collection_count_without_connect(MilvusClient client, String collectionName) {
GetCollectionRowCountResponse res = client.getCollectionRowCount(collectionName+"_"); CountEntitiesResponse res = client.countEntities(collectionName+"_");
assert(!res.getResponse().ok()); assert(!res.getResponse().ok());
} }
...@@ -37,7 +37,7 @@ public class TestCollectionCount { ...@@ -37,7 +37,7 @@ public class TestCollectionCount {
InsertParam insertParam = new InsertParam.Builder(collectionName).withFloatVectors(vectors).build(); InsertParam insertParam = new InsertParam.Builder(collectionName).withFloatVectors(vectors).build();
client.insert(insertParam); client.insert(insertParam);
client.flush(collectionName); client.flush(collectionName);
Assert.assertEquals(client.getCollectionRowCount(collectionName).getCollectionRowCount(), nb); Assert.assertEquals(client.countEntities(collectionName).getCollectionEntityCount(), nb);
} }
@Test(dataProvider = "BinaryCollection", dataProviderClass = MainClass.class) @Test(dataProvider = "BinaryCollection", dataProviderClass = MainClass.class)
...@@ -46,13 +46,13 @@ public class TestCollectionCount { ...@@ -46,13 +46,13 @@ public class TestCollectionCount {
InsertParam insertParam = new InsertParam.Builder(collectionName).withBinaryVectors(vectorsBinary).build(); InsertParam insertParam = new InsertParam.Builder(collectionName).withBinaryVectors(vectorsBinary).build();
client.insert(insertParam); client.insert(insertParam);
client.flush(collectionName); client.flush(collectionName);
Assert.assertEquals(client.getCollectionRowCount(collectionName).getCollectionRowCount(), nb); Assert.assertEquals(client.countEntities(collectionName).getCollectionEntityCount(), nb);
} }
@Test(dataProvider = "Collection", dataProviderClass = MainClass.class) @Test(dataProvider = "Collection", dataProviderClass = MainClass.class)
public void test_collection_count_multi_collections(MilvusClient client, String collectionName) throws InterruptedException { public void test_collection_count_multi_collections(MilvusClient client, String collectionName) throws InterruptedException {
Integer collectionNum = 10; Integer collectionNum = 10;
GetCollectionRowCountResponse res; CountEntitiesResponse res;
for (int i = 0; i < collectionNum; ++i) { for (int i = 0; i < collectionNum; ++i) {
String collectionNameNew = collectionName + "_" + i; String collectionNameNew = collectionName + "_" + i;
CollectionMapping collectionSchema = new CollectionMapping.Builder(collectionNameNew, dimension) CollectionMapping collectionSchema = new CollectionMapping.Builder(collectionNameNew, dimension)
...@@ -67,8 +67,8 @@ public class TestCollectionCount { ...@@ -67,8 +67,8 @@ public class TestCollectionCount {
} }
for (int i = 0; i < collectionNum; ++i) { for (int i = 0; i < collectionNum; ++i) {
String collectionNameNew = collectionName + "_" + i; String collectionNameNew = collectionName + "_" + i;
res = client.getCollectionRowCount(collectionNameNew); res = client.countEntities(collectionNameNew);
Assert.assertEquals(res.getCollectionRowCount(), nb); Assert.assertEquals(res.getCollectionEntityCount(), nb);
} }
} }
......
...@@ -7,6 +7,7 @@ import io.milvus.client.*; ...@@ -7,6 +7,7 @@ import io.milvus.client.*;
import org.testng.annotations.Test; import org.testng.annotations.Test;
import java.nio.ByteBuffer; import java.nio.ByteBuffer;
import java.util.Collections;
import java.util.List; import java.util.List;
public class TestCollectionInfo { public class TestCollectionInfo {
...@@ -26,9 +27,9 @@ public class TestCollectionInfo { ...@@ -26,9 +27,9 @@ public class TestCollectionInfo {
InsertResponse resInsert = client.insert(insertParam); InsertResponse resInsert = client.insert(insertParam);
client.flush(collectionName); client.flush(collectionName);
List<Long> idsBefore = resInsert.getVectorIds(); List<Long> idsBefore = resInsert.getVectorIds();
client.deleteById(collectionName, idsBefore.get(0)); client.deleteEntityByID(collectionName, Collections.singletonList(idsBefore.get(0)));
client.flush(collectionName); client.flush(collectionName);
Response res = client.showCollectionInfo(collectionName); Response res = client.getCollectionStats(collectionName);
System.out.println(res.getMessage()); System.out.println(res.getMessage());
JSONObject collectionInfo = Utils.getCollectionInfo(res.getMessage()); JSONObject collectionInfo = Utils.getCollectionInfo(res.getMessage());
int row_count = collectionInfo.getIntValue("row_count"); int row_count = collectionInfo.getIntValue("row_count");
...@@ -43,9 +44,9 @@ public class TestCollectionInfo { ...@@ -43,9 +44,9 @@ public class TestCollectionInfo {
Index index = new Index.Builder(collectionName, indexType).withParamsInJson(indexParam).build(); Index index = new Index.Builder(collectionName, indexType).withParamsInJson(indexParam).build();
client.createIndex(index); client.createIndex(index);
List<Long> idsBefore = resInsert.getVectorIds(); List<Long> idsBefore = resInsert.getVectorIds();
client.deleteById(collectionName, idsBefore.get(0)); client.deleteEntityByID(collectionName, Collections.singletonList(idsBefore.get(0)));
client.flush(collectionName); client.flush(collectionName);
Response res = client.showCollectionInfo(collectionName); Response res = client.getCollectionStats(collectionName);
System.out.println(res.getMessage()); System.out.println(res.getMessage());
JSONObject collectionInfo = Utils.getCollectionInfo(res.getMessage()); JSONObject collectionInfo = Utils.getCollectionInfo(res.getMessage());
int row_count = collectionInfo.getIntValue("row_count"); int row_count = collectionInfo.getIntValue("row_count");
...@@ -58,9 +59,9 @@ public class TestCollectionInfo { ...@@ -58,9 +59,9 @@ public class TestCollectionInfo {
InsertResponse resInsert = client.insert(insertParam); InsertResponse resInsert = client.insert(insertParam);
client.flush(collectionName); client.flush(collectionName);
List<Long> idsBefore = resInsert.getVectorIds(); List<Long> idsBefore = resInsert.getVectorIds();
client.deleteById(collectionName, idsBefore.get(0)); client.deleteEntityByID(collectionName, Collections.singletonList(idsBefore.get(0)));
client.flush(collectionName); client.flush(collectionName);
Response res = client.showCollectionInfo(collectionName); Response res = client.getCollectionStats(collectionName);
System.out.println(res.getMessage()); System.out.println(res.getMessage());
JSONObject collectionInfo = Utils.getCollectionInfo(res.getMessage()); JSONObject collectionInfo = Utils.getCollectionInfo(res.getMessage());
int row_count = collectionInfo.getIntValue("row_count"); int row_count = collectionInfo.getIntValue("row_count");
......
...@@ -21,12 +21,12 @@ public class TestCompact { ...@@ -21,12 +21,12 @@ public class TestCompact {
assert(res.getResponse().ok()); assert(res.getResponse().ok());
List<Long> ids = res.getVectorIds(); List<Long> ids = res.getVectorIds();
client.flush(collectionName); client.flush(collectionName);
Response res_delete = client.deleteByIds(collectionName, ids); Response res_delete = client.deleteEntityByID(collectionName, ids);
assert(res_delete.ok()); assert(res_delete.ok());
client.flush(collectionName); client.flush(collectionName);
Response res_compact = client.compact(collectionName); Response res_compact = client.compact(collectionName);
assert(res_compact.ok()); assert(res_compact.ok());
Assert.assertEquals(client.getCollectionRowCount(collectionName).getCollectionRowCount(), 0); Assert.assertEquals(client.countEntities(collectionName).getCollectionEntityCount(), 0);
} }
@Test(dataProvider = "BinaryCollection", dataProviderClass = MainClass.class) @Test(dataProvider = "BinaryCollection", dataProviderClass = MainClass.class)
...@@ -36,12 +36,12 @@ public class TestCompact { ...@@ -36,12 +36,12 @@ public class TestCompact {
assert(res.getResponse().ok()); assert(res.getResponse().ok());
List<Long> ids = res.getVectorIds(); List<Long> ids = res.getVectorIds();
client.flush(collectionName); client.flush(collectionName);
Response res_delete = client.deleteByIds(collectionName, ids); Response res_delete = client.deleteEntityByID(collectionName, ids);
assert(res_delete.ok()); assert(res_delete.ok());
client.flush(collectionName); client.flush(collectionName);
Response res_compact = client.compact(collectionName); Response res_compact = client.compact(collectionName);
assert(res_compact.ok()); assert(res_compact.ok());
Assert.assertEquals(client.getCollectionRowCount(collectionName).getCollectionRowCount(), 0); Assert.assertEquals(client.countEntities(collectionName).getCollectionEntityCount(), 0);
} }
@Test(dataProvider = "Collection", dataProviderClass = MainClass.class) @Test(dataProvider = "Collection", dataProviderClass = MainClass.class)
......
...@@ -6,6 +6,7 @@ import org.testng.annotations.Test; ...@@ -6,6 +6,7 @@ import org.testng.annotations.Test;
import java.nio.ByteBuffer; import java.nio.ByteBuffer;
import java.util.ArrayList; import java.util.ArrayList;
import java.util.Collections;
import java.util.List; import java.util.List;
public class TestDeleteVectors { public class TestDeleteVectors {
...@@ -23,11 +24,11 @@ public class TestDeleteVectors { ...@@ -23,11 +24,11 @@ public class TestDeleteVectors {
assert(res.getResponse().ok()); assert(res.getResponse().ok());
List<Long> ids = res.getVectorIds(); List<Long> ids = res.getVectorIds();
client.flush(collectionName); client.flush(collectionName);
Response res_delete = client.deleteByIds(collectionName, ids); Response res_delete = client.deleteEntityByID(collectionName, ids);
assert(res_delete.ok()); assert(res_delete.ok());
client.flush(collectionName); client.flush(collectionName);
// Assert collection row count // Assert collection row count
Assert.assertEquals(client.getCollectionRowCount(collectionName).getCollectionRowCount(), 0); Assert.assertEquals(client.countEntities(collectionName).getCollectionEntityCount(), 0);
} }
@Test(dataProvider = "Collection", dataProviderClass = MainClass.class) @Test(dataProvider = "Collection", dataProviderClass = MainClass.class)
...@@ -41,12 +42,12 @@ public class TestDeleteVectors { ...@@ -41,12 +42,12 @@ public class TestDeleteVectors {
List<Long> ids = res.getVectorIds(); List<Long> ids = res.getVectorIds();
del_ids.add(ids.get(0)); del_ids.add(ids.get(0));
client.flush(collectionName); client.flush(collectionName);
Response res_delete = client.deleteById(collectionName, ids.get(0)); Response res_delete = client.deleteEntityByID(collectionName, Collections.singletonList(ids.get(0)));
assert(res_delete.ok()); assert(res_delete.ok());
client.flush(collectionName); client.flush(collectionName);
// Assert collection row count // Assert collection row count
Assert.assertEquals(client.getCollectionRowCount(collectionName).getCollectionRowCount(), nb - 1); Assert.assertEquals(client.countEntities(collectionName).getCollectionEntityCount(), nb - 1);
GetVectorsByIdsResponse res_get = client.getVectorsByIds(collectionName, del_ids); GetEntityByIDResponse res_get = client.getEntityByID(collectionName, del_ids);
assert(res_get.getResponse().ok()); assert(res_get.getResponse().ok());
assert(res_get.getFloatVectors().get(0).size() == 0); assert(res_get.getFloatVectors().get(0).size() == 0);
} }
...@@ -58,7 +59,7 @@ public class TestDeleteVectors { ...@@ -58,7 +59,7 @@ public class TestDeleteVectors {
assert(res.getResponse().ok()); assert(res.getResponse().ok());
client.flush(collectionName); client.flush(collectionName);
List<Long> ids = res.getVectorIds(); List<Long> ids = res.getVectorIds();
Response res_delete = client.deleteByIds(collectionName + "_not_existed", ids); Response res_delete = client.deleteEntityByID(collectionName + "_not_existed", ids);
assert(!res_delete.ok()); assert(!res_delete.ok());
} }
...@@ -71,11 +72,11 @@ public class TestDeleteVectors { ...@@ -71,11 +72,11 @@ public class TestDeleteVectors {
ids.add((long)123456); ids.add((long)123456);
ids.add((long)1234561); ids.add((long)1234561);
client.flush(collectionName); client.flush(collectionName);
Response res_delete = client.deleteByIds(collectionName, ids); Response res_delete = client.deleteEntityByID(collectionName, ids);
assert(res_delete.ok()); assert(res_delete.ok());
client.flush(collectionName); client.flush(collectionName);
// Assert collection row count // Assert collection row count
Assert.assertEquals(client.getCollectionRowCount(collectionName).getCollectionRowCount(), nb); Assert.assertEquals(client.countEntities(collectionName).getCollectionEntityCount(), nb);
} }
...@@ -88,11 +89,11 @@ public class TestDeleteVectors { ...@@ -88,11 +89,11 @@ public class TestDeleteVectors {
assert(res.getResponse().ok()); assert(res.getResponse().ok());
List<Long> ids = res.getVectorIds(); List<Long> ids = res.getVectorIds();
client.flush(collectionName); client.flush(collectionName);
Response res_delete = client.deleteByIds(collectionName, ids); Response res_delete = client.deleteEntityByID(collectionName, ids);
assert(res_delete.ok()); assert(res_delete.ok());
client.flush(collectionName); client.flush(collectionName);
// Assert collection row count // Assert collection row count
Assert.assertEquals(client.getCollectionRowCount(collectionName).getCollectionRowCount(), 0); Assert.assertEquals(client.countEntities(collectionName).getCollectionEntityCount(), 0);
} }
@Test(dataProvider = "BinaryCollection", dataProviderClass = MainClass.class) @Test(dataProvider = "BinaryCollection", dataProviderClass = MainClass.class)
...@@ -104,11 +105,11 @@ public class TestDeleteVectors { ...@@ -104,11 +105,11 @@ public class TestDeleteVectors {
assert(res.getResponse().ok()); assert(res.getResponse().ok());
List<Long> ids = res.getVectorIds(); List<Long> ids = res.getVectorIds();
client.flush(collectionName); client.flush(collectionName);
Response res_delete = client.deleteById(collectionName, ids.get(0)); Response res_delete = client.deleteEntityByID(collectionName, Collections.singletonList(ids.get(0)));
assert(res_delete.ok()); assert(res_delete.ok());
client.flush(collectionName); client.flush(collectionName);
// Assert collection row count // Assert collection row count
Assert.assertEquals(client.getCollectionRowCount(collectionName).getCollectionRowCount(), nb - 1); Assert.assertEquals(client.countEntities(collectionName).getCollectionEntityCount(), nb - 1);
// Cannot search for the vector // Cannot search for the vector
SearchParam searchParam = new SearchParam.Builder(collectionName) SearchParam searchParam = new SearchParam.Builder(collectionName)
.withBinaryVectors(del_vector) .withBinaryVectors(del_vector)
...@@ -126,7 +127,7 @@ public class TestDeleteVectors { ...@@ -126,7 +127,7 @@ public class TestDeleteVectors {
assert(res.getResponse().ok()); assert(res.getResponse().ok());
List<Long> ids = res.getVectorIds(); List<Long> ids = res.getVectorIds();
client.flush(collectionName); client.flush(collectionName);
Response res_delete = client.deleteByIds(collectionName + "_not_existed", ids); Response res_delete = client.deleteEntityByID(collectionName + "_not_existed", ids);
assert(!res_delete.ok()); assert(!res_delete.ok());
} }
...@@ -139,11 +140,11 @@ public class TestDeleteVectors { ...@@ -139,11 +140,11 @@ public class TestDeleteVectors {
ids.add((long)123456); ids.add((long)123456);
ids.add((long)1234561); ids.add((long)1234561);
client.flush(collectionName); client.flush(collectionName);
Response res_delete = client.deleteByIds(collectionName, ids); Response res_delete = client.deleteEntityByID(collectionName, ids);
assert(res_delete.ok()); assert(res_delete.ok());
client.flush(collectionName); client.flush(collectionName);
// Assert collection row count // Assert collection row count
Assert.assertEquals(client.getCollectionRowCount(collectionName).getCollectionRowCount(), nb); Assert.assertEquals(client.countEntities(collectionName).getCollectionEntityCount(), nb);
} }
} }
...@@ -52,7 +52,7 @@ public class TestFlush { ...@@ -52,7 +52,7 @@ public class TestFlush {
assert(res.ok()); assert(res.ok());
for (int i = 0; i < 10; i++) { for (int i = 0; i < 10; i++) {
// check row count // check row count
Assert.assertEquals(client.getCollectionRowCount(names.get(i)).getCollectionRowCount(), nb); Assert.assertEquals(client.countEntities(names.get(i)).getCollectionEntityCount(), nb);
} }
} }
...@@ -74,7 +74,7 @@ public class TestFlush { ...@@ -74,7 +74,7 @@ public class TestFlush {
flushResponseFuture.get(); flushResponseFuture.get();
for (int i = 0; i < 100; i++) { for (int i = 0; i < 100; i++) {
// check row count // check row count
Assert.assertEquals(client.getCollectionRowCount(names.get(i)).getCollectionRowCount(), nb); Assert.assertEquals(client.countEntities(names.get(i)).getCollectionEntityCount(), nb);
} }
} }
...@@ -85,7 +85,7 @@ public class TestFlush { ...@@ -85,7 +85,7 @@ public class TestFlush {
client.insert(insertParam); client.insert(insertParam);
Response res = client.flush(collectionName); Response res = client.flush(collectionName);
assert(res.ok()); assert(res.ok());
Assert.assertEquals(client.getCollectionRowCount(collectionName).getCollectionRowCount(), nb * (i+1)); Assert.assertEquals(client.countEntities(collectionName).getCollectionEntityCount(), nb * (i+1));
} }
} }
...@@ -96,7 +96,7 @@ public class TestFlush { ...@@ -96,7 +96,7 @@ public class TestFlush {
client.insert(insertParam); client.insert(insertParam);
Response res = client.flush(collectionName); Response res = client.flush(collectionName);
assert(res.ok()); assert(res.ok());
Assert.assertEquals(client.getCollectionRowCount(collectionName).getCollectionRowCount(), nb * (i+1)); Assert.assertEquals(client.countEntities(collectionName).getCollectionEntityCount(), nb * (i+1));
} }
} }
} }
\ No newline at end of file
...@@ -5,6 +5,7 @@ import org.testng.annotations.Test; ...@@ -5,6 +5,7 @@ import org.testng.annotations.Test;
import java.nio.ByteBuffer; import java.nio.ByteBuffer;
import java.util.ArrayList; import java.util.ArrayList;
import java.util.Collections;
import java.util.List; import java.util.List;
public class TestGetVectorByID { public class TestGetVectorByID {
...@@ -21,7 +22,7 @@ public class TestGetVectorByID { ...@@ -21,7 +22,7 @@ public class TestGetVectorByID {
InsertResponse resInsert = client.insert(insertParam); InsertResponse resInsert = client.insert(insertParam);
List<Long> ids = resInsert.getVectorIds(); List<Long> ids = resInsert.getVectorIds();
client.flush(collectionName); client.flush(collectionName);
GetVectorsByIdsResponse res = client.getVectorsByIds(collectionName, ids.subList(0, get_length)); GetEntityByIDResponse res = client.getEntityByID(collectionName, ids.subList(0, get_length));
assert (res.getResponse().ok()); assert (res.getResponse().ok());
for (int i = 0; i < get_length; i++) { for (int i = 0; i < get_length; i++) {
assert (res.getFloatVectors().get(i).equals(vectors.get(i))); assert (res.getFloatVectors().get(i).equals(vectors.get(i)));
...@@ -33,10 +34,10 @@ public class TestGetVectorByID { ...@@ -33,10 +34,10 @@ public class TestGetVectorByID {
InsertParam insertParam = new InsertParam.Builder(collectionName).withFloatVectors(vectors).build(); InsertParam insertParam = new InsertParam.Builder(collectionName).withFloatVectors(vectors).build();
InsertResponse resInsert = client.insert(insertParam); InsertResponse resInsert = client.insert(insertParam);
List<Long> ids = resInsert.getVectorIds(); List<Long> ids = resInsert.getVectorIds();
Response res_delete = client.deleteById(collectionName, ids.get(0)); Response res_delete = client.deleteEntityByID(collectionName, Collections.singletonList(ids.get(0)));
assert(res_delete.ok()); assert(res_delete.ok());
client.flush(collectionName); client.flush(collectionName);
GetVectorsByIdsResponse res = client.getVectorsByIds(collectionName, ids.subList(0, 1)); GetEntityByIDResponse res = client.getEntityByID(collectionName, ids.subList(0, 1));
assert (res.getResponse().ok()); assert (res.getResponse().ok());
assert (res.getFloatVectors().get(0).size() == 0); assert (res.getFloatVectors().get(0).size() == 0);
} }
...@@ -44,7 +45,7 @@ public class TestGetVectorByID { ...@@ -44,7 +45,7 @@ public class TestGetVectorByID {
@Test(dataProvider = "Collection", dataProviderClass = MainClass.class) @Test(dataProvider = "Collection", dataProviderClass = MainClass.class)
public void test_get_vector_by_id_collection_name_not_existed(MilvusClient client, String collectionName) { public void test_get_vector_by_id_collection_name_not_existed(MilvusClient client, String collectionName) {
String newCollection = "not_existed"; String newCollection = "not_existed";
GetVectorsByIdsResponse res = client.getVectorsByIds(newCollection, get_ids); GetEntityByIDResponse res = client.getEntityByID(newCollection, get_ids);
assert(!res.getResponse().ok()); assert(!res.getResponse().ok());
} }
...@@ -53,7 +54,7 @@ public class TestGetVectorByID { ...@@ -53,7 +54,7 @@ public class TestGetVectorByID {
InsertParam insertParam = new InsertParam.Builder(collectionName).withFloatVectors(vectors).build(); InsertParam insertParam = new InsertParam.Builder(collectionName).withFloatVectors(vectors).build();
client.insert(insertParam); client.insert(insertParam);
client.flush(collectionName); client.flush(collectionName);
GetVectorsByIdsResponse res = client.getVectorsByIds(collectionName, get_ids); GetEntityByIDResponse res = client.getEntityByID(collectionName, get_ids);
assert (res.getFloatVectors().get(0).size() == 0); assert (res.getFloatVectors().get(0).size() == 0);
} }
...@@ -64,7 +65,7 @@ public class TestGetVectorByID { ...@@ -64,7 +65,7 @@ public class TestGetVectorByID {
InsertResponse resInsert = client.insert(insertParam); InsertResponse resInsert = client.insert(insertParam);
List<Long> ids = resInsert.getVectorIds(); List<Long> ids = resInsert.getVectorIds();
client.flush(collectionName); client.flush(collectionName);
GetVectorsByIdsResponse res = client.getVectorsByIds(collectionName, ids.subList(0, 1)); GetEntityByIDResponse res = client.getEntityByID(collectionName, ids.subList(0, 1));
assert res.getBinaryVectors().get(0).equals(vectorsBinary.get(0).rewind()); assert res.getBinaryVectors().get(0).equals(vectorsBinary.get(0).rewind());
} }
...@@ -73,10 +74,10 @@ public class TestGetVectorByID { ...@@ -73,10 +74,10 @@ public class TestGetVectorByID {
InsertParam insertParam = new InsertParam.Builder(collectionName).withBinaryVectors(vectorsBinary).build(); InsertParam insertParam = new InsertParam.Builder(collectionName).withBinaryVectors(vectorsBinary).build();
InsertResponse resInsert = client.insert(insertParam); InsertResponse resInsert = client.insert(insertParam);
List<Long> ids = resInsert.getVectorIds(); List<Long> ids = resInsert.getVectorIds();
Response res_delete = client.deleteById(collectionName, ids.get(0)); Response res_delete = client.deleteEntityByID(collectionName, Collections.singletonList(ids.get(0)));
assert(res_delete.ok()); assert(res_delete.ok());
client.flush(collectionName); client.flush(collectionName);
GetVectorsByIdsResponse res = client.getVectorsByIds(collectionName, ids.subList(0, 1)); GetEntityByIDResponse res = client.getEntityByID(collectionName, ids.subList(0, 1));
assert (res.getFloatVectors().get(0).size() == 0); assert (res.getFloatVectors().get(0).size() == 0);
} }
...@@ -85,7 +86,7 @@ public class TestGetVectorByID { ...@@ -85,7 +86,7 @@ public class TestGetVectorByID {
InsertParam insertParam = new InsertParam.Builder(collectionName).withBinaryVectors(vectorsBinary).build(); InsertParam insertParam = new InsertParam.Builder(collectionName).withBinaryVectors(vectorsBinary).build();
client.insert(insertParam); client.insert(insertParam);
client.flush(collectionName); client.flush(collectionName);
GetVectorsByIdsResponse res = client.getVectorsByIds(collectionName, get_ids); GetEntityByIDResponse res = client.getEntityByID(collectionName, get_ids);
assert (res.getFloatVectors().get(0).size() == 0); assert (res.getFloatVectors().get(0).size() == 0);
} }
} }
\ No newline at end of file
...@@ -45,7 +45,7 @@ public class TestIndex { ...@@ -45,7 +45,7 @@ public class TestIndex {
Index index = new Index.Builder(collectionName, indexType).withParamsInJson(indexParam).build(); Index index = new Index.Builder(collectionName, indexType).withParamsInJson(indexParam).build();
Response res_create = client.createIndex(index); Response res_create = client.createIndex(index);
assert(res_create.ok()); assert(res_create.ok());
DescribeIndexResponse res = client.describeIndex(collectionName); GetIndexInfoResponse res = client.getIndexInfo(collectionName);
assert(res.getResponse().ok()); assert(res.getResponse().ok());
Index index1 = res.getIndex().get(); Index index1 = res.getIndex().get();
Assert.assertEquals(Utils.getIndexParamValue(index1.getParamsInJson(), "nlist"), n_list); Assert.assertEquals(Utils.getIndexParamValue(index1.getParamsInJson(), "nlist"), n_list);
...@@ -63,7 +63,7 @@ public class TestIndex { ...@@ -63,7 +63,7 @@ public class TestIndex {
Response res_create = client.createIndex(index); Response res_create = client.createIndex(index);
assert(res_create.ok()); assert(res_create.ok());
Logger.getLogger("a").info("end create"); Logger.getLogger("a").info("end create");
DescribeIndexResponse res = client.describeIndex(collectionName); GetIndexInfoResponse res = client.getIndexInfo(collectionName);
assert(res.getResponse().ok()); assert(res.getResponse().ok());
Index index1 = res.getIndex().get(); Index index1 = res.getIndex().get();
Assert.assertEquals(index1.getIndexType(), indexType); Assert.assertEquals(index1.getIndexType(), indexType);
...@@ -77,7 +77,7 @@ public class TestIndex { ...@@ -77,7 +77,7 @@ public class TestIndex {
Index index = new Index.Builder(collectionName, indexType).withParamsInJson(indexParam).build(); Index index = new Index.Builder(collectionName, indexType).withParamsInJson(indexParam).build();
Response res_create = client.createIndex(index); Response res_create = client.createIndex(index);
assert(res_create.ok()); assert(res_create.ok());
DescribeIndexResponse res = client.describeIndex(collectionName); GetIndexInfoResponse res = client.getIndexInfo(collectionName);
assert(res.getResponse().ok()); assert(res.getResponse().ok());
Index index1 = res.getIndex().get(); Index index1 = res.getIndex().get();
Assert.assertEquals(index1.getIndexType(), indexType); Assert.assertEquals(index1.getIndexType(), indexType);
...@@ -91,7 +91,7 @@ public class TestIndex { ...@@ -91,7 +91,7 @@ public class TestIndex {
Index index = new Index.Builder(collectionName, indexType).withParamsInJson(indexParam).build(); Index index = new Index.Builder(collectionName, indexType).withParamsInJson(indexParam).build();
Response res_create = client.createIndex(index); Response res_create = client.createIndex(index);
assert(res_create.ok()); assert(res_create.ok());
DescribeIndexResponse res = client.describeIndex(collectionName); GetIndexInfoResponse res = client.getIndexInfo(collectionName);
assert(res.getResponse().ok()); assert(res.getResponse().ok());
Index index1 = res.getIndex().get(); Index index1 = res.getIndex().get();
Assert.assertEquals(index1.getIndexType(), indexType); Assert.assertEquals(index1.getIndexType(), indexType);
...@@ -105,7 +105,7 @@ public class TestIndex { ...@@ -105,7 +105,7 @@ public class TestIndex {
Index index = new Index.Builder(collectionName, indexType).withParamsInJson(indexParam).build(); Index index = new Index.Builder(collectionName, indexType).withParamsInJson(indexParam).build();
Response res_create = client.createIndex(index); Response res_create = client.createIndex(index);
assert(res_create.ok()); assert(res_create.ok());
DescribeIndexResponse res = client.describeIndex(collectionName); GetIndexInfoResponse res = client.getIndexInfo(collectionName);
assert(res.getResponse().ok()); assert(res.getResponse().ok());
Index index1 = res.getIndex().get(); Index index1 = res.getIndex().get();
Assert.assertEquals(index1.getIndexType(), indexType); Assert.assertEquals(index1.getIndexType(), indexType);
...@@ -158,7 +158,7 @@ public class TestIndex { ...@@ -158,7 +158,7 @@ public class TestIndex {
Index index = new Index.Builder(collectionName, indexType).withParamsInJson(indexParam).build(); Index index = new Index.Builder(collectionName, indexType).withParamsInJson(indexParam).build();
Response res_create = client.createIndex(index); Response res_create = client.createIndex(index);
assert(res_create.ok()); assert(res_create.ok());
DescribeIndexResponse res = client.describeIndex(collectionName); GetIndexInfoResponse res = client.getIndexInfo(collectionName);
assert(res.getResponse().ok()); assert(res.getResponse().ok());
Index index1 = res.getIndex().get(); Index index1 = res.getIndex().get();
Assert.assertEquals(Utils.getIndexParamValue(index1.getParamsInJson(), "nlist"), n_list); Assert.assertEquals(Utils.getIndexParamValue(index1.getParamsInJson(), "nlist"), n_list);
...@@ -188,7 +188,7 @@ public class TestIndex { ...@@ -188,7 +188,7 @@ public class TestIndex {
Index indexNew = new Index.Builder(collectionName, indexTypeNew).withParamsInJson(indexParam).build(); Index indexNew = new Index.Builder(collectionName, indexTypeNew).withParamsInJson(indexParam).build();
Response resNew = client.createIndex(indexNew); Response resNew = client.createIndex(indexNew);
assert(resNew.ok()); assert(resNew.ok());
DescribeIndexResponse res = client.describeIndex(collectionName); GetIndexInfoResponse res = client.getIndexInfo(collectionName);
assert(res_create.ok()); assert(res_create.ok());
Index index1 = res.getIndex().get(); Index index1 = res.getIndex().get();
Assert.assertEquals(Utils.getIndexParamValue(index1.getParamsInJson(), "nlist"), n_list); Assert.assertEquals(Utils.getIndexParamValue(index1.getParamsInJson(), "nlist"), n_list);
...@@ -198,13 +198,13 @@ public class TestIndex { ...@@ -198,13 +198,13 @@ public class TestIndex {
@Test(dataProvider = "Collection", dataProviderClass = MainClass.class) @Test(dataProvider = "Collection", dataProviderClass = MainClass.class)
public void test_describe_index_table_not_existed(MilvusClient client, String collectionName) { public void test_describe_index_table_not_existed(MilvusClient client, String collectionName) {
String collectionNameNew = collectionName + "_"; String collectionNameNew = collectionName + "_";
DescribeIndexResponse res = client.describeIndex(collectionNameNew); GetIndexInfoResponse res = client.getIndexInfo(collectionNameNew);
assert(!res.getResponse().ok()); assert(!res.getResponse().ok());
} }
@Test(dataProvider = "DisConnectInstance", dataProviderClass = MainClass.class) @Test(dataProvider = "DisConnectInstance", dataProviderClass = MainClass.class)
public void test_describe_index_without_connect(MilvusClient client, String collectionName) { public void test_describe_index_without_connect(MilvusClient client, String collectionName) {
DescribeIndexResponse res = client.describeIndex(collectionName); GetIndexInfoResponse res = client.getIndexInfo(collectionName);
assert(!res.getResponse().ok()); assert(!res.getResponse().ok());
} }
...@@ -217,7 +217,7 @@ public class TestIndex { ...@@ -217,7 +217,7 @@ public class TestIndex {
assert(res.ok()); assert(res.ok());
Response res_drop = client.dropIndex(collectionName); Response res_drop = client.dropIndex(collectionName);
assert(res_drop.ok()); assert(res_drop.ok());
DescribeIndexResponse res2 = client.describeIndex(collectionName); GetIndexInfoResponse res2 = client.getIndexInfo(collectionName);
assert(res2.getResponse().ok()); assert(res2.getResponse().ok());
Index index1 = res2.getIndex().get(); Index index1 = res2.getIndex().get();
Assert.assertEquals(Utils.getIndexParamValue(index1.getParamsInJson(), "nlist"), 0); Assert.assertEquals(Utils.getIndexParamValue(index1.getParamsInJson(), "nlist"), 0);
...@@ -233,7 +233,7 @@ public class TestIndex { ...@@ -233,7 +233,7 @@ public class TestIndex {
assert(res.ok()); assert(res.ok());
Response res_drop = client.dropIndex(collectionName); Response res_drop = client.dropIndex(collectionName);
assert(res_drop.ok()); assert(res_drop.ok());
DescribeIndexResponse res2 = client.describeIndex(collectionName); GetIndexInfoResponse res2 = client.getIndexInfo(collectionName);
assert(res2.getResponse().ok()); assert(res2.getResponse().ok());
Index index1 = res2.getIndex().get(); Index index1 = res2.getIndex().get();
Assert.assertEquals(Utils.getIndexParamValue(index1.getParamsInJson(), "nlist"), 0); Assert.assertEquals(Utils.getIndexParamValue(index1.getParamsInJson(), "nlist"), 0);
...@@ -249,7 +249,7 @@ public class TestIndex { ...@@ -249,7 +249,7 @@ public class TestIndex {
assert(res.ok()); assert(res.ok());
Response res_drop = client.dropIndex(collectionName); Response res_drop = client.dropIndex(collectionName);
assert(res_drop.ok()); assert(res_drop.ok());
DescribeIndexResponse res_desc = client.describeIndex(collectionName); GetIndexInfoResponse res_desc = client.getIndexInfo(collectionName);
assert(res_desc.getResponse().ok()); assert(res_desc.getResponse().ok());
Index index1 = res_desc.getIndex().get(); Index index1 = res_desc.getIndex().get();
Assert.assertEquals(Utils.getIndexParamValue(index1.getParamsInJson(), "nlist"), 0); Assert.assertEquals(Utils.getIndexParamValue(index1.getParamsInJson(), "nlist"), 0);
...@@ -275,7 +275,7 @@ public class TestIndex { ...@@ -275,7 +275,7 @@ public class TestIndex {
client.insert(insertParam); client.insert(insertParam);
Response res_drop = client.dropIndex(collectionName); Response res_drop = client.dropIndex(collectionName);
assert(res_drop.ok()); assert(res_drop.ok());
DescribeIndexResponse res = client.describeIndex(collectionName); GetIndexInfoResponse res = client.getIndexInfo(collectionName);
assert(res.getResponse().ok()); assert(res.getResponse().ok());
Index index1 = res.getIndex().get(); Index index1 = res.getIndex().get();
Assert.assertEquals(index1.getIndexType(), defaultIndexType); Assert.assertEquals(index1.getIndexType(), defaultIndexType);
...@@ -287,7 +287,7 @@ public class TestIndex { ...@@ -287,7 +287,7 @@ public class TestIndex {
client.insert(insertParam); client.insert(insertParam);
Response res_drop = client.dropIndex(collectionName); Response res_drop = client.dropIndex(collectionName);
assert(res_drop.ok()); assert(res_drop.ok());
DescribeIndexResponse res = client.describeIndex(collectionName); GetIndexInfoResponse res = client.getIndexInfo(collectionName);
assert(res.getResponse().ok()); assert(res.getResponse().ok());
Index index1 = res.getIndex().get(); Index index1 = res.getIndex().get();
Assert.assertEquals(index1.getIndexType(), defaultIndexType); Assert.assertEquals(index1.getIndexType(), defaultIndexType);
......
...@@ -98,8 +98,8 @@ public class TestMix { ...@@ -98,8 +98,8 @@ public class TestMix {
executor.shutdown(); executor.shutdown();
Thread.sleep(2000); Thread.sleep(2000);
GetCollectionRowCountResponse getCollectionRowCountResponse = client.getCollectionRowCount(collectionName); CountEntitiesResponse countEntitiesResponse = client.countEntities(collectionName);
Assert.assertEquals(getCollectionRowCountResponse.getCollectionRowCount(), thread_num * nb); Assert.assertEquals(countEntitiesResponse.getCollectionEntityCount(), thread_num * nb);
} }
@Test(dataProvider = "Collection", dataProviderClass = MainClass.class) @Test(dataProvider = "Collection", dataProviderClass = MainClass.class)
...@@ -120,8 +120,8 @@ public class TestMix { ...@@ -120,8 +120,8 @@ public class TestMix {
executor.shutdown(); executor.shutdown();
Thread.sleep(2000); Thread.sleep(2000);
GetCollectionRowCountResponse getCollectionRowCountResponse = client.getCollectionRowCount(collectionName); CountEntitiesResponse countEntitiesResponse = client.countEntities(collectionName);
Assert.assertEquals(getCollectionRowCountResponse.getCollectionRowCount(), thread_num * nb); Assert.assertEquals(countEntitiesResponse.getCollectionEntityCount(), thread_num * nb);
} }
@Test(dataProvider = "Collection", dataProviderClass = MainClass.class) @Test(dataProvider = "Collection", dataProviderClass = MainClass.class)
...@@ -143,8 +143,8 @@ public class TestMix { ...@@ -143,8 +143,8 @@ public class TestMix {
executor.awaitQuiescence(300, TimeUnit.SECONDS); executor.awaitQuiescence(300, TimeUnit.SECONDS);
executor.shutdown(); executor.shutdown();
Thread.sleep(2000); Thread.sleep(2000);
GetCollectionRowCountResponse getCollectionRowCountResponse = client.getCollectionRowCount(collectionName); CountEntitiesResponse countEntitiesResponse = client.countEntities(collectionName);
Assert.assertEquals(getCollectionRowCountResponse.getCollectionRowCount(), thread_num * nb); Assert.assertEquals(countEntitiesResponse.getCollectionEntityCount(), thread_num * nb);
} }
@Test(dataProvider = "Collection", dataProviderClass = MainClass.class) @Test(dataProvider = "Collection", dataProviderClass = MainClass.class)
...@@ -182,8 +182,8 @@ public class TestMix { ...@@ -182,8 +182,8 @@ public class TestMix {
executor.awaitQuiescence(300, TimeUnit.SECONDS); executor.awaitQuiescence(300, TimeUnit.SECONDS);
executor.shutdown(); executor.shutdown();
Thread.sleep(2000); Thread.sleep(2000);
GetCollectionRowCountResponse getCollectionRowCountResponse = client.getCollectionRowCount(collectionName); CountEntitiesResponse countEntitiesResponse = client.countEntities(collectionName);
Assert.assertEquals(getCollectionRowCountResponse.getCollectionRowCount(), thread_num * nb); Assert.assertEquals(countEntitiesResponse.getCollectionEntityCount(), thread_num * nb);
} }
@Test(dataProvider = "DefaultConnectArgs", dataProviderClass = MainClass.class) @Test(dataProvider = "DefaultConnectArgs", dataProviderClass = MainClass.class)
......
...@@ -88,7 +88,7 @@ public class TestPS { ...@@ -88,7 +88,7 @@ public class TestPS {
} }
executor_search.awaitQuiescence(300, TimeUnit.SECONDS); executor_search.awaitQuiescence(300, TimeUnit.SECONDS);
executor_search.shutdown(); executor_search.shutdown();
GetCollectionRowCountResponse getTableRowCountResponse = client.getCollectionRowCount(collectionName); CountEntitiesResponse getTableRowCountResponse = client.countEntities(collectionName);
System.out.println(getTableRowCountResponse.getCollectionRowCount()); System.out.println(getTableRowCountResponse.getCollectionEntityCount());
} }
} }
package com; package com;
import io.milvus.client.HasPartitionResponse; import io.milvus.client.*;
import io.milvus.client.MilvusClient;
import io.milvus.client.Response;
import io.milvus.client.ShowPartitionsResponse;
import org.apache.commons.lang3.RandomStringUtils; import org.apache.commons.lang3.RandomStringUtils;
import org.testng.Assert; import org.testng.Assert;
import org.testng.annotations.Test; import org.testng.annotations.Test;
...@@ -21,7 +18,7 @@ public class TestPartition { ...@@ -21,7 +18,7 @@ public class TestPartition {
Response createpResponse = client.createPartition(collectionName, tag); Response createpResponse = client.createPartition(collectionName, tag);
assert (createpResponse.ok()); assert (createpResponse.ok());
// show partitions // show partitions
List<String> partitions = client.showPartitions(collectionName).getPartitionList(); List<String> partitions = client.listPartitions(collectionName).getPartitionList();
System.out.println(partitions); System.out.println(partitions);
Assert.assertTrue(partitions.contains(tag)); Assert.assertTrue(partitions.contains(tag));
} }
...@@ -71,8 +68,8 @@ public class TestPartition { ...@@ -71,8 +68,8 @@ public class TestPartition {
Response response = client.dropPartition(collectionName, tag); Response response = client.dropPartition(collectionName, tag);
assert (response.ok()); assert (response.ok());
// show partitions // show partitions
System.out.println(client.showPartitions(collectionName).getPartitionList()); System.out.println(client.listPartitions(collectionName).getPartitionList());
int length = client.showPartitions(collectionName).getPartitionList().size(); int length = client.listPartitions(collectionName).getPartitionList().size();
// _default // _default
Assert.assertEquals(length, 1); Assert.assertEquals(length, 1);
} }
...@@ -83,8 +80,8 @@ public class TestPartition { ...@@ -83,8 +80,8 @@ public class TestPartition {
Response createpResponseNew = client.createPartition(collectionName, tag); Response createpResponseNew = client.createPartition(collectionName, tag);
assert (!createpResponseNew.ok()); assert (!createpResponseNew.ok());
// show partitions // show partitions
// System.out.println(client.showPartitions(collectionName).getPartitionList()); // System.out.println(client.listPartitions(collectionName).getPartitionList());
// int length = client.showPartitions(collectionName).getPartitionList().size(); // int length = client.listPartitions(collectionName).getPartitionList().size();
// // _default // // _default
// Assert.assertEquals(length, 1); // Assert.assertEquals(length, 1);
} }
...@@ -132,7 +129,7 @@ public class TestPartition { ...@@ -132,7 +129,7 @@ public class TestPartition {
String tag = RandomStringUtils.randomAlphabetic(10); String tag = RandomStringUtils.randomAlphabetic(10);
Response createpResponse = client.createPartition(collectionName, tag); Response createpResponse = client.createPartition(collectionName, tag);
assert (createpResponse.ok()); assert (createpResponse.ok());
ShowPartitionsResponse response = client.showPartitions(collectionName); ListPartitionsResponse response = client.listPartitions(collectionName);
assert (response.getResponse().ok()); assert (response.getResponse().ok());
Assert.assertTrue(response.getPartitionList().contains(tag)); Assert.assertTrue(response.getPartitionList().contains(tag));
} }
...@@ -146,7 +143,7 @@ public class TestPartition { ...@@ -146,7 +143,7 @@ public class TestPartition {
String tagNew = RandomStringUtils.randomAlphabetic(10); String tagNew = RandomStringUtils.randomAlphabetic(10);
Response newCreatepResponse = client.createPartition(collectionName, tagNew); Response newCreatepResponse = client.createPartition(collectionName, tagNew);
assert (newCreatepResponse.ok()); assert (newCreatepResponse.ok());
ShowPartitionsResponse response = client.showPartitions(collectionName); ListPartitionsResponse response = client.listPartitions(collectionName);
assert (response.getResponse().ok()); assert (response.getResponse().ok());
System.out.println(response.getPartitionList()); System.out.println(response.getPartitionList());
Assert.assertTrue(response.getPartitionList().contains(tag)); Assert.assertTrue(response.getPartitionList().contains(tag));
......
...@@ -796,7 +796,7 @@ class TestCollection: ...@@ -796,7 +796,7 @@ class TestCollection:
def test_load_collection(self, connect, collection, get_simple_index): def test_load_collection(self, connect, collection, get_simple_index):
index_param = get_simple_index["index_param"] index_param = get_simple_index["index_param"]
index_type = get_simple_index["index_type"] index_type = get_simple_index["index_type"]
status, ids = connect.add_vectors(collection, vectors) status, ids = connect.insert(collection, vectors)
status = connect.create_index(collection, index_type, index_param) status = connect.create_index(collection, index_type, index_param)
status = connect.load_collection(collection) status = connect.load_collection(collection)
assert status.OK() assert status.OK()
...@@ -805,7 +805,7 @@ class TestCollection: ...@@ -805,7 +805,7 @@ class TestCollection:
def test_load_collection_ip(self, connect, ip_collection, get_simple_index): def test_load_collection_ip(self, connect, ip_collection, get_simple_index):
index_param = get_simple_index["index_param"] index_param = get_simple_index["index_param"]
index_type = get_simple_index["index_type"] index_type = get_simple_index["index_type"]
status, ids = connect.add_vectors(ip_collection, vectors) status, ids = connect.insert(ip_collection, vectors)
status = connect.create_index(ip_collection, index_type, index_param) status = connect.create_index(ip_collection, index_type, index_param)
status = connect.load_collection(ip_collection) status = connect.load_collection(ip_collection)
assert status.OK() assert status.OK()
...@@ -814,7 +814,7 @@ class TestCollection: ...@@ -814,7 +814,7 @@ class TestCollection:
def test_load_collection_jaccard(self, connect, jac_collection, get_simple_index): def test_load_collection_jaccard(self, connect, jac_collection, get_simple_index):
index_param = get_simple_index["index_param"] index_param = get_simple_index["index_param"]
index_type = get_simple_index["index_type"] index_type = get_simple_index["index_type"]
status, ids = connect.add_vectors(jac_collection, vectors) status, ids = connect.insert(jac_collection, vectors)
status = connect.create_index(jac_collection, index_type, index_param) status = connect.create_index(jac_collection, index_type, index_param)
status = connect.load_collection(jac_collection) status = connect.load_collection(jac_collection)
assert status.OK() assert status.OK()
...@@ -823,7 +823,7 @@ class TestCollection: ...@@ -823,7 +823,7 @@ class TestCollection:
def test_load_collection_hamming(self, connect, ham_collection, get_simple_index): def test_load_collection_hamming(self, connect, ham_collection, get_simple_index):
index_param = get_simple_index["index_param"] index_param = get_simple_index["index_param"]
index_type = get_simple_index["index_type"] index_type = get_simple_index["index_type"]
status, ids = connect.add_vectors(ham_collection, vectors) status, ids = connect.insert(ham_collection, vectors)
status = connect.create_index(ham_collection, index_type, index_param) status = connect.create_index(ham_collection, index_type, index_param)
status = connect.load_collection(ham_collection) status = connect.load_collection(ham_collection)
assert status.OK() assert status.OK()
...@@ -833,7 +833,7 @@ class TestCollection: ...@@ -833,7 +833,7 @@ class TestCollection:
index_param = get_simple_index["index_param"] index_param = get_simple_index["index_param"]
index_type = get_simple_index["index_type"] index_type = get_simple_index["index_type"]
collection_name = gen_unique_str() collection_name = gen_unique_str()
status, ids = connect.add_vectors(collection, vectors) status, ids = connect.insert(collection, vectors)
status = connect.create_index(collection, index_type, index_param) status = connect.create_index(collection, index_type, index_param)
status = connect.load_collection(collection_name) status = connect.load_collection(collection_name)
assert not status.OK() assert not status.OK()
...@@ -843,7 +843,7 @@ class TestCollection: ...@@ -843,7 +843,7 @@ class TestCollection:
index_param = get_simple_index["index_param"] index_param = get_simple_index["index_param"]
index_type = get_simple_index["index_type"] index_type = get_simple_index["index_type"]
collection_name = gen_unique_str() collection_name = gen_unique_str()
status, ids = connect.add_vectors(ip_collection, vectors) status, ids = connect.insert(ip_collection, vectors)
status = connect.create_index(ip_collection, index_type, index_param) status = connect.create_index(ip_collection, index_type, index_param)
status = connect.load_collection(collection_name) status = connect.load_collection(collection_name)
assert not status.OK() assert not status.OK()
...@@ -986,7 +986,7 @@ def create_collection(connect, **params): ...@@ -986,7 +986,7 @@ def create_collection(connect, **params):
return status return status
def search_collection(connect, **params): def search_collection(connect, **params):
status, result = connect.search_vectors( status, result = connect.search(
params["collection_name"], params["collection_name"],
params["top_k"], params["top_k"],
params["query_vectors"], params["query_vectors"],
......
...@@ -26,7 +26,7 @@ class TestCollectionCount: ...@@ -26,7 +26,7 @@ class TestCollectionCount:
20000, 20000,
], ],
) )
def add_vectors_nb(self, request): def insert_nb(self, request):
yield request.param yield request.param
""" """
...@@ -44,37 +44,37 @@ class TestCollectionCount: ...@@ -44,37 +44,37 @@ class TestCollectionCount:
pytest.skip("Skip PQ Temporary") pytest.skip("Skip PQ Temporary")
return request.param return request.param
def test_collection_rows_count(self, connect, collection, add_vectors_nb): def test_collection_rows_count(self, connect, collection, insert_nb):
''' '''
target: test collection rows_count is correct or not target: test collection rows_count is correct or not
method: create collection and add vectors in it, method: create collection and add vectors in it,
assert the value returned by count_entities method is equal to length of vectors assert the value returned by count_entities method is equal to length of vectors
expected: the count is equal to the length of vectors expected: the count is equal to the length of vectors
''' '''
nb = add_vectors_nb nb = insert_nb
vectors = gen_vectors(nb, dim) vectors = gen_vectors(nb, dim)
res = connect.add_vectors(collection_name=collection, records=vectors) res = connect.insert(collection_name=collection, records=vectors)
connect.flush([collection]) connect.flush([collection])
status, res = connect.count_entities(collection) status, res = connect.count_entities(collection)
assert res == nb assert res == nb
def test_collection_rows_count_partition(self, connect, collection, add_vectors_nb): def test_collection_rows_count_partition(self, connect, collection, insert_nb):
''' '''
target: test collection rows_count is correct or not target: test collection rows_count is correct or not
method: create collection, create partition and add vectors in it, method: create collection, create partition and add vectors in it,
assert the value returned by count_entities method is equal to length of vectors assert the value returned by count_entities method is equal to length of vectors
expected: the count is equal to the length of vectors expected: the count is equal to the length of vectors
''' '''
nb = add_vectors_nb nb = insert_nb
vectors = gen_vectors(nb, dim) vectors = gen_vectors(nb, dim)
status = connect.create_partition(collection, tag) status = connect.create_partition(collection, tag)
assert status.OK() assert status.OK()
res = connect.add_vectors(collection_name=collection, records=vectors, partition_tag=tag) res = connect.insert(collection_name=collection, records=vectors, partition_tag=tag)
connect.flush([collection]) connect.flush([collection])
status, res = connect.count_entities(collection) status, res = connect.count_entities(collection)
assert res == nb assert res == nb
def test_collection_rows_count_multi_partitions_A(self, connect, collection, add_vectors_nb): def test_collection_rows_count_multi_partitions_A(self, connect, collection, insert_nb):
''' '''
target: test collection rows_count is correct or not target: test collection rows_count is correct or not
method: create collection, create partitions and add vectors in it, method: create collection, create partitions and add vectors in it,
...@@ -82,17 +82,17 @@ class TestCollectionCount: ...@@ -82,17 +82,17 @@ class TestCollectionCount:
expected: the count is equal to the length of vectors expected: the count is equal to the length of vectors
''' '''
new_tag = "new_tag" new_tag = "new_tag"
nb = add_vectors_nb nb = insert_nb
vectors = gen_vectors(nb, dim) vectors = gen_vectors(nb, dim)
status = connect.create_partition(collection, tag) status = connect.create_partition(collection, tag)
status = connect.create_partition(collection, new_tag) status = connect.create_partition(collection, new_tag)
assert status.OK() assert status.OK()
res = connect.add_vectors(collection_name=collection, records=vectors) res = connect.insert(collection_name=collection, records=vectors)
connect.flush([collection]) connect.flush([collection])
status, res = connect.count_entities(collection) status, res = connect.count_entities(collection)
assert res == nb assert res == nb
def test_collection_rows_count_multi_partitions_B(self, connect, collection, add_vectors_nb): def test_collection_rows_count_multi_partitions_B(self, connect, collection, insert_nb):
''' '''
target: test collection rows_count is correct or not target: test collection rows_count is correct or not
method: create collection, create partitions and add vectors in one of the partitions, method: create collection, create partitions and add vectors in one of the partitions,
...@@ -100,17 +100,17 @@ class TestCollectionCount: ...@@ -100,17 +100,17 @@ class TestCollectionCount:
expected: the count is equal to the length of vectors expected: the count is equal to the length of vectors
''' '''
new_tag = "new_tag" new_tag = "new_tag"
nb = add_vectors_nb nb = insert_nb
vectors = gen_vectors(nb, dim) vectors = gen_vectors(nb, dim)
status = connect.create_partition(collection, tag) status = connect.create_partition(collection, tag)
status = connect.create_partition(collection, new_tag) status = connect.create_partition(collection, new_tag)
assert status.OK() assert status.OK()
res = connect.add_vectors(collection_name=collection, records=vectors, partition_tag=tag) res = connect.insert(collection_name=collection, records=vectors, partition_tag=tag)
connect.flush([collection]) connect.flush([collection])
status, res = connect.count_entities(collection) status, res = connect.count_entities(collection)
assert res == nb assert res == nb
def test_collection_rows_count_multi_partitions_C(self, connect, collection, add_vectors_nb): def test_collection_rows_count_multi_partitions_C(self, connect, collection, insert_nb):
''' '''
target: test collection rows_count is correct or not target: test collection rows_count is correct or not
method: create collection, create partitions and add vectors in one of the partitions, method: create collection, create partitions and add vectors in one of the partitions,
...@@ -118,13 +118,13 @@ class TestCollectionCount: ...@@ -118,13 +118,13 @@ class TestCollectionCount:
expected: the collection count is equal to the length of vectors expected: the collection count is equal to the length of vectors
''' '''
new_tag = "new_tag" new_tag = "new_tag"
nb = add_vectors_nb nb = insert_nb
vectors = gen_vectors(nb, dim) vectors = gen_vectors(nb, dim)
status = connect.create_partition(collection, tag) status = connect.create_partition(collection, tag)
status = connect.create_partition(collection, new_tag) status = connect.create_partition(collection, new_tag)
assert status.OK() assert status.OK()
res = connect.add_vectors(collection_name=collection, records=vectors, partition_tag=tag) res = connect.insert(collection_name=collection, records=vectors, partition_tag=tag)
res = connect.add_vectors(collection_name=collection, records=vectors, partition_tag=new_tag) res = connect.insert(collection_name=collection, records=vectors, partition_tag=new_tag)
connect.flush([collection]) connect.flush([collection])
status, res = connect.count_entities(collection) status, res = connect.count_entities(collection)
assert res == nb * 2 assert res == nb * 2
...@@ -139,7 +139,7 @@ class TestCollectionCount: ...@@ -139,7 +139,7 @@ class TestCollectionCount:
index_type = get_simple_index["index_type"] index_type = get_simple_index["index_type"]
nb = 100 nb = 100
vectors = gen_vectors(nb, dim) vectors = gen_vectors(nb, dim)
res = connect.add_vectors(collection_name=collection, records=vectors) res = connect.insert(collection_name=collection, records=vectors)
connect.flush([collection]) connect.flush([collection])
connect.create_index(collection, index_type, index_param) connect.create_index(collection, index_type, index_param)
status, res = connect.count_entities(collection) status, res = connect.count_entities(collection)
...@@ -182,7 +182,7 @@ class TestCollectionCount: ...@@ -182,7 +182,7 @@ class TestCollectionCount:
''' '''
nq = 2 nq = 2
vectors = gen_vectors(nq, dim) vectors = gen_vectors(nq, dim)
res = connect.add_vectors(collection_name=collection, records=vectors) res = connect.insert(collection_name=collection, records=vectors)
time.sleep(add_time_interval) time.sleep(add_time_interval)
def rows_count(milvus): def rows_count(milvus):
...@@ -219,7 +219,7 @@ class TestCollectionCount: ...@@ -219,7 +219,7 @@ class TestCollectionCount:
'index_file_size': index_file_size, 'index_file_size': index_file_size,
'metric_type': MetricType.L2} 'metric_type': MetricType.L2}
connect.create_collection(param) connect.create_collection(param)
res = connect.add_vectors(collection_name=collection_name, records=vectors) res = connect.insert(collection_name=collection_name, records=vectors)
connect.flush(collection_list) connect.flush(collection_list)
for i in range(20): for i in range(20):
status, res = connect.count_entities(collection_list[i]) status, res = connect.count_entities(collection_list[i])
...@@ -240,7 +240,7 @@ class TestCollectionCountIP: ...@@ -240,7 +240,7 @@ class TestCollectionCountIP:
20000, 20000,
], ],
) )
def add_vectors_nb(self, request): def insert_nb(self, request):
yield request.param yield request.param
""" """
...@@ -259,16 +259,16 @@ class TestCollectionCountIP: ...@@ -259,16 +259,16 @@ class TestCollectionCountIP:
pytest.skip("Skip PQ Temporary") pytest.skip("Skip PQ Temporary")
return request.param return request.param
def test_collection_rows_count(self, connect, ip_collection, add_vectors_nb): def test_collection_rows_count(self, connect, ip_collection, insert_nb):
''' '''
target: test collection rows_count is correct or not target: test collection rows_count is correct or not
method: create collection and add vectors in it, method: create collection and add vectors in it,
assert the value returned by count_entities method is equal to length of vectors assert the value returned by count_entities method is equal to length of vectors
expected: the count is equal to the length of vectors expected: the count is equal to the length of vectors
''' '''
nb = add_vectors_nb nb = insert_nb
vectors = gen_vectors(nb, dim) vectors = gen_vectors(nb, dim)
res = connect.add_vectors(collection_name=ip_collection, records=vectors) res = connect.insert(collection_name=ip_collection, records=vectors)
connect.flush([ip_collection]) connect.flush([ip_collection])
status, res = connect.count_entities(ip_collection) status, res = connect.count_entities(ip_collection)
assert res == nb assert res == nb
...@@ -283,7 +283,7 @@ class TestCollectionCountIP: ...@@ -283,7 +283,7 @@ class TestCollectionCountIP:
index_type = get_simple_index["index_type"] index_type = get_simple_index["index_type"]
nb = 100 nb = 100
vectors = gen_vectors(nb, dim) vectors = gen_vectors(nb, dim)
res = connect.add_vectors(collection_name=ip_collection, records=vectors) res = connect.insert(collection_name=ip_collection, records=vectors)
connect.flush([ip_collection]) connect.flush([ip_collection])
connect.create_index(ip_collection, index_type, index_param) connect.create_index(ip_collection, index_type, index_param)
status, res = connect.count_entities(ip_collection) status, res = connect.count_entities(ip_collection)
...@@ -325,7 +325,7 @@ class TestCollectionCountIP: ...@@ -325,7 +325,7 @@ class TestCollectionCountIP:
''' '''
nq = 2 nq = 2
vectors = gen_vectors(nq, dim) vectors = gen_vectors(nq, dim)
res = connect.add_vectors(collection_name=ip_collection, records=vectors) res = connect.insert(collection_name=ip_collection, records=vectors)
time.sleep(add_time_interval) time.sleep(add_time_interval)
def rows_count(milvus): def rows_count(milvus):
...@@ -362,7 +362,7 @@ class TestCollectionCountIP: ...@@ -362,7 +362,7 @@ class TestCollectionCountIP:
'index_file_size': index_file_size, 'index_file_size': index_file_size,
'metric_type': MetricType.IP} 'metric_type': MetricType.IP}
connect.create_collection(param) connect.create_collection(param)
res = connect.add_vectors(collection_name=collection_name, records=vectors) res = connect.insert(collection_name=collection_name, records=vectors)
connect.flush(collection_list) connect.flush(collection_list)
for i in range(20): for i in range(20):
status, res = connect.count_entities(collection_list[i]) status, res = connect.count_entities(collection_list[i])
...@@ -383,7 +383,7 @@ class TestCollectionCountJAC: ...@@ -383,7 +383,7 @@ class TestCollectionCountJAC:
20000, 20000,
], ],
) )
def add_vectors_nb(self, request): def insert_nb(self, request):
yield request.param yield request.param
""" """
...@@ -401,16 +401,16 @@ class TestCollectionCountJAC: ...@@ -401,16 +401,16 @@ class TestCollectionCountJAC:
else: else:
pytest.skip("Skip index Temporary") pytest.skip("Skip index Temporary")
def test_collection_rows_count(self, connect, jac_collection, add_vectors_nb): def test_collection_rows_count(self, connect, jac_collection, insert_nb):
''' '''
target: test collection rows_count is correct or not target: test collection rows_count is correct or not
method: create collection and add vectors in it, method: create collection and add vectors in it,
assert the value returned by count_entities method is equal to length of vectors assert the value returned by count_entities method is equal to length of vectors
expected: the count is equal to the length of vectors expected: the count is equal to the length of vectors
''' '''
nb = add_vectors_nb nb = insert_nb
tmp, vectors = gen_binary_vectors(nb, dim) tmp, vectors = gen_binary_vectors(nb, dim)
res = connect.add_vectors(collection_name=jac_collection, records=vectors) res = connect.insert(collection_name=jac_collection, records=vectors)
connect.flush([jac_collection]) connect.flush([jac_collection])
status, res = connect.count_entities(jac_collection) status, res = connect.count_entities(jac_collection)
assert res == nb assert res == nb
...@@ -425,7 +425,7 @@ class TestCollectionCountJAC: ...@@ -425,7 +425,7 @@ class TestCollectionCountJAC:
index_param = get_jaccard_index["index_param"] index_param = get_jaccard_index["index_param"]
index_type = get_jaccard_index["index_type"] index_type = get_jaccard_index["index_type"]
tmp, vectors = gen_binary_vectors(nb, dim) tmp, vectors = gen_binary_vectors(nb, dim)
res = connect.add_vectors(collection_name=jac_collection, records=vectors) res = connect.insert(collection_name=jac_collection, records=vectors)
connect.flush([jac_collection]) connect.flush([jac_collection])
connect.create_index(jac_collection, index_type, index_param) connect.create_index(jac_collection, index_type, index_param)
status, res = connect.count_entities(jac_collection) status, res = connect.count_entities(jac_collection)
...@@ -474,7 +474,7 @@ class TestCollectionCountJAC: ...@@ -474,7 +474,7 @@ class TestCollectionCountJAC:
'index_file_size': index_file_size, 'index_file_size': index_file_size,
'metric_type': MetricType.JACCARD} 'metric_type': MetricType.JACCARD}
connect.create_collection(param) connect.create_collection(param)
res = connect.add_vectors(collection_name=collection_name, records=vectors) res = connect.insert(collection_name=collection_name, records=vectors)
connect.flush(collection_list) connect.flush(collection_list)
for i in range(20): for i in range(20):
status, res = connect.count_entities(collection_list[i]) status, res = connect.count_entities(collection_list[i])
...@@ -494,7 +494,7 @@ class TestCollectionCountBinary: ...@@ -494,7 +494,7 @@ class TestCollectionCountBinary:
20000, 20000,
], ],
) )
def add_vectors_nb(self, request): def insert_nb(self, request):
yield request.param yield request.param
""" """
...@@ -534,44 +534,44 @@ class TestCollectionCountBinary: ...@@ -534,44 +534,44 @@ class TestCollectionCountBinary:
else: else:
pytest.skip("Skip index Temporary") pytest.skip("Skip index Temporary")
def test_collection_rows_count(self, connect, ham_collection, add_vectors_nb): def test_collection_rows_count(self, connect, ham_collection, insert_nb):
''' '''
target: test collection rows_count is correct or not target: test collection rows_count is correct or not
method: create collection and add vectors in it, method: create collection and add vectors in it,
assert the value returned by count_entities method is equal to length of vectors assert the value returned by count_entities method is equal to length of vectors
expected: the count is equal to the length of vectors expected: the count is equal to the length of vectors
''' '''
nb = add_vectors_nb nb = insert_nb
tmp, vectors = gen_binary_vectors(nb, dim) tmp, vectors = gen_binary_vectors(nb, dim)
res = connect.add_vectors(collection_name=ham_collection, records=vectors) res = connect.insert(collection_name=ham_collection, records=vectors)
connect.flush([ham_collection]) connect.flush([ham_collection])
status, res = connect.count_entities(ham_collection) status, res = connect.count_entities(ham_collection)
assert res == nb assert res == nb
def test_collection_rows_count_substructure(self, connect, substructure_collection, add_vectors_nb): def test_collection_rows_count_substructure(self, connect, substructure_collection, insert_nb):
''' '''
target: test collection rows_count is correct or not target: test collection rows_count is correct or not
method: create collection and add vectors in it, method: create collection and add vectors in it,
assert the value returned by count_entities method is equal to length of vectors assert the value returned by count_entities method is equal to length of vectors
expected: the count is equal to the length of vectors expected: the count is equal to the length of vectors
''' '''
nb = add_vectors_nb nb = insert_nb
tmp, vectors = gen_binary_vectors(nb, dim) tmp, vectors = gen_binary_vectors(nb, dim)
res = connect.add_vectors(collection_name=substructure_collection, records=vectors) res = connect.insert(collection_name=substructure_collection, records=vectors)
connect.flush([substructure_collection]) connect.flush([substructure_collection])
status, res = connect.count_entities(substructure_collection) status, res = connect.count_entities(substructure_collection)
assert res == nb assert res == nb
def test_collection_rows_count_superstructure(self, connect, superstructure_collection, add_vectors_nb): def test_collection_rows_count_superstructure(self, connect, superstructure_collection, insert_nb):
''' '''
target: test collection rows_count is correct or not target: test collection rows_count is correct or not
method: create collection and add vectors in it, method: create collection and add vectors in it,
assert the value returned by count_entities method is equal to length of vectors assert the value returned by count_entities method is equal to length of vectors
expected: the count is equal to the length of vectors expected: the count is equal to the length of vectors
''' '''
nb = add_vectors_nb nb = insert_nb
tmp, vectors = gen_binary_vectors(nb, dim) tmp, vectors = gen_binary_vectors(nb, dim)
res = connect.add_vectors(collection_name=superstructure_collection, records=vectors) res = connect.insert(collection_name=superstructure_collection, records=vectors)
connect.flush([superstructure_collection]) connect.flush([superstructure_collection])
status, res = connect.count_entities(superstructure_collection) status, res = connect.count_entities(superstructure_collection)
assert res == nb assert res == nb
...@@ -586,7 +586,7 @@ class TestCollectionCountBinary: ...@@ -586,7 +586,7 @@ class TestCollectionCountBinary:
index_type = get_hamming_index["index_type"] index_type = get_hamming_index["index_type"]
index_param = get_hamming_index["index_param"] index_param = get_hamming_index["index_param"]
tmp, vectors = gen_binary_vectors(nb, dim) tmp, vectors = gen_binary_vectors(nb, dim)
res = connect.add_vectors(collection_name=ham_collection, records=vectors) res = connect.insert(collection_name=ham_collection, records=vectors)
connect.flush([ham_collection]) connect.flush([ham_collection])
connect.create_index(ham_collection, index_type, index_param) connect.create_index(ham_collection, index_type, index_param)
status, res = connect.count_entities(ham_collection) status, res = connect.count_entities(ham_collection)
...@@ -602,7 +602,7 @@ class TestCollectionCountBinary: ...@@ -602,7 +602,7 @@ class TestCollectionCountBinary:
index_type = get_substructure_index["index_type"] index_type = get_substructure_index["index_type"]
index_param = get_substructure_index["index_param"] index_param = get_substructure_index["index_param"]
tmp, vectors = gen_binary_vectors(nb, dim) tmp, vectors = gen_binary_vectors(nb, dim)
res = connect.add_vectors(collection_name=substructure_collection, records=vectors) res = connect.insert(collection_name=substructure_collection, records=vectors)
connect.flush([substructure_collection]) connect.flush([substructure_collection])
connect.create_index(substructure_collection, index_type, index_param) connect.create_index(substructure_collection, index_type, index_param)
status, res = connect.count_entities(substructure_collection) status, res = connect.count_entities(substructure_collection)
...@@ -618,7 +618,7 @@ class TestCollectionCountBinary: ...@@ -618,7 +618,7 @@ class TestCollectionCountBinary:
index_type = get_superstructure_index["index_type"] index_type = get_superstructure_index["index_type"]
index_param = get_superstructure_index["index_param"] index_param = get_superstructure_index["index_param"]
tmp, vectors = gen_binary_vectors(nb, dim) tmp, vectors = gen_binary_vectors(nb, dim)
res = connect.add_vectors(collection_name=superstructure_collection, records=vectors) res = connect.insert(collection_name=superstructure_collection, records=vectors)
connect.flush([superstructure_collection]) connect.flush([superstructure_collection])
connect.create_index(superstructure_collection, index_type, index_param) connect.create_index(superstructure_collection, index_type, index_param)
status, res = connect.count_entities(superstructure_collection) status, res = connect.count_entities(superstructure_collection)
...@@ -667,7 +667,7 @@ class TestCollectionCountBinary: ...@@ -667,7 +667,7 @@ class TestCollectionCountBinary:
'index_file_size': index_file_size, 'index_file_size': index_file_size,
'metric_type': MetricType.HAMMING} 'metric_type': MetricType.HAMMING}
connect.create_collection(param) connect.create_collection(param)
res = connect.add_vectors(collection_name=collection_name, records=vectors) res = connect.insert(collection_name=collection_name, records=vectors)
connect.flush(collection_list) connect.flush(collection_list)
for i in range(20): for i in range(20):
status, res = connect.count_entities(collection_list[i]) status, res = connect.count_entities(collection_list[i])
...@@ -688,7 +688,7 @@ class TestCollectionCountTANIMOTO: ...@@ -688,7 +688,7 @@ class TestCollectionCountTANIMOTO:
20000, 20000,
], ],
) )
def add_vectors_nb(self, request): def insert_nb(self, request):
yield request.param yield request.param
""" """
...@@ -706,16 +706,16 @@ class TestCollectionCountTANIMOTO: ...@@ -706,16 +706,16 @@ class TestCollectionCountTANIMOTO:
else: else:
pytest.skip("Skip index Temporary") pytest.skip("Skip index Temporary")
def test_collection_rows_count(self, connect, tanimoto_collection, add_vectors_nb): def test_collection_rows_count(self, connect, tanimoto_collection, insert_nb):
''' '''
target: test collection rows_count is correct or not target: test collection rows_count is correct or not
method: create collection and add vectors in it, method: create collection and add vectors in it,
assert the value returned by count_entities method is equal to length of vectors assert the value returned by count_entities method is equal to length of vectors
expected: the count is equal to the length of vectors expected: the count is equal to the length of vectors
''' '''
nb = add_vectors_nb nb = insert_nb
tmp, vectors = gen_binary_vectors(nb, dim) tmp, vectors = gen_binary_vectors(nb, dim)
res = connect.add_vectors(collection_name=tanimoto_collection, records=vectors) res = connect.insert(collection_name=tanimoto_collection, records=vectors)
connect.flush([tanimoto_collection]) connect.flush([tanimoto_collection])
status, res = connect.count_entities(tanimoto_collection) status, res = connect.count_entities(tanimoto_collection)
assert status.OK() assert status.OK()
......
...@@ -81,7 +81,7 @@ class TestCollectionInfoBase: ...@@ -81,7 +81,7 @@ class TestCollectionInfoBase:
expected: status ok, count as expected expected: status ok, count as expected
''' '''
vectors = gen_vector(nb, dim) vectors = gen_vector(nb, dim)
status, ids = connect.add_vectors(collection, vectors) status, ids = connect.insert(collection, vectors)
assert status.OK() assert status.OK()
status = connect.flush([collection]) status = connect.flush([collection])
assert status.OK() assert status.OK()
...@@ -106,7 +106,7 @@ class TestCollectionInfoBase: ...@@ -106,7 +106,7 @@ class TestCollectionInfoBase:
expected: status ok, "_default" partition is listed expected: status ok, "_default" partition is listed
''' '''
vectors = gen_vector(nb, dim) vectors = gen_vector(nb, dim)
status, ids = connect.add_vectors(collection, vectors) status, ids = connect.insert(collection, vectors)
assert status.OK() assert status.OK()
status = connect.flush([collection]) status = connect.flush([collection])
assert status.OK() assert status.OK()
...@@ -127,7 +127,7 @@ class TestCollectionInfoBase: ...@@ -127,7 +127,7 @@ class TestCollectionInfoBase:
''' '''
vectors = gen_vectors(nb, dim) vectors = gen_vectors(nb, dim)
status = connect.create_partition(collection, tag) status = connect.create_partition(collection, tag)
status, ids = connect.add_vectors(collection, vectors, partition_tag=tag) status, ids = connect.insert(collection, vectors, partition_tag=tag)
assert status.OK() assert status.OK()
status = connect.flush([collection]) status = connect.flush([collection])
assert status.OK() assert status.OK()
...@@ -151,7 +151,7 @@ class TestCollectionInfoBase: ...@@ -151,7 +151,7 @@ class TestCollectionInfoBase:
assert status.OK() assert status.OK()
status = connect.create_partition(collection, new_tag) status = connect.create_partition(collection, new_tag)
assert status.OK() assert status.OK()
status, ids = connect.add_vectors(collection, vectors, partition_tag=tag) status, ids = connect.insert(collection, vectors, partition_tag=tag)
assert status.OK() assert status.OK()
status = connect.flush([collection]) status = connect.flush([collection])
assert status.OK() assert status.OK()
...@@ -177,9 +177,9 @@ class TestCollectionInfoBase: ...@@ -177,9 +177,9 @@ class TestCollectionInfoBase:
assert status.OK() assert status.OK()
status = connect.create_partition(collection, new_tag) status = connect.create_partition(collection, new_tag)
assert status.OK() assert status.OK()
status, ids = connect.add_vectors(collection, vectors, partition_tag=tag) status, ids = connect.insert(collection, vectors, partition_tag=tag)
assert status.OK() assert status.OK()
status, ids = connect.add_vectors(collection, vectors, partition_tag=new_tag) status, ids = connect.insert(collection, vectors, partition_tag=new_tag)
assert status.OK() assert status.OK()
status = connect.flush([collection]) status = connect.flush([collection])
assert status.OK() assert status.OK()
...@@ -214,7 +214,7 @@ class TestCollectionInfoBase: ...@@ -214,7 +214,7 @@ class TestCollectionInfoBase:
index_param = get_simple_index["index_param"] index_param = get_simple_index["index_param"]
index_type = get_simple_index["index_type"] index_type = get_simple_index["index_type"]
vectors = gen_vector(nb, dim) vectors = gen_vector(nb, dim)
status, ids = connect.add_vectors(collection, vectors) status, ids = connect.insert(collection, vectors)
assert status.OK() assert status.OK()
status = connect.flush([collection]) status = connect.flush([collection])
assert status.OK() assert status.OK()
...@@ -240,7 +240,7 @@ class TestCollectionInfoBase: ...@@ -240,7 +240,7 @@ class TestCollectionInfoBase:
index_param = get_simple_index["index_param"] index_param = get_simple_index["index_param"]
index_type = get_simple_index["index_type"] index_type = get_simple_index["index_type"]
vectors = gen_vector(nb, dim) vectors = gen_vector(nb, dim)
status, ids = connect.add_vectors(collection, vectors) status, ids = connect.insert(collection, vectors)
assert status.OK() assert status.OK()
status = connect.flush([collection]) status = connect.flush([collection])
assert status.OK() assert status.OK()
...@@ -264,7 +264,7 @@ class TestCollectionInfoBase: ...@@ -264,7 +264,7 @@ class TestCollectionInfoBase:
expected: status ok, index info shown in segments expected: status ok, index info shown in segments
''' '''
vectors = gen_vector(nb, dim) vectors = gen_vector(nb, dim)
status, ids = connect.add_vectors(collection, vectors) status, ids = connect.insert(collection, vectors)
assert status.OK() assert status.OK()
status = connect.flush([collection]) status = connect.flush([collection])
assert status.OK() assert status.OK()
......
...@@ -70,7 +70,7 @@ class TestCompactBase: ...@@ -70,7 +70,7 @@ class TestCompactBase:
expected: status ok, vector added expected: status ok, vector added
''' '''
vector = gen_single_vector(dim) vector = gen_single_vector(dim)
status, ids = connect.add_vectors(collection, vector) status, ids = connect.insert(collection, vector)
assert status.OK() assert status.OK()
status = connect.flush([collection]) status = connect.flush([collection])
assert status.OK() assert status.OK()
...@@ -88,14 +88,14 @@ class TestCompactBase: ...@@ -88,14 +88,14 @@ class TestCompactBase:
assert(size_before == size_after) assert(size_before == size_after)
@pytest.mark.timeout(COMPACT_TIMEOUT) @pytest.mark.timeout(COMPACT_TIMEOUT)
def test_add_vectors_and_compact(self, connect, collection): def test_insert_and_compact(self, connect, collection):
''' '''
target: test add vectors and compact target: test add vectors and compact
method: add vectors and compact collection method: add vectors and compact collection
expected: status ok, vectors added expected: status ok, vectors added
''' '''
vectors = gen_vector(nb, dim) vectors = gen_vector(nb, dim)
status, ids = connect.add_vectors(collection, vectors) status, ids = connect.insert(collection, vectors)
assert status.OK() assert status.OK()
status = connect.flush([collection]) status = connect.flush([collection])
assert status.OK() assert status.OK()
...@@ -112,14 +112,14 @@ class TestCompactBase: ...@@ -112,14 +112,14 @@ class TestCompactBase:
assert(size_before == size_after) assert(size_before == size_after)
@pytest.mark.timeout(COMPACT_TIMEOUT) @pytest.mark.timeout(COMPACT_TIMEOUT)
def test_add_vectors_delete_part_and_compact(self, connect, collection): def test_insert_delete_part_and_compact(self, connect, collection):
''' '''
target: test add vectors, delete part of them and compact target: test add vectors, delete part of them and compact
method: add vectors, delete a few and compact collection method: add vectors, delete a few and compact collection
expected: status ok, data size is smaller after compact expected: status ok, data size is smaller after compact
''' '''
vectors = gen_vector(nb, dim) vectors = gen_vector(nb, dim)
status, ids = connect.add_vectors(collection, vectors) status, ids = connect.insert(collection, vectors)
assert status.OK() assert status.OK()
status = connect.flush([collection]) status = connect.flush([collection])
assert status.OK() assert status.OK()
...@@ -145,14 +145,14 @@ class TestCompactBase: ...@@ -145,14 +145,14 @@ class TestCompactBase:
assert(size_before >= size_after) assert(size_before >= size_after)
@pytest.mark.timeout(COMPACT_TIMEOUT) @pytest.mark.timeout(COMPACT_TIMEOUT)
def test_add_vectors_delete_all_and_compact(self, connect, collection): def test_insert_delete_all_and_compact(self, connect, collection):
''' '''
target: test add vectors, delete them and compact target: test add vectors, delete them and compact
method: add vectors, delete all and compact collection method: add vectors, delete all and compact collection
expected: status ok, no data size in collection info because collection is empty expected: status ok, no data size in collection info because collection is empty
''' '''
vectors = gen_vector(nb, dim) vectors = gen_vector(nb, dim)
status, ids = connect.add_vectors(collection, vectors) status, ids = connect.insert(collection, vectors)
assert status.OK() assert status.OK()
status = connect.flush([collection]) status = connect.flush([collection])
assert status.OK() assert status.OK()
...@@ -193,7 +193,7 @@ class TestCompactBase: ...@@ -193,7 +193,7 @@ class TestCompactBase:
index_param = get_simple_index["index_param"] index_param = get_simple_index["index_param"]
index_type = get_simple_index["index_type"] index_type = get_simple_index["index_type"]
vectors = gen_vector(count, dim) vectors = gen_vector(count, dim)
status, ids = connect.add_vectors(collection, vectors) status, ids = connect.insert(collection, vectors)
assert status.OK() assert status.OK()
status = connect.flush([collection]) status = connect.flush([collection])
assert status.OK() assert status.OK()
...@@ -228,7 +228,7 @@ class TestCompactBase: ...@@ -228,7 +228,7 @@ class TestCompactBase:
expected: status ok, data size no change expected: status ok, data size no change
''' '''
vector = gen_single_vector(dim) vector = gen_single_vector(dim)
status, ids = connect.add_vectors(collection, vector) status, ids = connect.insert(collection, vector)
assert status.OK() assert status.OK()
status = connect.flush([collection]) status = connect.flush([collection])
assert status.OK() assert status.OK()
...@@ -254,14 +254,14 @@ class TestCompactBase: ...@@ -254,14 +254,14 @@ class TestCompactBase:
assert(size_after == size_after_twice) assert(size_after == size_after_twice)
@pytest.mark.timeout(COMPACT_TIMEOUT) @pytest.mark.timeout(COMPACT_TIMEOUT)
def test_add_vectors_delete_part_and_compact_twice(self, connect, collection): def test_insert_delete_part_and_compact_twice(self, connect, collection):
''' '''
target: test add vectors, delete part of them and compact twice target: test add vectors, delete part of them and compact twice
method: add vectors, delete part and compact collection twice method: add vectors, delete part and compact collection twice
expected: status ok, data size smaller after first compact, no change after second expected: status ok, data size smaller after first compact, no change after second
''' '''
vectors = gen_vector(nb, dim) vectors = gen_vector(nb, dim)
status, ids = connect.add_vectors(collection, vectors) status, ids = connect.insert(collection, vectors)
assert status.OK() assert status.OK()
status = connect.flush([collection]) status = connect.flush([collection])
assert status.OK() assert status.OK()
...@@ -310,7 +310,7 @@ class TestCompactBase: ...@@ -310,7 +310,7 @@ class TestCompactBase:
connect.create_collection(param) connect.create_collection(param)
time.sleep(6) time.sleep(6)
for i in range(num_collections): for i in range(num_collections):
status, ids = connect.add_vectors(collection_name=collection_list[i], records=vectors) status, ids = connect.insert(collection_name=collection_list[i], records=vectors)
assert status.OK() assert status.OK()
status = connect.compact(collection_list[i]) status = connect.compact(collection_list[i])
assert status.OK() assert status.OK()
...@@ -323,7 +323,7 @@ class TestCompactBase: ...@@ -323,7 +323,7 @@ class TestCompactBase:
expected: status ok, vector added expected: status ok, vector added
''' '''
vectors = gen_vector(nb, dim) vectors = gen_vector(nb, dim)
status, ids = connect.add_vectors(collection, vectors) status, ids = connect.insert(collection, vectors)
assert status.OK() assert status.OK()
status = connect.flush([collection]) status = connect.flush([collection])
assert status.OK() assert status.OK()
...@@ -339,7 +339,7 @@ class TestCompactBase: ...@@ -339,7 +339,7 @@ class TestCompactBase:
size_after = info["partitions"][0]["segments"][0]["data_size"] size_after = info["partitions"][0]["segments"][0]["data_size"]
assert(size_before == size_after) assert(size_before == size_after)
vector = gen_single_vector(dim) vector = gen_single_vector(dim)
status, ids = connect.add_vectors(collection, vector) status, ids = connect.insert(collection, vector)
assert status.OK() assert status.OK()
@pytest.mark.timeout(COMPACT_TIMEOUT) @pytest.mark.timeout(COMPACT_TIMEOUT)
...@@ -350,7 +350,7 @@ class TestCompactBase: ...@@ -350,7 +350,7 @@ class TestCompactBase:
expected: status ok, index description no change expected: status ok, index description no change
''' '''
vectors = gen_vector(nb, dim) vectors = gen_vector(nb, dim)
status, ids = connect.add_vectors(collection, vectors) status, ids = connect.insert(collection, vectors)
assert status.OK() assert status.OK()
status = connect.flush([collection]) status = connect.flush([collection])
assert status.OK() assert status.OK()
...@@ -376,7 +376,7 @@ class TestCompactBase: ...@@ -376,7 +376,7 @@ class TestCompactBase:
expected: status ok, vectors deleted expected: status ok, vectors deleted
''' '''
vectors = gen_vector(nb, dim) vectors = gen_vector(nb, dim)
status, ids = connect.add_vectors(collection, vectors) status, ids = connect.insert(collection, vectors)
assert status.OK() assert status.OK()
status = connect.flush([collection]) status = connect.flush([collection])
assert status.OK() assert status.OK()
...@@ -397,14 +397,14 @@ class TestCompactBase: ...@@ -397,14 +397,14 @@ class TestCompactBase:
expected: status ok expected: status ok
''' '''
vectors = gen_vector(nb, dim) vectors = gen_vector(nb, dim)
status, ids = connect.add_vectors(collection, vectors) status, ids = connect.insert(collection, vectors)
assert status.OK() assert status.OK()
status = connect.flush([collection]) status = connect.flush([collection])
assert status.OK() assert status.OK()
status = connect.compact(collection) status = connect.compact(collection)
assert status.OK() assert status.OK()
query_vecs = [vectors[0]] query_vecs = [vectors[0]]
status, res = connect.search_vectors(collection, top_k, query_records=query_vecs) status, res = connect.search(collection, top_k, query_records=query_vecs)
logging.getLogger().info(res) logging.getLogger().info(res)
assert status.OK() assert status.OK()
...@@ -416,7 +416,7 @@ class TestCompactBase: ...@@ -416,7 +416,7 @@ class TestCompactBase:
expected: status ok, request recovered expected: status ok, request recovered
''' '''
vectors = gen_vector(nb * 100, dim) vectors = gen_vector(nb * 100, dim)
status, ids = connect.add_vectors(collection, vectors) status, ids = connect.insert(collection, vectors)
assert status.OK() assert status.OK()
status = connect.flush([collection]) status = connect.flush([collection])
assert status.OK() assert status.OK()
...@@ -450,7 +450,7 @@ class TestCompactJAC: ...@@ -450,7 +450,7 @@ class TestCompactJAC:
expected: status ok, vector added expected: status ok, vector added
''' '''
tmp, vector = gen_binary_vectors(1, dim) tmp, vector = gen_binary_vectors(1, dim)
status, ids = connect.add_vectors(jac_collection, vector) status, ids = connect.insert(jac_collection, vector)
assert status.OK() assert status.OK()
status = connect.flush([jac_collection]) status = connect.flush([jac_collection])
assert status.OK() assert status.OK()
...@@ -467,14 +467,14 @@ class TestCompactJAC: ...@@ -467,14 +467,14 @@ class TestCompactJAC:
assert(size_before == size_after) assert(size_before == size_after)
@pytest.mark.timeout(COMPACT_TIMEOUT) @pytest.mark.timeout(COMPACT_TIMEOUT)
def test_add_vectors_and_compact(self, connect, jac_collection): def test_insert_and_compact(self, connect, jac_collection):
''' '''
target: test add vectors and compact target: test add vectors and compact
method: add vectors and compact collection method: add vectors and compact collection
expected: status ok, vectors added expected: status ok, vectors added
''' '''
tmp, vectors = gen_binary_vectors(nb, dim) tmp, vectors = gen_binary_vectors(nb, dim)
status, ids = connect.add_vectors(jac_collection, vectors) status, ids = connect.insert(jac_collection, vectors)
assert status.OK() assert status.OK()
status = connect.flush([jac_collection]) status = connect.flush([jac_collection])
assert status.OK() assert status.OK()
...@@ -491,14 +491,14 @@ class TestCompactJAC: ...@@ -491,14 +491,14 @@ class TestCompactJAC:
assert(size_before == size_after) assert(size_before == size_after)
@pytest.mark.timeout(COMPACT_TIMEOUT) @pytest.mark.timeout(COMPACT_TIMEOUT)
def test_add_vectors_delete_part_and_compact(self, connect, jac_collection): def test_insert_delete_part_and_compact(self, connect, jac_collection):
''' '''
target: test add vectors, delete part of them and compact target: test add vectors, delete part of them and compact
method: add vectors, delete a few and compact collection method: add vectors, delete a few and compact collection
expected: status ok, data size is smaller after compact expected: status ok, data size is smaller after compact
''' '''
tmp, vectors = gen_binary_vectors(nb, dim) tmp, vectors = gen_binary_vectors(nb, dim)
status, ids = connect.add_vectors(jac_collection, vectors) status, ids = connect.insert(jac_collection, vectors)
assert status.OK() assert status.OK()
status = connect.flush([jac_collection]) status = connect.flush([jac_collection])
assert status.OK() assert status.OK()
...@@ -524,14 +524,14 @@ class TestCompactJAC: ...@@ -524,14 +524,14 @@ class TestCompactJAC:
assert(size_before >= size_after) assert(size_before >= size_after)
@pytest.mark.timeout(COMPACT_TIMEOUT) @pytest.mark.timeout(COMPACT_TIMEOUT)
def test_add_vectors_delete_all_and_compact(self, connect, jac_collection): def test_insert_delete_all_and_compact(self, connect, jac_collection):
''' '''
target: test add vectors, delete them and compact target: test add vectors, delete them and compact
method: add vectors, delete all and compact collection method: add vectors, delete all and compact collection
expected: status ok, no data size in collection info because collection is empty expected: status ok, no data size in collection info because collection is empty
''' '''
tmp, vectors = gen_binary_vectors(nb, dim) tmp, vectors = gen_binary_vectors(nb, dim)
status, ids = connect.add_vectors(jac_collection, vectors) status, ids = connect.insert(jac_collection, vectors)
assert status.OK() assert status.OK()
status = connect.flush([jac_collection]) status = connect.flush([jac_collection])
assert status.OK() assert status.OK()
...@@ -558,7 +558,7 @@ class TestCompactJAC: ...@@ -558,7 +558,7 @@ class TestCompactJAC:
expected: status ok expected: status ok
''' '''
tmp, vector = gen_binary_vectors(1, dim) tmp, vector = gen_binary_vectors(1, dim)
status, ids = connect.add_vectors(jac_collection, vector) status, ids = connect.insert(jac_collection, vector)
assert status.OK() assert status.OK()
status = connect.flush([jac_collection]) status = connect.flush([jac_collection])
assert status.OK() assert status.OK()
...@@ -582,14 +582,14 @@ class TestCompactJAC: ...@@ -582,14 +582,14 @@ class TestCompactJAC:
assert(size_after == size_after_twice) assert(size_after == size_after_twice)
@pytest.mark.timeout(COMPACT_TIMEOUT) @pytest.mark.timeout(COMPACT_TIMEOUT)
def test_add_vectors_delete_part_and_compact_twice(self, connect, jac_collection): def test_insert_delete_part_and_compact_twice(self, connect, jac_collection):
''' '''
target: test add vectors, delete part of them and compact twice target: test add vectors, delete part of them and compact twice
method: add vectors, delete part and compact collection twice method: add vectors, delete part and compact collection twice
expected: status ok, data size smaller after first compact, no change after second expected: status ok, data size smaller after first compact, no change after second
''' '''
tmp, vectors = gen_binary_vectors(nb, dim) tmp, vectors = gen_binary_vectors(nb, dim)
status, ids = connect.add_vectors(jac_collection, vectors) status, ids = connect.insert(jac_collection, vectors)
assert status.OK() assert status.OK()
status = connect.flush([jac_collection]) status = connect.flush([jac_collection])
assert status.OK() assert status.OK()
...@@ -638,7 +638,7 @@ class TestCompactJAC: ...@@ -638,7 +638,7 @@ class TestCompactJAC:
connect.create_collection(param) connect.create_collection(param)
time.sleep(6) time.sleep(6)
for i in range(num_collections): for i in range(num_collections):
status, ids = connect.add_vectors(collection_name=collection_list[i], records=vectors) status, ids = connect.insert(collection_name=collection_list[i], records=vectors)
assert status.OK() assert status.OK()
status = connect.delete_entity_by_id(collection_list[i], [ids[0], ids[-1]]) status = connect.delete_entity_by_id(collection_list[i], [ids[0], ids[-1]])
assert status.OK() assert status.OK()
...@@ -655,7 +655,7 @@ class TestCompactJAC: ...@@ -655,7 +655,7 @@ class TestCompactJAC:
expected: status ok, vector added expected: status ok, vector added
''' '''
tmp, vectors = gen_binary_vectors(nb, dim) tmp, vectors = gen_binary_vectors(nb, dim)
status, ids = connect.add_vectors(jac_collection, vectors) status, ids = connect.insert(jac_collection, vectors)
assert status.OK() assert status.OK()
status = connect.flush([jac_collection]) status = connect.flush([jac_collection])
assert status.OK() assert status.OK()
...@@ -671,7 +671,7 @@ class TestCompactJAC: ...@@ -671,7 +671,7 @@ class TestCompactJAC:
size_after = info["partitions"][0]["segments"][0]["data_size"] size_after = info["partitions"][0]["segments"][0]["data_size"]
assert(size_before == size_after) assert(size_before == size_after)
tmp, vector = gen_binary_vectors(1, dim) tmp, vector = gen_binary_vectors(1, dim)
status, ids = connect.add_vectors(jac_collection, vector) status, ids = connect.insert(jac_collection, vector)
assert status.OK() assert status.OK()
@pytest.mark.timeout(COMPACT_TIMEOUT) @pytest.mark.timeout(COMPACT_TIMEOUT)
...@@ -682,7 +682,7 @@ class TestCompactJAC: ...@@ -682,7 +682,7 @@ class TestCompactJAC:
expected: status ok, vectors deleted expected: status ok, vectors deleted
''' '''
tmp, vectors = gen_binary_vectors(nb, dim) tmp, vectors = gen_binary_vectors(nb, dim)
status, ids = connect.add_vectors(jac_collection, vectors) status, ids = connect.insert(jac_collection, vectors)
assert status.OK() assert status.OK()
status = connect.flush([jac_collection]) status = connect.flush([jac_collection])
assert status.OK() assert status.OK()
...@@ -703,14 +703,14 @@ class TestCompactJAC: ...@@ -703,14 +703,14 @@ class TestCompactJAC:
expected: status ok expected: status ok
''' '''
tmp, vectors = gen_binary_vectors(nb, dim) tmp, vectors = gen_binary_vectors(nb, dim)
status, ids = connect.add_vectors(jac_collection, vectors) status, ids = connect.insert(jac_collection, vectors)
assert status.OK() assert status.OK()
status = connect.flush([jac_collection]) status = connect.flush([jac_collection])
assert status.OK() assert status.OK()
status = connect.compact(jac_collection) status = connect.compact(jac_collection)
assert status.OK() assert status.OK()
query_vecs = [vectors[0]] query_vecs = [vectors[0]]
status, res = connect.search_vectors(jac_collection, top_k, query_records=query_vecs) status, res = connect.search(jac_collection, top_k, query_records=query_vecs)
logging.getLogger().info(res) logging.getLogger().info(res)
assert status.OK() assert status.OK()
...@@ -729,7 +729,7 @@ class TestCompactIP: ...@@ -729,7 +729,7 @@ class TestCompactIP:
expected: status ok, vector added expected: status ok, vector added
''' '''
vector = gen_single_vector(dim) vector = gen_single_vector(dim)
status, ids = connect.add_vectors(ip_collection, vector) status, ids = connect.insert(ip_collection, vector)
assert status.OK() assert status.OK()
status = connect.flush([ip_collection]) status = connect.flush([ip_collection])
assert status.OK() assert status.OK()
...@@ -748,14 +748,14 @@ class TestCompactIP: ...@@ -748,14 +748,14 @@ class TestCompactIP:
assert(size_before == size_after) assert(size_before == size_after)
@pytest.mark.timeout(COMPACT_TIMEOUT) @pytest.mark.timeout(COMPACT_TIMEOUT)
def test_add_vectors_and_compact(self, connect, ip_collection): def test_insert_and_compact(self, connect, ip_collection):
''' '''
target: test add vectors and compact target: test add vectors and compact
method: add vectors and compact collection method: add vectors and compact collection
expected: status ok, vectors added expected: status ok, vectors added
''' '''
vectors = gen_vector(nb, dim) vectors = gen_vector(nb, dim)
status, ids = connect.add_vectors(ip_collection, vectors) status, ids = connect.insert(ip_collection, vectors)
assert status.OK() assert status.OK()
status = connect.flush([ip_collection]) status = connect.flush([ip_collection])
assert status.OK() assert status.OK()
...@@ -772,14 +772,14 @@ class TestCompactIP: ...@@ -772,14 +772,14 @@ class TestCompactIP:
assert(size_before == size_after) assert(size_before == size_after)
@pytest.mark.timeout(COMPACT_TIMEOUT) @pytest.mark.timeout(COMPACT_TIMEOUT)
def test_add_vectors_delete_part_and_compact(self, connect, ip_collection): def test_insert_delete_part_and_compact(self, connect, ip_collection):
''' '''
target: test add vectors, delete part of them and compact target: test add vectors, delete part of them and compact
method: add vectors, delete a few and compact collection method: add vectors, delete a few and compact collection
expected: status ok, data size is smaller after compact expected: status ok, data size is smaller after compact
''' '''
vectors = gen_vector(nb, dim) vectors = gen_vector(nb, dim)
status, ids = connect.add_vectors(ip_collection, vectors) status, ids = connect.insert(ip_collection, vectors)
assert status.OK() assert status.OK()
status = connect.flush([ip_collection]) status = connect.flush([ip_collection])
assert status.OK() assert status.OK()
...@@ -805,14 +805,14 @@ class TestCompactIP: ...@@ -805,14 +805,14 @@ class TestCompactIP:
assert(size_before >= size_after) assert(size_before >= size_after)
@pytest.mark.timeout(COMPACT_TIMEOUT) @pytest.mark.timeout(COMPACT_TIMEOUT)
def test_add_vectors_delete_all_and_compact(self, connect, ip_collection): def test_insert_delete_all_and_compact(self, connect, ip_collection):
''' '''
target: test add vectors, delete them and compact target: test add vectors, delete them and compact
method: add vectors, delete all and compact collection method: add vectors, delete all and compact collection
expected: status ok, no data size in collection info because collection is empty expected: status ok, no data size in collection info because collection is empty
''' '''
vectors = gen_vector(nb, dim) vectors = gen_vector(nb, dim)
status, ids = connect.add_vectors(ip_collection, vectors) status, ids = connect.insert(ip_collection, vectors)
assert status.OK() assert status.OK()
status = connect.flush([ip_collection]) status = connect.flush([ip_collection])
assert status.OK() assert status.OK()
...@@ -839,7 +839,7 @@ class TestCompactIP: ...@@ -839,7 +839,7 @@ class TestCompactIP:
expected: status ok expected: status ok
''' '''
vector = gen_single_vector(dim) vector = gen_single_vector(dim)
status, ids = connect.add_vectors(ip_collection, vector) status, ids = connect.insert(ip_collection, vector)
assert status.OK() assert status.OK()
status = connect.flush([ip_collection]) status = connect.flush([ip_collection])
assert status.OK() assert status.OK()
...@@ -863,14 +863,14 @@ class TestCompactIP: ...@@ -863,14 +863,14 @@ class TestCompactIP:
assert(size_after == size_after_twice) assert(size_after == size_after_twice)
@pytest.mark.timeout(COMPACT_TIMEOUT) @pytest.mark.timeout(COMPACT_TIMEOUT)
def test_add_vectors_delete_part_and_compact_twice(self, connect, ip_collection): def test_insert_delete_part_and_compact_twice(self, connect, ip_collection):
''' '''
target: test add vectors, delete part of them and compact twice target: test add vectors, delete part of them and compact twice
method: add vectors, delete part and compact collection twice method: add vectors, delete part and compact collection twice
expected: status ok, data size smaller after first compact, no change after second expected: status ok, data size smaller after first compact, no change after second
''' '''
vectors = gen_vector(nb, dim) vectors = gen_vector(nb, dim)
status, ids = connect.add_vectors(ip_collection, vectors) status, ids = connect.insert(ip_collection, vectors)
assert status.OK() assert status.OK()
status = connect.flush([ip_collection]) status = connect.flush([ip_collection])
assert status.OK() assert status.OK()
...@@ -923,7 +923,7 @@ class TestCompactIP: ...@@ -923,7 +923,7 @@ class TestCompactIP:
connect.create_collection(param) connect.create_collection(param)
time.sleep(6) time.sleep(6)
for i in range(num_collections): for i in range(num_collections):
status, ids = connect.add_vectors(collection_name=collection_list[i], records=vectors) status, ids = connect.insert(collection_name=collection_list[i], records=vectors)
assert status.OK() assert status.OK()
status = connect.compact(collection_list[i]) status = connect.compact(collection_list[i])
assert status.OK() assert status.OK()
...@@ -936,7 +936,7 @@ class TestCompactIP: ...@@ -936,7 +936,7 @@ class TestCompactIP:
expected: status ok, vector added expected: status ok, vector added
''' '''
vectors = gen_vector(nb, dim) vectors = gen_vector(nb, dim)
status, ids = connect.add_vectors(ip_collection, vectors) status, ids = connect.insert(ip_collection, vectors)
assert status.OK() assert status.OK()
status = connect.flush([ip_collection]) status = connect.flush([ip_collection])
assert status.OK() assert status.OK()
...@@ -952,7 +952,7 @@ class TestCompactIP: ...@@ -952,7 +952,7 @@ class TestCompactIP:
size_after = info["partitions"][0]["segments"][0]["data_size"] size_after = info["partitions"][0]["segments"][0]["data_size"]
assert(size_before == size_after) assert(size_before == size_after)
vector = gen_single_vector(dim) vector = gen_single_vector(dim)
status, ids = connect.add_vectors(ip_collection, vector) status, ids = connect.insert(ip_collection, vector)
assert status.OK() assert status.OK()
@pytest.mark.timeout(COMPACT_TIMEOUT) @pytest.mark.timeout(COMPACT_TIMEOUT)
...@@ -963,7 +963,7 @@ class TestCompactIP: ...@@ -963,7 +963,7 @@ class TestCompactIP:
expected: status ok, vectors deleted expected: status ok, vectors deleted
''' '''
vectors = gen_vector(nb, dim) vectors = gen_vector(nb, dim)
status, ids = connect.add_vectors(ip_collection, vectors) status, ids = connect.insert(ip_collection, vectors)
assert status.OK() assert status.OK()
status = connect.flush([ip_collection]) status = connect.flush([ip_collection])
assert status.OK() assert status.OK()
...@@ -982,13 +982,13 @@ class TestCompactIP: ...@@ -982,13 +982,13 @@ class TestCompactIP:
expected: status ok expected: status ok
''' '''
vectors = gen_vector(nb, dim) vectors = gen_vector(nb, dim)
status, ids = connect.add_vectors(ip_collection, vectors) status, ids = connect.insert(ip_collection, vectors)
assert status.OK() assert status.OK()
status = connect.flush([ip_collection]) status = connect.flush([ip_collection])
assert status.OK() assert status.OK()
status = connect.compact(ip_collection) status = connect.compact(ip_collection)
assert status.OK() assert status.OK()
query_vecs = [vectors[0]] query_vecs = [vectors[0]]
status, res = connect.search_vectors(ip_collection, top_k, query_records=query_vecs) status, res = connect.search(ip_collection, top_k, query_records=query_vecs)
logging.getLogger().info(res) logging.getLogger().info(res)
assert status.OK() assert status.OK()
...@@ -48,7 +48,7 @@ class TestDeleteBase: ...@@ -48,7 +48,7 @@ class TestDeleteBase:
index_param = get_simple_index["index_param"] index_param = get_simple_index["index_param"]
index_type = get_simple_index["index_type"] index_type = get_simple_index["index_type"]
vector = gen_single_vector(dim) vector = gen_single_vector(dim)
status, ids = connect.add_vectors(collection, vector) status, ids = connect.insert(collection, vector)
assert status.OK() assert status.OK()
status = connect.flush([collection]) status = connect.flush([collection])
assert status.OK() assert status.OK()
...@@ -58,7 +58,7 @@ class TestDeleteBase: ...@@ -58,7 +58,7 @@ class TestDeleteBase:
search_param = get_search_param(index_type) search_param = get_search_param(index_type)
status = connect.flush([collection]) status = connect.flush([collection])
search_param = get_search_param(index_type) search_param = get_search_param(index_type)
status, res = connect.search_vectors(collection, top_k, vector, params=search_param) status, res = connect.search(collection, top_k, vector, params=search_param)
logging.getLogger().info(res) logging.getLogger().info(res)
assert status.OK() assert status.OK()
assert len(res) == 0 assert len(res) == 0
...@@ -72,7 +72,7 @@ class TestDeleteBase: ...@@ -72,7 +72,7 @@ class TestDeleteBase:
index_param = get_simple_index["index_param"] index_param = get_simple_index["index_param"]
index_type = get_simple_index["index_type"] index_type = get_simple_index["index_type"]
vectors = gen_vectors(nb, dim) vectors = gen_vectors(nb, dim)
connect.add_vectors(collection, vectors, ids=[1 for i in range(nb)]) connect.insert(collection, vectors, ids=[1 for i in range(nb)])
status = connect.flush([collection]) status = connect.flush([collection])
# Bloom filter error # Bloom filter error
assert status.OK() assert status.OK()
...@@ -80,7 +80,7 @@ class TestDeleteBase: ...@@ -80,7 +80,7 @@ class TestDeleteBase:
assert status.OK() assert status.OK()
status = connect.flush([collection]) status = connect.flush([collection])
search_param = get_search_param(index_type) search_param = get_search_param(index_type)
status, res = connect.search_vectors(collection, top_k, [vectors[0]], params=search_param) status, res = connect.search(collection, top_k, [vectors[0]], params=search_param)
logging.getLogger().info(res) logging.getLogger().info(res)
assert status.OK() assert status.OK()
assert len(res) == 0 assert len(res) == 0
...@@ -92,7 +92,7 @@ class TestDeleteBase: ...@@ -92,7 +92,7 @@ class TestDeleteBase:
expected: status ok, vector deleted expected: status ok, vector deleted
''' '''
vector = gen_single_vector(dim) vector = gen_single_vector(dim)
status, ids = connect.add_vectors(collection, vector) status, ids = connect.insert(collection, vector)
assert status.OK() assert status.OK()
status = connect.flush([collection]) status = connect.flush([collection])
assert status.OK() assert status.OK()
...@@ -110,7 +110,7 @@ class TestDeleteBase: ...@@ -110,7 +110,7 @@ class TestDeleteBase:
expected: status ok, vector deleted expected: status ok, vector deleted
''' '''
vector = gen_single_vector(dim) vector = gen_single_vector(dim)
status, ids = connect.add_vectors(collection, vector) status, ids = connect.insert(collection, vector)
assert status.OK() assert status.OK()
status = connect.flush([collection]) status = connect.flush([collection])
assert status.OK() assert status.OK()
...@@ -132,7 +132,7 @@ class TestDeleteBase: ...@@ -132,7 +132,7 @@ class TestDeleteBase:
index_param = get_simple_index["index_param"] index_param = get_simple_index["index_param"]
index_type = get_simple_index["index_type"] index_type = get_simple_index["index_type"]
vector = gen_single_vector(dim) vector = gen_single_vector(dim)
status, ids = connect.add_vectors(collection, vector) status, ids = connect.insert(collection, vector)
assert status.OK() assert status.OK()
status = connect.flush([collection]) status = connect.flush([collection])
assert status.OK() assert status.OK()
...@@ -140,7 +140,7 @@ class TestDeleteBase: ...@@ -140,7 +140,7 @@ class TestDeleteBase:
assert status.OK() assert status.OK()
status = connect.flush([collection]) status = connect.flush([collection])
search_param = get_search_param(index_type) search_param = get_search_param(index_type)
status, res = connect.search_vectors(collection, top_k, vector, params=search_param) status, res = connect.search(collection, top_k, vector, params=search_param)
assert status.OK() assert status.OK()
assert res[0][0].id == ids[0] assert res[0][0].id == ids[0]
...@@ -151,7 +151,7 @@ class TestDeleteBase: ...@@ -151,7 +151,7 @@ class TestDeleteBase:
expected: status not ok expected: status not ok
''' '''
vector = gen_single_vector(dim) vector = gen_single_vector(dim)
status, ids = connect.add_vectors(collection, vector) status, ids = connect.insert(collection, vector)
assert status.OK() assert status.OK()
status = connect.flush([collection]) status = connect.flush([collection])
assert status.OK() assert status.OK()
...@@ -159,7 +159,7 @@ class TestDeleteBase: ...@@ -159,7 +159,7 @@ class TestDeleteBase:
status = connect.delete_entity_by_id(collection_new, [0]) status = connect.delete_entity_by_id(collection_new, [0])
assert not status.OK() assert not status.OK()
def test_add_vectors_delete_vector(self, connect, collection, get_simple_index): def test_insert_delete_vector(self, connect, collection, get_simple_index):
''' '''
method: add vectors and delete method: add vectors and delete
expected: status ok, vectors deleted expected: status ok, vectors deleted
...@@ -167,7 +167,7 @@ class TestDeleteBase: ...@@ -167,7 +167,7 @@ class TestDeleteBase:
index_param = get_simple_index["index_param"] index_param = get_simple_index["index_param"]
index_type = get_simple_index["index_type"] index_type = get_simple_index["index_type"]
vectors = gen_vector(nb, dim) vectors = gen_vector(nb, dim)
status, ids = connect.add_vectors(collection, vectors) status, ids = connect.insert(collection, vectors)
assert status.OK() assert status.OK()
status = connect.flush([collection]) status = connect.flush([collection])
assert status.OK() assert status.OK()
...@@ -177,7 +177,7 @@ class TestDeleteBase: ...@@ -177,7 +177,7 @@ class TestDeleteBase:
assert status.OK() assert status.OK()
status = connect.flush([collection]) status = connect.flush([collection])
search_param = get_search_param(index_type) search_param = get_search_param(index_type)
status, res = connect.search_vectors(collection, top_k, query_vecs, params=search_param) status, res = connect.search(collection, top_k, query_vecs, params=search_param)
assert status.OK() assert status.OK()
logging.getLogger().info(res) logging.getLogger().info(res)
assert res[0][0].distance > epsilon assert res[0][0].distance > epsilon
...@@ -193,7 +193,7 @@ class TestDeleteBase: ...@@ -193,7 +193,7 @@ class TestDeleteBase:
index_param = get_simple_index["index_param"] index_param = get_simple_index["index_param"]
index_type = get_simple_index["index_type"] index_type = get_simple_index["index_type"]
vectors = gen_vector(nb, dim) vectors = gen_vector(nb, dim)
status, ids = connect.add_vectors(collection, vectors) status, ids = connect.insert(collection, vectors)
assert status.OK() assert status.OK()
status = connect.flush([collection]) status = connect.flush([collection])
assert status.OK() assert status.OK()
...@@ -205,7 +205,7 @@ class TestDeleteBase: ...@@ -205,7 +205,7 @@ class TestDeleteBase:
status = connect.create_index(collection, index_type, index_param) status = connect.create_index(collection, index_type, index_param)
assert status.OK() assert status.OK()
search_param = get_search_param(index_type) search_param = get_search_param(index_type)
status, res = connect.search_vectors(collection, top_k, query_vecs, params=search_param) status, res = connect.search(collection, top_k, query_vecs, params=search_param)
assert status.OK() assert status.OK()
logging.getLogger().info(res) logging.getLogger().info(res)
logging.getLogger().info(ids[0]) logging.getLogger().info(ids[0])
...@@ -223,7 +223,7 @@ class TestDeleteBase: ...@@ -223,7 +223,7 @@ class TestDeleteBase:
index_param = get_simple_index["index_param"] index_param = get_simple_index["index_param"]
index_type = get_simple_index["index_type"] index_type = get_simple_index["index_type"]
vectors = gen_vector(nb, dim) vectors = gen_vector(nb, dim)
status, ids = connect.add_vectors(collection, vectors) status, ids = connect.insert(collection, vectors)
assert status.OK() assert status.OK()
status = connect.flush([collection]) status = connect.flush([collection])
assert status.OK() assert status.OK()
...@@ -234,11 +234,11 @@ class TestDeleteBase: ...@@ -234,11 +234,11 @@ class TestDeleteBase:
status = connect.delete_entity_by_id(collection, delete_ids) status = connect.delete_entity_by_id(collection, delete_ids)
assert status.OK() assert status.OK()
status = connect.flush([collection]) status = connect.flush([collection])
status, tmp_ids = connect.add_vectors(collection, [vectors[0], vectors[-1]]) status, tmp_ids = connect.insert(collection, [vectors[0], vectors[-1]])
assert status.OK() assert status.OK()
status = connect.flush([collection]) status = connect.flush([collection])
search_param = get_search_param(index_type) search_param = get_search_param(index_type)
status, res = connect.search_vectors(collection, top_k, query_vecs, params=search_param) status, res = connect.search(collection, top_k, query_vecs, params=search_param)
assert status.OK() assert status.OK()
logging.getLogger().info(res) logging.getLogger().info(res)
assert res[0][0].id == tmp_ids[0] assert res[0][0].id == tmp_ids[0]
...@@ -253,7 +253,7 @@ class TestDeleteBase: ...@@ -253,7 +253,7 @@ class TestDeleteBase:
expected: status ok, vectors deleted, and status ok for next delete operation expected: status ok, vectors deleted, and status ok for next delete operation
''' '''
vectors = gen_vector(nb, dim) vectors = gen_vector(nb, dim)
status, ids = connect.add_vectors(collection, vectors) status, ids = connect.insert(collection, vectors)
assert status.OK() assert status.OK()
status = connect.flush([collection]) status = connect.flush([collection])
assert status.OK() assert status.OK()
...@@ -272,7 +272,7 @@ class TestDeleteBase: ...@@ -272,7 +272,7 @@ class TestDeleteBase:
expected: status ok, vectors deleted, and status ok for next delete operation expected: status ok, vectors deleted, and status ok for next delete operation
''' '''
vectors = gen_vector(nb, dim) vectors = gen_vector(nb, dim)
status, ids = connect.add_vectors(collection, vectors) status, ids = connect.insert(collection, vectors)
assert status.OK() assert status.OK()
status = connect.flush([collection]) status = connect.flush([collection])
assert status.OK() assert status.OK()
...@@ -314,7 +314,7 @@ class TestDeleteIndexedVectors: ...@@ -314,7 +314,7 @@ class TestDeleteIndexedVectors:
index_param = get_simple_index["index_param"] index_param = get_simple_index["index_param"]
index_type = get_simple_index["index_type"] index_type = get_simple_index["index_type"]
vector = gen_single_vector(dim) vector = gen_single_vector(dim)
status, ids = connect.add_vectors(collection, vector) status, ids = connect.insert(collection, vector)
assert status.OK() assert status.OK()
status = connect.flush([collection]) status = connect.flush([collection])
assert status.OK() assert status.OK()
...@@ -324,12 +324,12 @@ class TestDeleteIndexedVectors: ...@@ -324,12 +324,12 @@ class TestDeleteIndexedVectors:
assert status.OK() assert status.OK()
status = connect.flush([collection]) status = connect.flush([collection])
search_param = get_search_param(index_type) search_param = get_search_param(index_type)
status, res = connect.search_vectors(collection, top_k, vector, params=search_param) status, res = connect.search(collection, top_k, vector, params=search_param)
logging.getLogger().info(res) logging.getLogger().info(res)
assert status.OK() assert status.OK()
assert len(res) == 0 assert len(res) == 0
def test_add_vectors_delete_vector(self, connect, collection, get_simple_index): def test_insert_delete_vector(self, connect, collection, get_simple_index):
''' '''
method: add vectors and delete method: add vectors and delete
expected: status ok, vectors deleted expected: status ok, vectors deleted
...@@ -337,7 +337,7 @@ class TestDeleteIndexedVectors: ...@@ -337,7 +337,7 @@ class TestDeleteIndexedVectors:
index_param = get_simple_index["index_param"] index_param = get_simple_index["index_param"]
index_type = get_simple_index["index_type"] index_type = get_simple_index["index_type"]
vectors = gen_vector(nb, dim) vectors = gen_vector(nb, dim)
status, ids = connect.add_vectors(collection, vectors) status, ids = connect.insert(collection, vectors)
assert status.OK() assert status.OK()
status = connect.flush([collection]) status = connect.flush([collection])
assert status.OK() assert status.OK()
...@@ -351,7 +351,7 @@ class TestDeleteIndexedVectors: ...@@ -351,7 +351,7 @@ class TestDeleteIndexedVectors:
assert status.OK() assert status.OK()
status = connect.flush([collection]) status = connect.flush([collection])
search_param = get_search_param(index_type) search_param = get_search_param(index_type)
status, res = connect.search_vectors(collection, top_k, query_vecs, params=search_param) status, res = connect.search(collection, top_k, query_vecs, params=search_param)
assert status.OK() assert status.OK()
logging.getLogger().info(ids[0]) logging.getLogger().info(ids[0])
logging.getLogger().info(ids[1]) logging.getLogger().info(ids[1])
...@@ -388,7 +388,7 @@ class TestDeleteBinary: ...@@ -388,7 +388,7 @@ class TestDeleteBinary:
index_param = get_simple_index["index_param"] index_param = get_simple_index["index_param"]
index_type = get_simple_index["index_type"] index_type = get_simple_index["index_type"]
tmp, vector = gen_binary_vectors(1, dim) tmp, vector = gen_binary_vectors(1, dim)
status, ids = connect.add_vectors(jac_collection, vector) status, ids = connect.insert(jac_collection, vector)
assert status.OK() assert status.OK()
status = connect.flush([jac_collection]) status = connect.flush([jac_collection])
assert status.OK() assert status.OK()
...@@ -396,7 +396,7 @@ class TestDeleteBinary: ...@@ -396,7 +396,7 @@ class TestDeleteBinary:
assert status.OK() assert status.OK()
status = connect.flush([jac_collection]) status = connect.flush([jac_collection])
search_param = get_search_param(index_type) search_param = get_search_param(index_type)
status, res = connect.search_vectors(jac_collection, top_k, vector, params=search_param) status, res = connect.search(jac_collection, top_k, vector, params=search_param)
logging.getLogger().info(res) logging.getLogger().info(res)
assert status.OK() assert status.OK()
assert len(res) == 0 assert len(res) == 0
...@@ -411,7 +411,7 @@ class TestDeleteBinary: ...@@ -411,7 +411,7 @@ class TestDeleteBinary:
expected: status ok, vector deleted expected: status ok, vector deleted
''' '''
tmp, vector = gen_binary_vectors(1, dim) tmp, vector = gen_binary_vectors(1, dim)
status, ids = connect.add_vectors(jac_collection, vector) status, ids = connect.insert(jac_collection, vector)
assert status.OK() assert status.OK()
status = connect.flush([jac_collection]) status = connect.flush([jac_collection])
assert status.OK() assert status.OK()
...@@ -431,7 +431,7 @@ class TestDeleteBinary: ...@@ -431,7 +431,7 @@ class TestDeleteBinary:
index_param = get_simple_index["index_param"] index_param = get_simple_index["index_param"]
index_type = get_simple_index["index_type"] index_type = get_simple_index["index_type"]
tmp, vector = gen_binary_vectors(1, dim) tmp, vector = gen_binary_vectors(1, dim)
status, ids = connect.add_vectors(jac_collection, vector) status, ids = connect.insert(jac_collection, vector)
assert status.OK() assert status.OK()
status = connect.flush([jac_collection]) status = connect.flush([jac_collection])
assert status.OK() assert status.OK()
...@@ -440,7 +440,7 @@ class TestDeleteBinary: ...@@ -440,7 +440,7 @@ class TestDeleteBinary:
status = connect.flush([jac_collection]) status = connect.flush([jac_collection])
status = connect.flush([jac_collection]) status = connect.flush([jac_collection])
search_param = get_search_param(index_type) search_param = get_search_param(index_type)
status, res = connect.search_vectors(jac_collection, top_k, vector, params=search_param) status, res = connect.search(jac_collection, top_k, vector, params=search_param)
assert status.OK() assert status.OK()
assert res[0][0].id == ids[0] assert res[0][0].id == ids[0]
...@@ -451,7 +451,7 @@ class TestDeleteBinary: ...@@ -451,7 +451,7 @@ class TestDeleteBinary:
expected: status not ok expected: status not ok
''' '''
tmp, vector = gen_binary_vectors(1, dim) tmp, vector = gen_binary_vectors(1, dim)
status, ids = connect.add_vectors(jac_collection, vector) status, ids = connect.insert(jac_collection, vector)
assert status.OK() assert status.OK()
status = connect.flush([jac_collection]) status = connect.flush([jac_collection])
assert status.OK() assert status.OK()
...@@ -461,7 +461,7 @@ class TestDeleteBinary: ...@@ -461,7 +461,7 @@ class TestDeleteBinary:
status = connect.delete_entity_by_id(collection_new, [0]) status = connect.delete_entity_by_id(collection_new, [0])
assert not status.OK() assert not status.OK()
def test_add_vectors_delete_vector(self, connect, jac_collection, get_simple_index): def test_insert_delete_vector(self, connect, jac_collection, get_simple_index):
''' '''
method: add vectors and delete method: add vectors and delete
expected: status ok, vectors deleted expected: status ok, vectors deleted
...@@ -469,7 +469,7 @@ class TestDeleteBinary: ...@@ -469,7 +469,7 @@ class TestDeleteBinary:
index_param = get_simple_index["index_param"] index_param = get_simple_index["index_param"]
index_type = get_simple_index["index_type"] index_type = get_simple_index["index_type"]
tmp, vectors = gen_binary_vectors(nb, dim) tmp, vectors = gen_binary_vectors(nb, dim)
status, ids = connect.add_vectors(jac_collection, vectors) status, ids = connect.insert(jac_collection, vectors)
assert status.OK() assert status.OK()
status = connect.flush([jac_collection]) status = connect.flush([jac_collection])
assert status.OK() assert status.OK()
...@@ -479,7 +479,7 @@ class TestDeleteBinary: ...@@ -479,7 +479,7 @@ class TestDeleteBinary:
assert status.OK() assert status.OK()
status = connect.flush([jac_collection]) status = connect.flush([jac_collection])
search_param = get_search_param(index_type) search_param = get_search_param(index_type)
status, res = connect.search_vectors(jac_collection, top_k, query_vecs, params=search_param) status, res = connect.search(jac_collection, top_k, query_vecs, params=search_param)
assert status.OK() assert status.OK()
logging.getLogger().info(res) logging.getLogger().info(res)
assert res[0][0].id != ids[0] assert res[0][0].id != ids[0]
...@@ -494,7 +494,7 @@ class TestDeleteBinary: ...@@ -494,7 +494,7 @@ class TestDeleteBinary:
index_param = get_simple_index["index_param"] index_param = get_simple_index["index_param"]
index_type = get_simple_index["index_type"] index_type = get_simple_index["index_type"]
tmp, vectors = gen_binary_vectors(nb, dim) tmp, vectors = gen_binary_vectors(nb, dim)
status, ids = connect.add_vectors(jac_collection, vectors) status, ids = connect.insert(jac_collection, vectors)
assert status.OK() assert status.OK()
status = connect.flush([jac_collection]) status = connect.flush([jac_collection])
assert status.OK() assert status.OK()
...@@ -503,11 +503,11 @@ class TestDeleteBinary: ...@@ -503,11 +503,11 @@ class TestDeleteBinary:
status = connect.delete_entity_by_id(jac_collection, delete_ids) status = connect.delete_entity_by_id(jac_collection, delete_ids)
assert status.OK() assert status.OK()
status = connect.flush([jac_collection]) status = connect.flush([jac_collection])
status, tmp_ids = connect.add_vectors(jac_collection, [vectors[0], vectors[-1]]) status, tmp_ids = connect.insert(jac_collection, [vectors[0], vectors[-1]])
assert status.OK() assert status.OK()
status = connect.flush([jac_collection]) status = connect.flush([jac_collection])
search_param = get_search_param(index_type) search_param = get_search_param(index_type)
status, res = connect.search_vectors(jac_collection, top_k, query_vecs, params=search_param) status, res = connect.search(jac_collection, top_k, query_vecs, params=search_param)
assert status.OK() assert status.OK()
logging.getLogger().info(res) logging.getLogger().info(res)
assert res[0][0].id == tmp_ids[0] assert res[0][0].id == tmp_ids[0]
......
...@@ -127,13 +127,13 @@ class TestFlushBase: ...@@ -127,13 +127,13 @@ class TestFlushBase:
expected: status ok expected: status ok
''' '''
vectors = gen_vectors(nb, dim) vectors = gen_vectors(nb, dim)
status, ids = connect.add_vectors(collection, vectors) status, ids = connect.insert(collection, vectors)
assert status.OK() assert status.OK()
for i in range(10): for i in range(10):
status = connect.flush([collection]) status = connect.flush([collection])
assert status.OK() assert status.OK()
query_vecs = [vectors[0], vectors[1], vectors[-1]] query_vecs = [vectors[0], vectors[1], vectors[-1]]
status, res = connect.search_vectors(collection, top_k, query_records=query_vecs) status, res = connect.search(collection, top_k, query_records=query_vecs)
assert status.OK() assert status.OK()
# TODO: stable case # TODO: stable case
...@@ -144,7 +144,7 @@ class TestFlushBase: ...@@ -144,7 +144,7 @@ class TestFlushBase:
''' '''
vectors = gen_vectors(nb, dim) vectors = gen_vectors(nb, dim)
ids = [i for i in range(nb)] ids = [i for i in range(nb)]
status, ids = connect.add_vectors(collection, vectors, ids) status, ids = connect.insert(collection, vectors, ids)
assert status.OK() assert status.OK()
timeout = 10 timeout = 10
start_time = time.time() start_time = time.time()
...@@ -177,7 +177,7 @@ class TestFlushBase: ...@@ -177,7 +177,7 @@ class TestFlushBase:
for i, item in enumerate(ids): for i, item in enumerate(ids):
if item <= same_ids: if item <= same_ids:
ids[i] = 0 ids[i] = 0
status, ids = connect.add_vectors(collection, vectors, ids) status, ids = connect.insert(collection, vectors, ids)
status = connect.flush([collection]) status = connect.flush([collection])
assert status.OK() assert status.OK()
status, res = connect.count_entities(collection) status, res = connect.count_entities(collection)
...@@ -190,7 +190,7 @@ class TestFlushBase: ...@@ -190,7 +190,7 @@ class TestFlushBase:
expected: status ok expected: status ok
''' '''
vectors = gen_vectors(nb, dim) vectors = gen_vectors(nb, dim)
status, ids = connect.add_vectors(collection, vectors) status, ids = connect.insert(collection, vectors)
assert status.OK() assert status.OK()
status = connect.delete_entity_by_id(collection, [ids[-1]]) status = connect.delete_entity_by_id(collection, [ids[-1]])
assert status.OK() assert status.OK()
...@@ -198,7 +198,7 @@ class TestFlushBase: ...@@ -198,7 +198,7 @@ class TestFlushBase:
status = connect.flush([collection]) status = connect.flush([collection])
assert status.OK() assert status.OK()
query_vecs = [vectors[0], vectors[1], vectors[-1]] query_vecs = [vectors[0], vectors[1], vectors[-1]]
status, res = connect.search_vectors(collection, top_k, query_records=query_vecs) status, res = connect.search(collection, top_k, query_records=query_vecs)
assert status.OK() assert status.OK()
# TODO: CI fail, LOCAL pass # TODO: CI fail, LOCAL pass
...@@ -215,7 +215,7 @@ class TestFlushBase: ...@@ -215,7 +215,7 @@ class TestFlushBase:
milvus = get_milvus(args["ip"], args["port"], handler=args["handler"]) milvus = get_milvus(args["ip"], args["port"], handler=args["handler"])
milvus.create_collection(param) milvus.create_collection(param)
vectors = gen_vector(nb, dim) vectors = gen_vector(nb, dim)
status, ids = milvus.add_vectors(collection, vectors, ids=[i for i in range(nb)]) status, ids = milvus.insert(collection, vectors, ids=[i for i in range(nb)])
def flush(collection_name): def flush(collection_name):
milvus = get_milvus(args["ip"], args["port"], handler=args["handler"]) milvus = get_milvus(args["ip"], args["port"], handler=args["handler"])
status = milvus.delete_entity_by_id(collection_name, [i for i in range(nb)]) status = milvus.delete_entity_by_id(collection_name, [i for i in range(nb)])
...@@ -259,7 +259,7 @@ class TestFlushAsync: ...@@ -259,7 +259,7 @@ class TestFlushAsync:
def test_flush_async(self, connect, collection): def test_flush_async(self, connect, collection):
vectors = gen_vectors(nb, dim) vectors = gen_vectors(nb, dim)
status, ids = connect.add_vectors(collection, vectors) status, ids = connect.insert(collection, vectors)
future = connect.flush([collection], _async=True) future = connect.flush([collection], _async=True)
status = future.result() status = future.result()
assert status.OK() assert status.OK()
...@@ -267,7 +267,7 @@ class TestFlushAsync: ...@@ -267,7 +267,7 @@ class TestFlushAsync:
def test_flush_async(self, connect, collection): def test_flush_async(self, connect, collection):
nb = 100000 nb = 100000
vectors = gen_vectors(nb, dim) vectors = gen_vectors(nb, dim)
connect.add_vectors(collection, vectors) connect.insert(collection, vectors)
logging.getLogger().info("before") logging.getLogger().info("before")
future = connect.flush([collection], _async=True, _callback=self.check_status) future = connect.flush([collection], _async=True, _callback=self.check_status)
logging.getLogger().info("after") logging.getLogger().info("after")
......
...@@ -21,7 +21,7 @@ nb = 6000 ...@@ -21,7 +21,7 @@ nb = 6000
class TestGetVectorIdsBase: class TestGetVectorIdsBase:
def get_valid_name(self, connect, collection): def get_valid_name(self, connect, collection):
vectors = gen_vector(nb, dim) vectors = gen_vector(nb, dim)
status, ids = connect.add_vectors(collection, vectors) status, ids = connect.insert(collection, vectors)
assert status.OK() assert status.OK()
status = connect.flush([collection]) status = connect.flush([collection])
assert status.OK() assert status.OK()
...@@ -110,7 +110,7 @@ class TestGetVectorIdsBase: ...@@ -110,7 +110,7 @@ class TestGetVectorIdsBase:
expected: status ok expected: status ok
''' '''
vectors = gen_vector(10, dim) vectors = gen_vector(10, dim)
status, ids = connect.add_vectors(collection, vectors) status, ids = connect.insert(collection, vectors)
assert status.OK() assert status.OK()
status = connect.flush([collection]) status = connect.flush([collection])
assert status.OK() assert status.OK()
...@@ -133,7 +133,7 @@ class TestGetVectorIdsBase: ...@@ -133,7 +133,7 @@ class TestGetVectorIdsBase:
status = connect.create_partition(collection, tag) status = connect.create_partition(collection, tag)
assert status.OK() assert status.OK()
vectors = gen_vector(10, dim) vectors = gen_vector(10, dim)
status, ids = connect.add_vectors(collection, vectors, partition_tag=tag) status, ids = connect.insert(collection, vectors, partition_tag=tag)
assert status.OK() assert status.OK()
status = connect.flush([collection]) status = connect.flush([collection])
assert status.OK() assert status.OK()
...@@ -170,7 +170,7 @@ class TestGetVectorIdsBase: ...@@ -170,7 +170,7 @@ class TestGetVectorIdsBase:
status = connect.create_index(collection, index_type, index_param) status = connect.create_index(collection, index_type, index_param)
assert status.OK() assert status.OK()
vectors = gen_vector(10, dim) vectors = gen_vector(10, dim)
status, ids = connect.add_vectors(collection, vectors) status, ids = connect.insert(collection, vectors)
assert status.OK() assert status.OK()
status = connect.flush([collection]) status = connect.flush([collection])
assert status.OK() assert status.OK()
...@@ -196,7 +196,7 @@ class TestGetVectorIdsBase: ...@@ -196,7 +196,7 @@ class TestGetVectorIdsBase:
status = connect.create_index(collection, index_type, index_param) status = connect.create_index(collection, index_type, index_param)
assert status.OK() assert status.OK()
vectors = gen_vector(10, dim) vectors = gen_vector(10, dim)
status, ids = connect.add_vectors(collection, vectors, partition_tag=tag) status, ids = connect.insert(collection, vectors, partition_tag=tag)
assert status.OK() assert status.OK()
status = connect.flush([collection]) status = connect.flush([collection])
assert status.OK() assert status.OK()
...@@ -217,7 +217,7 @@ class TestGetVectorIdsBase: ...@@ -217,7 +217,7 @@ class TestGetVectorIdsBase:
expected: status ok, vector_ids decreased after vectors deleted expected: status ok, vector_ids decreased after vectors deleted
''' '''
vectors = gen_vector(2, dim) vectors = gen_vector(2, dim)
status, ids = connect.add_vectors(collection, vectors) status, ids = connect.insert(collection, vectors)
assert status.OK() assert status.OK()
delete_ids = [ids[0]] delete_ids = [ids[0]]
status = connect.delete_entity_by_id(collection, delete_ids) status = connect.delete_entity_by_id(collection, delete_ids)
...@@ -244,7 +244,7 @@ class TestGetVectorIdsIP: ...@@ -244,7 +244,7 @@ class TestGetVectorIdsIP:
expected: status ok expected: status ok
''' '''
vectors = gen_vector(10, dim) vectors = gen_vector(10, dim)
status, ids = connect.add_vectors(ip_collection, vectors) status, ids = connect.insert(ip_collection, vectors)
assert status.OK() assert status.OK()
status = connect.flush([ip_collection]) status = connect.flush([ip_collection])
assert status.OK() assert status.OK()
...@@ -267,7 +267,7 @@ class TestGetVectorIdsIP: ...@@ -267,7 +267,7 @@ class TestGetVectorIdsIP:
status = connect.create_partition(ip_collection, tag) status = connect.create_partition(ip_collection, tag)
assert status.OK() assert status.OK()
vectors = gen_vector(10, dim) vectors = gen_vector(10, dim)
status, ids = connect.add_vectors(ip_collection, vectors, partition_tag=tag) status, ids = connect.insert(ip_collection, vectors, partition_tag=tag)
assert status.OK() assert status.OK()
status = connect.flush([ip_collection]) status = connect.flush([ip_collection])
assert status.OK() assert status.OK()
...@@ -304,7 +304,7 @@ class TestGetVectorIdsIP: ...@@ -304,7 +304,7 @@ class TestGetVectorIdsIP:
status = connect.create_index(ip_collection, index_type, index_param) status = connect.create_index(ip_collection, index_type, index_param)
assert status.OK() assert status.OK()
vectors = gen_vector(10, dim) vectors = gen_vector(10, dim)
status, ids = connect.add_vectors(ip_collection, vectors) status, ids = connect.insert(ip_collection, vectors)
assert status.OK() assert status.OK()
status = connect.flush([ip_collection]) status = connect.flush([ip_collection])
assert status.OK() assert status.OK()
...@@ -330,7 +330,7 @@ class TestGetVectorIdsIP: ...@@ -330,7 +330,7 @@ class TestGetVectorIdsIP:
status = connect.create_index(ip_collection, index_type, index_param) status = connect.create_index(ip_collection, index_type, index_param)
assert status.OK() assert status.OK()
vectors = gen_vector(10, dim) vectors = gen_vector(10, dim)
status, ids = connect.add_vectors(ip_collection, vectors, partition_tag=tag) status, ids = connect.insert(ip_collection, vectors, partition_tag=tag)
assert status.OK() assert status.OK()
status = connect.flush([ip_collection]) status = connect.flush([ip_collection])
assert status.OK() assert status.OK()
...@@ -351,7 +351,7 @@ class TestGetVectorIdsIP: ...@@ -351,7 +351,7 @@ class TestGetVectorIdsIP:
expected: status ok, vector_ids decreased after vectors deleted expected: status ok, vector_ids decreased after vectors deleted
''' '''
vectors = gen_vector(2, dim) vectors = gen_vector(2, dim)
status, ids = connect.add_vectors(ip_collection, vectors) status, ids = connect.insert(ip_collection, vectors)
assert status.OK() assert status.OK()
delete_ids = [ids[0]] delete_ids = [ids[0]]
status = connect.delete_entity_by_id(ip_collection, delete_ids) status = connect.delete_entity_by_id(ip_collection, delete_ids)
...@@ -378,7 +378,7 @@ class TestGetVectorIdsJAC: ...@@ -378,7 +378,7 @@ class TestGetVectorIdsJAC:
expected: status ok expected: status ok
''' '''
tmp, vectors = gen_binary_vectors(10, dim) tmp, vectors = gen_binary_vectors(10, dim)
status, ids = connect.add_vectors(jac_collection, vectors) status, ids = connect.insert(jac_collection, vectors)
assert status.OK() assert status.OK()
status = connect.flush([jac_collection]) status = connect.flush([jac_collection])
assert status.OK() assert status.OK()
...@@ -400,7 +400,7 @@ class TestGetVectorIdsJAC: ...@@ -400,7 +400,7 @@ class TestGetVectorIdsJAC:
status = connect.create_partition(jac_collection, tag) status = connect.create_partition(jac_collection, tag)
assert status.OK() assert status.OK()
tmp, vectors = gen_binary_vectors(10, dim) tmp, vectors = gen_binary_vectors(10, dim)
status, ids = connect.add_vectors(jac_collection, vectors, partition_tag=tag) status, ids = connect.insert(jac_collection, vectors, partition_tag=tag)
assert status.OK() assert status.OK()
status = connect.flush([jac_collection]) status = connect.flush([jac_collection])
assert status.OK() assert status.OK()
...@@ -436,7 +436,7 @@ class TestGetVectorIdsJAC: ...@@ -436,7 +436,7 @@ class TestGetVectorIdsJAC:
status = connect.create_index(jac_collection, index_type, index_param) status = connect.create_index(jac_collection, index_type, index_param)
assert status.OK() assert status.OK()
tmp, vectors = gen_binary_vectors(10, dim) tmp, vectors = gen_binary_vectors(10, dim)
status, ids = connect.add_vectors(jac_collection, vectors) status, ids = connect.insert(jac_collection, vectors)
assert status.OK() assert status.OK()
status = connect.flush([jac_collection]) status = connect.flush([jac_collection])
assert status.OK() assert status.OK()
...@@ -462,7 +462,7 @@ class TestGetVectorIdsJAC: ...@@ -462,7 +462,7 @@ class TestGetVectorIdsJAC:
status = connect.create_index(jac_collection, index_type, index_param) status = connect.create_index(jac_collection, index_type, index_param)
assert status.OK() assert status.OK()
tmp, vectors = gen_binary_vectors(10, dim) tmp, vectors = gen_binary_vectors(10, dim)
status, ids = connect.add_vectors(jac_collection, vectors, partition_tag=tag) status, ids = connect.insert(jac_collection, vectors, partition_tag=tag)
assert status.OK() assert status.OK()
status = connect.flush([jac_collection]) status = connect.flush([jac_collection])
assert status.OK() assert status.OK()
...@@ -483,7 +483,7 @@ class TestGetVectorIdsJAC: ...@@ -483,7 +483,7 @@ class TestGetVectorIdsJAC:
expected: status ok, vector_ids decreased after vectors deleted expected: status ok, vector_ids decreased after vectors deleted
''' '''
tmp, vectors = gen_binary_vectors(2, dim) tmp, vectors = gen_binary_vectors(2, dim)
status, ids = connect.add_vectors(jac_collection, vectors) status, ids = connect.insert(jac_collection, vectors)
assert status.OK() assert status.OK()
delete_ids = [ids[0]] delete_ids = [ids[0]]
status = connect.delete_entity_by_id(jac_collection, delete_ids) status = connect.delete_entity_by_id(jac_collection, delete_ids)
......
...@@ -32,7 +32,7 @@ class TestGetBase: ...@@ -32,7 +32,7 @@ class TestGetBase:
expected: status ok, vector returned expected: status ok, vector returned
''' '''
vector = gen_single_vector(dim) vector = gen_single_vector(dim)
status, ids = connect.add_vectors(collection, vector) status, ids = connect.insert(collection, vector)
assert status.OK() assert status.OK()
status = connect.flush([collection]) status = connect.flush([collection])
assert status.OK() assert status.OK()
...@@ -47,7 +47,7 @@ class TestGetBase: ...@@ -47,7 +47,7 @@ class TestGetBase:
expected: status ok, vector returned expected: status ok, vector returned
''' '''
vectors = gen_vectors(nb, dim) vectors = gen_vectors(nb, dim)
status, ids = connect.add_vectors(collection, vectors) status, ids = connect.insert(collection, vectors)
assert status.OK() assert status.OK()
status = connect.flush([collection]) status = connect.flush([collection])
assert status.OK() assert status.OK()
...@@ -64,7 +64,7 @@ class TestGetBase: ...@@ -64,7 +64,7 @@ class TestGetBase:
expected: status ok, vector returned expected: status ok, vector returned
''' '''
vectors = gen_vectors(nb, dim) vectors = gen_vectors(nb, dim)
status, ids = connect.add_vectors(collection, vectors) status, ids = connect.insert(collection, vectors)
assert status.OK() assert status.OK()
status = connect.flush([collection]) status = connect.flush([collection])
assert status.OK() assert status.OK()
...@@ -80,7 +80,7 @@ class TestGetBase: ...@@ -80,7 +80,7 @@ class TestGetBase:
vectors = gen_vectors(nb, dim) vectors = gen_vectors(nb, dim)
status = connect.create_partition(collection, tag) status = connect.create_partition(collection, tag)
assert status.OK() assert status.OK()
status, ids = connect.add_vectors(collection, vectors, partition_tag=tag) status, ids = connect.insert(collection, vectors, partition_tag=tag)
assert status.OK() assert status.OK()
status = connect.flush([collection]) status = connect.flush([collection])
assert status.OK() assert status.OK()
...@@ -99,7 +99,7 @@ class TestGetBase: ...@@ -99,7 +99,7 @@ class TestGetBase:
vectors = gen_vectors(nb, dim) vectors = gen_vectors(nb, dim)
ids = [i for i in range(nb)] ids = [i for i in range(nb)]
ids[1] = 0; ids[-1] = 0 ids[1] = 0; ids[-1] = 0
status, ids = connect.add_vectors(collection, vectors, ids=ids) status, ids = connect.insert(collection, vectors, ids=ids)
status = connect.flush([collection]) status = connect.flush([collection])
assert status.OK() assert status.OK()
status, res = connect.get_entity_by_id(collection, [0]) status, res = connect.get_entity_by_id(collection, [0])
...@@ -126,7 +126,7 @@ class TestGetBase: ...@@ -126,7 +126,7 @@ class TestGetBase:
expected: status ok, get one vector expected: status ok, get one vector
''' '''
vectors = gen_vectors(nb, dim) vectors = gen_vectors(nb, dim)
status, ids = connect.add_vectors(collection, vectors) status, ids = connect.insert(collection, vectors)
assert status.OK() assert status.OK()
status = connect.flush([collection]) status = connect.flush([collection])
assert status.OK() assert status.OK()
...@@ -167,7 +167,7 @@ class TestGetBase: ...@@ -167,7 +167,7 @@ class TestGetBase:
expected: status ok, empty result expected: status ok, empty result
''' '''
vector = gen_single_vector(dim) vector = gen_single_vector(dim)
status, ids = connect.add_vectors(collection, vector) status, ids = connect.insert(collection, vector)
assert status.OK() assert status.OK()
status = connect.flush([collection]) status = connect.flush([collection])
assert status.OK() assert status.OK()
...@@ -182,7 +182,7 @@ class TestGetBase: ...@@ -182,7 +182,7 @@ class TestGetBase:
expected: status not ok expected: status not ok
''' '''
vector = gen_single_vector(dim) vector = gen_single_vector(dim)
status, ids = connect.add_vectors(collection, vector) status, ids = connect.insert(collection, vector)
assert status.OK() assert status.OK()
status = connect.flush([collection]) status = connect.flush([collection])
assert status.OK() assert status.OK()
...@@ -233,7 +233,7 @@ class TestGetIndexedVectors: ...@@ -233,7 +233,7 @@ class TestGetIndexedVectors:
index_param = get_simple_index["index_param"] index_param = get_simple_index["index_param"]
index_type = get_simple_index["index_type"] index_type = get_simple_index["index_type"]
vectors = gen_vector(nb, dim) vectors = gen_vector(nb, dim)
status, ids = connect.add_vectors(collection, vectors) status, ids = connect.insert(collection, vectors)
assert status.OK() assert status.OK()
status = connect.flush([collection]) status = connect.flush([collection])
assert status.OK() assert status.OK()
...@@ -253,7 +253,7 @@ class TestGetIndexedVectors: ...@@ -253,7 +253,7 @@ class TestGetIndexedVectors:
index_param = get_simple_index["index_param"] index_param = get_simple_index["index_param"]
index_type = get_simple_index["index_type"] index_type = get_simple_index["index_type"]
vectors = gen_vectors(nb, dim) vectors = gen_vectors(nb, dim)
status, ids = connect.add_vectors(collection, vectors) status, ids = connect.insert(collection, vectors)
assert status.OK() assert status.OK()
status = connect.flush([collection]) status = connect.flush([collection])
assert status.OK() assert status.OK()
...@@ -279,7 +279,7 @@ class TestGetIndexedVectors: ...@@ -279,7 +279,7 @@ class TestGetIndexedVectors:
vectors = gen_vectors(nb, dim) vectors = gen_vectors(nb, dim)
status = connect.create_partition(collection, tag) status = connect.create_partition(collection, tag)
ids = [i for i in range(nb)] ids = [i for i in range(nb)]
status, ids = connect.add_vectors(collection, vectors, ids, partition_tag=tag) status, ids = connect.insert(collection, vectors, ids, partition_tag=tag)
assert status.OK() assert status.OK()
status = connect.flush([collection]) status = connect.flush([collection])
assert status.OK() assert status.OK()
...@@ -304,7 +304,7 @@ class TestGetBinary: ...@@ -304,7 +304,7 @@ class TestGetBinary:
expected: status ok, vector returned expected: status ok, vector returned
''' '''
tmp, vector = gen_binary_vectors(1, dim) tmp, vector = gen_binary_vectors(1, dim)
status, ids = connect.add_vectors(jac_collection, vector) status, ids = connect.insert(jac_collection, vector)
assert status.OK() assert status.OK()
status = connect.flush([jac_collection]) status = connect.flush([jac_collection])
assert status.OK() assert status.OK()
...@@ -319,7 +319,7 @@ class TestGetBinary: ...@@ -319,7 +319,7 @@ class TestGetBinary:
expected: status ok, vector returned expected: status ok, vector returned
''' '''
tmp, vectors = gen_binary_vectors(nb, dim) tmp, vectors = gen_binary_vectors(nb, dim)
status, ids = connect.add_vectors(jac_collection, vectors) status, ids = connect.insert(jac_collection, vectors)
assert status.OK() assert status.OK()
status = connect.flush([jac_collection]) status = connect.flush([jac_collection])
assert status.OK() assert status.OK()
...@@ -336,7 +336,7 @@ class TestGetBinary: ...@@ -336,7 +336,7 @@ class TestGetBinary:
tmp, vectors = gen_binary_vectors(nb, dim) tmp, vectors = gen_binary_vectors(nb, dim)
ids = [i for i in range(nb)] ids = [i for i in range(nb)]
ids[0] = 0; ids[-1] = 0 ids[0] = 0; ids[-1] = 0
status, ids = connect.add_vectors(jac_collection, vectors, ids=ids) status, ids = connect.insert(jac_collection, vectors, ids=ids)
status = connect.flush([jac_collection]) status = connect.flush([jac_collection])
assert status.OK() assert status.OK()
status, res = connect.get_entity_by_id(jac_collection, [0]) status, res = connect.get_entity_by_id(jac_collection, [0])
...@@ -350,7 +350,7 @@ class TestGetBinary: ...@@ -350,7 +350,7 @@ class TestGetBinary:
expected: status ok, empty result expected: status ok, empty result
''' '''
tmp, vector = gen_binary_vectors(1, dim) tmp, vector = gen_binary_vectors(1, dim)
status, ids = connect.add_vectors(jac_collection, vector) status, ids = connect.insert(jac_collection, vector)
assert status.OK() assert status.OK()
status = connect.flush([jac_collection]) status = connect.flush([jac_collection])
assert status.OK() assert status.OK()
...@@ -365,7 +365,7 @@ class TestGetBinary: ...@@ -365,7 +365,7 @@ class TestGetBinary:
expected: status not ok expected: status not ok
''' '''
tmp, vector = gen_binary_vectors(1, dim) tmp, vector = gen_binary_vectors(1, dim)
status, ids = connect.add_vectors(jac_collection, vector) status, ids = connect.insert(jac_collection, vector)
assert status.OK() assert status.OK()
status = connect.flush([jac_collection]) status = connect.flush([jac_collection])
assert status.OK() assert status.OK()
...@@ -381,7 +381,7 @@ class TestGetBinary: ...@@ -381,7 +381,7 @@ class TestGetBinary:
''' '''
tmp, vectors = gen_binary_vectors(nb, dim) tmp, vectors = gen_binary_vectors(nb, dim)
status = connect.create_partition(jac_collection, tag) status = connect.create_partition(jac_collection, tag)
status, ids = connect.add_vectors(jac_collection, vectors, partition_tag=tag) status, ids = connect.insert(jac_collection, vectors, partition_tag=tag)
assert status.OK() assert status.OK()
status = connect.flush([jac_collection]) status = connect.flush([jac_collection])
assert status.OK() assert status.OK()
......
...@@ -40,7 +40,7 @@ class TestMixBase: ...@@ -40,7 +40,7 @@ class TestMixBase:
'index_file_size': index_file_size, 'index_file_size': index_file_size,
'metric_type': MetricType.L2}) 'metric_type': MetricType.L2})
for i in range(10): for i in range(10):
status, ids = milvus_instance.add_vectors(collection, vectors) status, ids = milvus_instance.insert(collection, vectors)
# logging.getLogger().info(ids) # logging.getLogger().info(ids)
if i == 0: if i == 0:
id_0 = ids[0]; id_1 = ids[1] id_0 = ids[0]; id_1 = ids[1]
...@@ -50,14 +50,14 @@ class TestMixBase: ...@@ -50,14 +50,14 @@ class TestMixBase:
logging.getLogger().info(status) logging.getLogger().info(status)
status, result = milvus_instance.get_index_info(collection) status, result = milvus_instance.get_index_info(collection)
logging.getLogger().info(result) logging.getLogger().info(result)
def add_vectors(milvus_instance): def insert(milvus_instance):
logging.getLogger().info("In add vectors") logging.getLogger().info("In add vectors")
status, ids = milvus_instance.add_vectors(collection, vectors) status, ids = milvus_instance.insert(collection, vectors)
logging.getLogger().info(status) logging.getLogger().info(status)
def search(milvus_instance): def search(milvus_instance):
logging.getLogger().info("In search vectors") logging.getLogger().info("In search vectors")
for i in range(loops): for i in range(loops):
status, result = milvus_instance.search_vectors(collection, top_k, nprobe, query_vecs) status, result = milvus_instance.search(collection, top_k, nprobe, query_vecs)
logging.getLogger().info(status) logging.getLogger().info(status)
assert result[0][0].id == id_0 assert result[0][0].id == id_0
assert result[1][0].id == id_1 assert result[1][0].id == id_1
...@@ -67,7 +67,7 @@ class TestMixBase: ...@@ -67,7 +67,7 @@ class TestMixBase:
p_search.start() p_search.start()
milvus_instance = get_milvus(args["handler"]) milvus_instance = get_milvus(args["handler"])
# milvus_instance.connect(uri=uri) # milvus_instance.connect(uri=uri)
p_create = Process(target=add_vectors, args=(milvus_instance, )) p_create = Process(target=insert, args=(milvus_instance, ))
p_create.start() p_create.start()
p_create.join() p_create.join()
...@@ -93,7 +93,7 @@ class TestMixBase: ...@@ -93,7 +93,7 @@ class TestMixBase:
'index_file_size': index_file_size, 'index_file_size': index_file_size,
'metric_type': MetricType.L2} 'metric_type': MetricType.L2}
connect.create_collection(param) connect.create_collection(param)
status, ids = connect.add_vectors(collection_name=collection_name, records=vectors) status, ids = connect.insert(collection_name=collection_name, records=vectors)
idx.append(ids[0]) idx.append(ids[0])
idx.append(ids[10]) idx.append(ids[10])
idx.append(ids[20]) idx.append(ids[20])
...@@ -106,7 +106,7 @@ class TestMixBase: ...@@ -106,7 +106,7 @@ class TestMixBase:
'index_file_size': index_file_size, 'index_file_size': index_file_size,
'metric_type': MetricType.IP} 'metric_type': MetricType.IP}
connect.create_collection(param) connect.create_collection(param)
status, ids = connect.add_vectors(collection_name=collection_name, records=vectors) status, ids = connect.insert(collection_name=collection_name, records=vectors)
assert status.OK() assert status.OK()
status = connect.flush([collection_name]) status = connect.flush([collection_name])
assert status.OK() assert status.OK()
...@@ -147,7 +147,7 @@ class TestMixBase: ...@@ -147,7 +147,7 @@ class TestMixBase:
query_vecs = [vectors[0], vectors[10], vectors[20]] query_vecs = [vectors[0], vectors[10], vectors[20]]
for i in range(60): for i in range(60):
collection = collection_list[i] collection = collection_list[i]
status, result = connect.search_vectors(collection, top_k, query_records=query_vecs, params={"nprobe": 1}) status, result = connect.search(collection, top_k, query_records=query_vecs, params={"nprobe": 1})
assert status.OK() assert status.OK()
assert len(result) == len(query_vecs) assert len(result) == len(query_vecs)
logging.getLogger().info(i) logging.getLogger().info(i)
......
...@@ -97,7 +97,7 @@ class TestCreateBase: ...@@ -97,7 +97,7 @@ class TestCreateBase:
assert tag_name in tag_list assert tag_name in tag_list
assert "_default" in tag_list assert "_default" in tag_list
def test_create_partition_add_vectors_default(self, connect, collection): def test_create_partition_insert_default(self, connect, collection):
''' '''
target: test create partition, and insert vectors, check status returned target: test create partition, and insert vectors, check status returned
method: call function: create_partition method: call function: create_partition
......
...@@ -44,12 +44,12 @@ ...@@ -44,12 +44,12 @@
# ''' # '''
# global vectors # global vectors
# if nb == 6000: # if nb == 6000:
# add_vectors = vectors # insert = vectors
# else: # else:
# add_vectors = gen_vectors(nb, dim) # insert = gen_vectors(nb, dim)
# status, ids = connect.add_vectors(collection, add_vectors) # status, ids = connect.insert(collection, insert)
# connect.flush([collection]) # connect.flush([collection])
# return add_vectors, ids # return insert, ids
# #
# def init_data_binary(self, connect, collection, nb=6000): # def init_data_binary(self, connect, collection, nb=6000):
# ''' # '''
...@@ -57,32 +57,32 @@ ...@@ -57,32 +57,32 @@
# ''' # '''
# global binary_vectors # global binary_vectors
# if nb == 6000: # if nb == 6000:
# add_vectors = binary_vectors # insert = binary_vectors
# else: # else:
# add_vectors = gen_binary_vectors(nb, dim) # insert = gen_binary_vectors(nb, dim)
# status, ids = connect.add_vectors(collection, add_vectors) # status, ids = connect.insert(collection, insert)
# connect.flush([collection]) # connect.flush([collection])
# return add_vectors, ids # return insert, ids
# #
# def init_data_no_flush(self, connect, collection, nb=6000): # def init_data_no_flush(self, connect, collection, nb=6000):
# global vectors # global vectors
# if nb == 6000: # if nb == 6000:
# add_vectors = vectors # insert = vectors
# else: # else:
# add_vectors = gen_vectors(nb, dim) # insert = gen_vectors(nb, dim)
# status, ids = connect.add_vectors(collection, add_vectors) # status, ids = connect.insert(collection, insert)
# return add_vectors, ids # return insert, ids
# #
# def init_data_ids(self, connect, collection, nb=6000): # def init_data_ids(self, connect, collection, nb=6000):
# global vectors # global vectors
# my_ids = [i for i in range(nb)] # my_ids = [i for i in range(nb)]
# if nb == 6000: # if nb == 6000:
# add_vectors = vectors # insert = vectors
# else: # else:
# add_vectors = gen_vectors(nb, dim) # insert = gen_vectors(nb, dim)
# status, ids = connect.add_vectors(collection, add_vectors, my_ids) # status, ids = connect.insert(collection, insert, my_ids)
# connect.flush([collection]) # connect.flush([collection])
# return add_vectors, ids # return insert, ids
# #
# def init_data_partition(self, connect, collection, partition_tag, nb=6000): # def init_data_partition(self, connect, collection, partition_tag, nb=6000):
# ''' # '''
...@@ -90,15 +90,15 @@ ...@@ -90,15 +90,15 @@
# ''' # '''
# global vectors # global vectors
# if nb == 6000: # if nb == 6000:
# add_vectors = vectors # insert = vectors
# else: # else:
# add_vectors = gen_vectors(nb, dim) # insert = gen_vectors(nb, dim)
# add_vectors = sklearn.preprocessing.normalize(add_vectors, axis=1, norm='l2') # insert = sklearn.preprocessing.normalize(insert, axis=1, norm='l2')
# add_vectors = add_vectors.tolist() # insert = insert.tolist()
# status, ids = connect.add_vectors(collection, add_vectors, partition_tag=partition_tag) # status, ids = connect.insert(collection, insert, partition_tag=partition_tag)
# assert status.OK() # assert status.OK()
# connect.flush([collection]) # connect.flush([collection])
# return add_vectors, ids # return insert, ids
# #
# @pytest.fixture( # @pytest.fixture(
# scope="function", # scope="function",
......
...@@ -21,14 +21,14 @@ class TestWalBase: ...@@ -21,14 +21,14 @@ class TestWalBase:
****************************************************************** ******************************************************************
""" """
@pytest.mark.timeout(WAL_TIMEOUT) @pytest.mark.timeout(WAL_TIMEOUT)
def test_wal_add_vectors(self, connect, collection): def test_wal_insert(self, connect, collection):
''' '''
target: add vectors in WAL target: add vectors in WAL
method: add vectors and flush when WAL is enabled method: add vectors and flush when WAL is enabled
expected: status ok, vectors added expected: status ok, vectors added
''' '''
vectors = gen_vector(nb, dim) vectors = gen_vector(nb, dim)
status, ids = connect.add_vectors(collection, vectors) status, ids = connect.insert(collection, vectors)
assert status.OK() assert status.OK()
status = connect.flush([collection]) status = connect.flush([collection])
assert status.OK() assert status.OK()
...@@ -48,7 +48,7 @@ class TestWalBase: ...@@ -48,7 +48,7 @@ class TestWalBase:
expected: status ok, vectors deleted expected: status ok, vectors deleted
''' '''
vectors = gen_vector(nb, dim) vectors = gen_vector(nb, dim)
status, ids = connect.add_vectors(collection, vectors) status, ids = connect.insert(collection, vectors)
assert status.OK() assert status.OK()
connect.flush([collection]) connect.flush([collection])
status, res = connect.count_entities(collection) status, res = connect.count_entities(collection)
...@@ -69,7 +69,7 @@ class TestWalBase: ...@@ -69,7 +69,7 @@ class TestWalBase:
expected: status ok, search with vector have result expected: status ok, search with vector have result
''' '''
vector = gen_single_vector(dim) vector = gen_single_vector(dim)
status, ids = connect.add_vectors(collection, vector) status, ids = connect.insert(collection, vector)
assert status.OK() assert status.OK()
connect.flush([collection]) connect.flush([collection])
status = connect.delete_entity_by_id(collection, [0]) status = connect.delete_entity_by_id(collection, [0])
...@@ -87,7 +87,7 @@ class TestWalBase: ...@@ -87,7 +87,7 @@ class TestWalBase:
expected: status not ok expected: status not ok
''' '''
vectors = gen_vector(nb, dim) vectors = gen_vector(nb, dim)
status, ids = connect.add_vectors(collection, vectors) status, ids = connect.insert(collection, vectors)
assert status.OK() assert status.OK()
status = connect.flush([collection]) status = connect.flush([collection])
status = connect.delete_entity_by_id(collection, [0]) status = connect.delete_entity_by_id(collection, [0])
...@@ -109,7 +109,7 @@ class TestWalBase: ...@@ -109,7 +109,7 @@ class TestWalBase:
expected: status ok, add request is recovered and vectors added expected: status ok, add request is recovered and vectors added
''' '''
vector = gen_single_vector(dim) vector = gen_single_vector(dim)
status, ids = connect.add_vectors(collection, vector) status, ids = connect.insert(collection, vector)
assert status.OK() assert status.OK()
status = connect.flush([collection]) status = connect.flush([collection])
status, res = connect.count_entities(collection) status, res = connect.count_entities(collection)
......
...@@ -591,7 +591,7 @@ def gen_simple_index(): ...@@ -591,7 +591,7 @@ def gen_simple_index():
{"nlist": 1024}, {"nlist": 1024},
{"nlist": 1024}, {"nlist": 1024},
{"nlist": 1024, "m": 16}, {"nlist": 1024, "m": 16},
{"M": 16, "efConstruction": 500}, {"M": 48, "efConstruction": 500},
{"search_length": 50, "out_degree": 40, "candidate_pool_size": 100, "knng": 50}, {"search_length": 50, "out_degree": 40, "candidate_pool_size": 100, "knng": 50},
{"n_trees": 4} {"n_trees": 4}
] ]
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册