@@ -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
@@ -1156,7 +1157,7 @@ void testHybridSearch() {
11561157 Assertions .assertEquals (count , insertResp .getInsertCnt ());
11571158
11581159 // get row count
1159- long rowCount = getRowCount (randomCollectionName );
1160+ long rowCount = getRowCount ("" , randomCollectionName );
11601161 Assertions .assertEquals (count , rowCount );
11611162
11621163 // search again, there are results
@@ -1176,6 +1177,12 @@ void testHybridSearch() {
11761177 void testDeleteUpsert () {
11771178 String randomCollectionName = generator .generate (10 );
11781179
1180+ // create a new db
1181+ String testDbName = "test_delete_db" ;
1182+ client .createDatabase (CreateDatabaseReq .builder ()
1183+ .databaseName (testDbName )
1184+ .build ());
1185+
11791186 CreateCollectionReq .CollectionSchema collectionSchema = CreateCollectionReq .CollectionSchema .builder ()
11801187 .build ();
11811188 collectionSchema .addField (AddFieldReq .builder ()
@@ -1196,7 +1203,9 @@ void testDeleteUpsert() {
11961203 .metricType (IndexParam .MetricType .L2 )
11971204 .extraParams (new HashMap <String ,Object >(){{put ("nlist" , 64 );}})
11981205 .build ());
1206+ // create collection in the test db
11991207 CreateCollectionReq requestCreate = CreateCollectionReq .builder ()
1208+ .databaseName (testDbName )
12001209 .collectionName (randomCollectionName )
12011210 .collectionSchema (collectionSchema )
12021211 .indexParams (indexParams )
@@ -1213,20 +1222,22 @@ void testDeleteUpsert() {
12131222 }
12141223
12151224 InsertResp insertResp = client .insert (InsertReq .builder ()
1225+ .databaseName (testDbName )
12161226 .collectionName (randomCollectionName )
12171227 .data (data )
12181228 .build ());
12191229 Assertions .assertEquals (10 , insertResp .getInsertCnt ());
12201230
12211231 // delete
12221232 DeleteResp deleteResp = client .delete (DeleteReq .builder ()
1233+ .databaseName (testDbName )
12231234 .collectionName (randomCollectionName )
12241235 .ids (Arrays .asList ("pk_5" , "pk_8" ))
12251236 .build ());
12261237 Assertions .assertEquals (2 , deleteResp .getDeleteCnt ());
12271238
12281239 // get row count
1229- long rowCount = getRowCount (randomCollectionName );
1240+ long rowCount = getRowCount (testDbName , randomCollectionName );
12301241 Assertions .assertEquals (8L , rowCount );
12311242
12321243 // upsert
@@ -1240,18 +1251,20 @@ void testDeleteUpsert() {
12401251 row2 .add ("float_vector" , JsonUtils .toJsonTree (new float []{2.0f , 2.0f , 2.0f , 2.0f }));
12411252 dataUpdate .add (row2 );
12421253 UpsertResp upsertResp = client .upsert (UpsertReq .builder ()
1254+ .databaseName (testDbName )
12431255 .collectionName (randomCollectionName )
12441256 .data (dataUpdate )
12451257 .build ());
12461258 Assertions .assertEquals (2 , upsertResp .getUpsertCnt ());
12471259 Assertions .assertEquals (2 , upsertResp .getPrimaryKeys ().size ());
12481260
12491261 // get row count
1250- rowCount = getRowCount (randomCollectionName );
1262+ rowCount = getRowCount (testDbName , randomCollectionName );
12511263 Assertions .assertEquals (9L , rowCount );
12521264
12531265 // verify
12541266 QueryResp queryResp = client .query (QueryReq .builder ()
1267+ .databaseName (testDbName )
12551268 .collectionName (randomCollectionName )
12561269 .ids (Arrays .asList ("pk_2" , "pk_5" ))
12571270 .outputFields (Collections .singletonList ("*" ))
@@ -1281,7 +1294,10 @@ void testDeleteUpsert() {
12811294 Assertions .assertEquals (5.0f , f );
12821295 }
12831296
1284- client .dropCollection (DropCollectionReq .builder ().collectionName (randomCollectionName ).build ());
1297+ client .dropCollection (DropCollectionReq .builder ()
1298+ .databaseName (testDbName )
1299+ .collectionName (randomCollectionName )
1300+ .build ());
12851301 }
12861302
12871303 @ Test
@@ -1615,7 +1631,7 @@ void testCacheCollectionSchema() throws InterruptedException {
16151631 String randomCollectionName = generator .generate (10 );
16161632
16171633 // create a new db
1618- String testDbName = "test_database " ;
1634+ String testDbName = "test_cache_db " ;
16191635 client .createDatabase (CreateDatabaseReq .builder ()
16201636 .databaseName (testDbName )
16211637 .build ());
@@ -1789,7 +1805,7 @@ public void testIterator() {
17891805 Assertions .assertEquals (count , insertResp .getInsertCnt ());
17901806
17911807 // get row count
1792- long rowCount = getRowCount (randomCollectionName );
1808+ long rowCount = getRowCount ("" , randomCollectionName );
17931809 Assertions .assertEquals (count , rowCount );
17941810
17951811 // search iterator
@@ -2113,7 +2129,7 @@ void testDatabase() {
21132129 @ Test
21142130 void testClientPool () {
21152131 // create a temp database
2116- String dummyDb = "dummy_db " ;
2132+ String dummyDb = "test_pool_db " ;
21172133 client .createDatabase (CreateDatabaseReq .builder ()
21182134 .databaseName (dummyDb )
21192135 .build ());
@@ -2557,7 +2573,7 @@ void testDocInOut() {
25572573 Assertions .assertEquals (3 , insertResp .getInsertCnt ());
25582574
25592575 // get row count
2560- long rowCount = getRowCount (randomCollectionName );
2576+ long rowCount = getRowCount ("" , randomCollectionName );
25612577 Assertions .assertEquals (texts .size (), rowCount );
25622578
25632579 // search
@@ -2901,7 +2917,7 @@ void testConsistencyLevel() throws InterruptedException {
29012917 String vectorName = "vector" ;
29022918 int dim = 4 ;
29032919 String defaultDbName = "default" ;
2904- String tempDbName = "db_for_level " ;
2920+ String tempDbName = "test_level_db " ;
29052921
29062922 // create a temp database
29072923 client .createDatabase (CreateDatabaseReq .builder ()
0 commit comments