@@ -283,8 +283,9 @@ private void verifyOutput(JsonObject row, Map<String, Object> entity) {
283283 Assertions .assertEquals (arrStrOri , arrStr );
284284 }
285285
286- private long getRowCount (String collectionName ) {
286+ private long getRowCount (String dbName , String collectionName ) {
287287 QueryResp queryResp = client .query (QueryReq .builder ()
288+ .databaseName (dbName )
288289 .collectionName (collectionName )
289290 .outputFields (Collections .singletonList ("count(*)" ))
290291 .consistencyLevel (ConsistencyLevel .STRONG )
@@ -414,7 +415,7 @@ void testFloatVectors() {
414415 Assertions .assertEquals (1 , upsertResp .getUpsertCnt ());
415416
416417 // get row count
417- long rowCount = getRowCount (randomCollectionName );
418+ long rowCount = getRowCount ("" , randomCollectionName );
418419 Assertions .assertEquals (count + 1 , rowCount );
419420
420421 // describe collection
@@ -638,7 +639,7 @@ void testBinaryVectors() throws InterruptedException {
638639 Assertions .assertEquals (count , insertResp .getInsertCnt ());
639640
640641 // get row count
641- long rowCount = getRowCount (randomCollectionName );
642+ long rowCount = getRowCount ("" , randomCollectionName );
642643 Assertions .assertEquals (count , rowCount );
643644
644645 // search in collection
@@ -807,7 +808,7 @@ void testFloat16Vectors() {
807808 }
808809
809810 // get row count
810- long rowCount = getRowCount (randomCollectionName );
811+ long rowCount = getRowCount ("" , randomCollectionName );
811812 Assertions .assertEquals (count , rowCount );
812813
813814 client .dropCollection (DropCollectionReq .builder ().collectionName (randomCollectionName ).build ());
@@ -851,7 +852,7 @@ void testSparseVectors() {
851852 Assertions .assertEquals (count , insertResp .getInsertCnt ());
852853
853854 // get row count
854- long rowCount = getRowCount (randomCollectionName );
855+ long rowCount = getRowCount ("" , randomCollectionName );
855856 Assertions .assertEquals (count , rowCount );
856857
857858 // search in collection
@@ -1001,7 +1002,7 @@ void testHybridSearch() {
10011002 Assertions .assertEquals (count , insertResp .getInsertCnt ());
10021003
10031004 // get row count
1004- long rowCount = getRowCount (randomCollectionName );
1005+ long rowCount = getRowCount ("" , randomCollectionName );
10051006 Assertions .assertEquals (count , rowCount );
10061007
10071008 // search again, there are results
@@ -1020,6 +1021,12 @@ void testHybridSearch() {
10201021 void testDeleteUpsert () {
10211022 String randomCollectionName = generator .generate (10 );
10221023
1024+ // create a new db
1025+ String testDbName = "test_delete_db" ;
1026+ client .createDatabase (CreateDatabaseReq .builder ()
1027+ .databaseName (testDbName )
1028+ .build ());
1029+
10231030 CreateCollectionReq .CollectionSchema collectionSchema = CreateCollectionReq .CollectionSchema .builder ()
10241031 .build ();
10251032 collectionSchema .addField (AddFieldReq .builder ()
@@ -1040,7 +1047,9 @@ void testDeleteUpsert() {
10401047 .metricType (IndexParam .MetricType .L2 )
10411048 .extraParams (new HashMap <String ,Object >(){{put ("nlist" , 64 );}})
10421049 .build ());
1050+ // create collection in the test db
10431051 CreateCollectionReq requestCreate = CreateCollectionReq .builder ()
1052+ .databaseName (testDbName )
10441053 .collectionName (randomCollectionName )
10451054 .collectionSchema (collectionSchema )
10461055 .indexParams (indexParams )
@@ -1057,20 +1066,22 @@ void testDeleteUpsert() {
10571066 }
10581067
10591068 InsertResp insertResp = client .insert (InsertReq .builder ()
1069+ .databaseName (testDbName )
10601070 .collectionName (randomCollectionName )
10611071 .data (data )
10621072 .build ());
10631073 Assertions .assertEquals (10 , insertResp .getInsertCnt ());
10641074
10651075 // delete
10661076 DeleteResp deleteResp = client .delete (DeleteReq .builder ()
1077+ .databaseName (testDbName )
10671078 .collectionName (randomCollectionName )
10681079 .ids (Arrays .asList ("pk_5" , "pk_8" ))
10691080 .build ());
10701081 Assertions .assertEquals (2 , deleteResp .getDeleteCnt ());
10711082
10721083 // get row count
1073- long rowCount = getRowCount (randomCollectionName );
1084+ long rowCount = getRowCount (testDbName , randomCollectionName );
10741085 Assertions .assertEquals (8L , rowCount );
10751086
10761087 // upsert
@@ -1084,18 +1095,20 @@ void testDeleteUpsert() {
10841095 row2 .add ("float_vector" , JsonUtils .toJsonTree (new float []{2.0f , 2.0f , 2.0f , 2.0f }));
10851096 dataUpdate .add (row2 );
10861097 UpsertResp upsertResp = client .upsert (UpsertReq .builder ()
1098+ .databaseName (testDbName )
10871099 .collectionName (randomCollectionName )
10881100 .data (dataUpdate )
10891101 .build ());
10901102 Assertions .assertEquals (2 , upsertResp .getUpsertCnt ());
10911103 Assertions .assertEquals (2 , upsertResp .getPrimaryKeys ().size ());
10921104
10931105 // get row count
1094- rowCount = getRowCount (randomCollectionName );
1106+ rowCount = getRowCount (testDbName , randomCollectionName );
10951107 Assertions .assertEquals (9L , rowCount );
10961108
10971109 // verify
10981110 QueryResp queryResp = client .query (QueryReq .builder ()
1111+ .databaseName (testDbName )
10991112 .collectionName (randomCollectionName )
11001113 .ids (Arrays .asList ("pk_2" , "pk_5" ))
11011114 .outputFields (Collections .singletonList ("*" ))
@@ -1125,7 +1138,10 @@ void testDeleteUpsert() {
11251138 Assertions .assertEquals (5.0f , f );
11261139 }
11271140
1128- client .dropCollection (DropCollectionReq .builder ().collectionName (randomCollectionName ).build ());
1141+ client .dropCollection (DropCollectionReq .builder ()
1142+ .databaseName (testDbName )
1143+ .collectionName (randomCollectionName )
1144+ .build ());
11291145 }
11301146
11311147 @ Test
@@ -1459,7 +1475,7 @@ void testCacheCollectionSchema() throws InterruptedException {
14591475 String randomCollectionName = generator .generate (10 );
14601476
14611477 // create a new db
1462- String testDbName = "test_database " ;
1478+ String testDbName = "test_cache_db " ;
14631479 client .createDatabase (CreateDatabaseReq .builder ()
14641480 .databaseName (testDbName )
14651481 .build ());
@@ -1633,7 +1649,7 @@ public void testIterator() {
16331649 Assertions .assertEquals (count , insertResp .getInsertCnt ());
16341650
16351651 // get row count
1636- long rowCount = getRowCount (randomCollectionName );
1652+ long rowCount = getRowCount ("" , randomCollectionName );
16371653 Assertions .assertEquals (count , rowCount );
16381654
16391655 // search iterator
@@ -1955,7 +1971,7 @@ void testDatabase() {
19551971 @ Test
19561972 void testClientPool () {
19571973 // create a temp database
1958- String dummyDb = "dummy_db " ;
1974+ String dummyDb = "test_pool_db " ;
19591975 client .createDatabase (CreateDatabaseReq .builder ()
19601976 .databaseName (dummyDb )
19611977 .build ());
@@ -2399,7 +2415,7 @@ void testDocInOut() {
23992415 Assertions .assertEquals (3 , insertResp .getInsertCnt ());
24002416
24012417 // get row count
2402- long rowCount = getRowCount (randomCollectionName );
2418+ long rowCount = getRowCount ("" , randomCollectionName );
24032419 Assertions .assertEquals (texts .size (), rowCount );
24042420
24052421 // search
@@ -2713,7 +2729,7 @@ void testConsistencyLevel() throws InterruptedException {
27132729 String vectorName = "vector" ;
27142730 int dim = 4 ;
27152731 String defaultDbName = "default" ;
2716- String tempDbName = "db_for_level " ;
2732+ String tempDbName = "test_level_db " ;
27172733
27182734 // create a temp database
27192735 client .createDatabase (CreateDatabaseReq .builder ()
0 commit comments