@@ -298,23 +298,34 @@ def create_collections(self):
298298 collection_map = self .test_config .collection .collection_map
299299 for master in self .cluster_spec .masters :
300300 if collection_map is not None :
301- for bucket in collection_map .keys ():
302- delete_default = True
303- for scope in collection_map [bucket ]:
304- if scope == '_default' :
301+ if self .test_config .collection .use_bulk_api :
302+ for bucket in collection_map .keys ():
303+ create_scopes = []
304+ for scope in collection_map [bucket ]:
305+ scope_collections = []
305306 for collection in collection_map [bucket ][scope ]:
306- if collection == "_default" :
307- delete_default = False
308- if delete_default :
309- self .rest .delete_collection (master , bucket , '_default' , '_default' )
310-
311- for bucket in collection_map .keys ():
312- for scope in collection_map [bucket ]:
313- if scope != '_default' :
314- self .rest .create_scope (master , bucket , scope )
315- for collection in collection_map [bucket ][scope ]:
316- if collection != '_default' :
317- self .rest .create_collection (master , bucket , scope , collection )
307+ scope_collections .append ({"name" : collection })
308+ create_scopes .append ({"name" : scope , "collections" : scope_collections })
309+ print (str ({"scopes" : create_scopes }))
310+ self .rest .set_collection_map (master , bucket , {"scopes" : create_scopes })
311+ else :
312+ for bucket in collection_map .keys ():
313+ delete_default = True
314+ for scope in collection_map [bucket ]:
315+ if scope == '_default' :
316+ for collection in collection_map [bucket ][scope ]:
317+ if collection == "_default" :
318+ delete_default = False
319+ if delete_default :
320+ self .rest .delete_collection (master , bucket , '_default' , '_default' )
321+
322+ for bucket in collection_map .keys ():
323+ for scope in collection_map [bucket ]:
324+ if scope != '_default' :
325+ self .rest .create_scope (master , bucket , scope )
326+ for collection in collection_map [bucket ][scope ]:
327+ if collection != '_default' :
328+ self .rest .create_collection (master , bucket , scope , collection )
318329
319330 def create_eventing_buckets (self ):
320331 if not self .test_config .cluster .eventing_bucket_mem_quota :
0 commit comments