MCPcopy Create free account
hub / github.com/couchbase/sync_gateway / createCollections

Method createCollections

base/main_test_bucket_pool.go:587–610  ·  view source on GitHub ↗

createCollections will create a set of test collections on the bucket, if enabled...

(ctx context.Context, bucket Bucket)

Source from the content-addressed store, hash-verified

585
586// createCollections will create a set of test collections on the bucket, if enabled...
587func (tbp *TestBucketPool) createCollections(ctx context.Context, bucket Bucket) {
588 // If we're able to use collections, the test bucket pool will also create N collections per bucket - rather than just getting the default collection ready.
589 if tbp.skipCollections {
590 return
591 }
592
593 dynamicDataStore, ok := bucket.(sgbucket.DynamicDataStoreBucket)
594 if !ok {
595 tbp.Fatalf(ctx, "Bucket doesn't support dynamic collection creation %T", bucket)
596 }
597
598 for i := 0; i < tbp.NumCollectionsPerBucket(); i++ {
599 scopeName := tbp.testScopeName()
600 collectionName := fmt.Sprintf("%s%d", tbpCollectionPrefix, i)
601 ctx := KeyspaceLogCtx(ctx, bucket.GetName(), scopeName, collectionName)
602
603 tbp.Logf(ctx, "Creating new collection: %s.%s", scopeName, collectionName)
604 dataStoreName := ScopeAndCollectionName{Scope: scopeName, Collection: collectionName}
605 err := dynamicDataStore.CreateDataStore(ctx, dataStoreName)
606 if err != nil {
607 tbp.Fatalf(ctx, "Couldn't create datastore %v.%v: %v", scopeName, collectionName, err)
608 }
609 }
610}
611
612// createTestBuckets creates a new set of integration test buckets and pushes them into the readier queue.
613func (tbp *TestBucketPool) createTestBuckets(ctx context.Context, numBuckets, bucketQuotaMB int, bucketInitFunc TBPBucketInitFunc, parallelBucketInit bool) {

Callers 2

GetWalrusTestBucketMethod · 0.95
createTestBucketsMethod · 0.95

Calls 7

FatalfMethod · 0.95
testScopeNameMethod · 0.95
LogfMethod · 0.95
KeyspaceLogCtxFunction · 0.85
GetNameMethod · 0.65
CreateDataStoreMethod · 0.45

Tested by

no test coverage detected