Skip to content

Commit

Permalink
SDKQE-2028:Collections and Scopes Max Limit Tests
Browse files Browse the repository at this point in the history
Change-Id: I21645fc1678694cac875889b5714ee5955e24b82
Reviewed-on: http://review.couchbase.org/c/gocb/+/134011
Reviewed-by: Charles Dixon <chvckd@gmail.com>
Tested-by: Nouphal Kadavath Purayil <nouphal@couchbase.com>
  • Loading branch information
nouphal committed Aug 24, 2020
1 parent f31151b commit 94cf884
Showing 1 changed file with 35 additions and 0 deletions.
35 changes: 35 additions & 0 deletions bucket_collectionsmgr_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ package gocb

import (
"errors"
"strconv"
"time"
)

Expand Down Expand Up @@ -423,3 +424,37 @@ func (suite *IntegrationTestSuite) TestNumberOfCollectionInScope() {
}

}

func (suite *IntegrationTestSuite) TestMaxNumberOfCollectionInScope() {
suite.skipIfUnsupported(CollectionsFeature)

testBucket1 := globalBucket.Collections()
err := testBucket1.CreateScope("singleScope", nil)
if err != nil {
suite.T().Fatalf("Failed to create scope %v", err)
}
for i := 0; i < 1000; i++ {
err = testBucket1.CreateCollection(CollectionSpec{
Name: strconv.Itoa(1000 + i),
ScopeName: "singleScope",
}, nil)
if err != nil {
suite.T().Fatalf("Failed to create collection %v", err)
}
}
scopes, err := testBucket1.GetAllScopes(nil)
if err != nil {
suite.T().Fatalf("Failed to GetAllScopes %v", err)
}
var scope *ScopeSpec
for i, s := range scopes {
if s.Name == "singleScope" {
scope = &scopes[i]
}
}
suite.Require().NotNil(scope)

if len(scope.Collections) != 1000 {
suite.T().Fatalf("Expected collections in scope should be 1000 but was %v", len(scope.Collections))
}
}

0 comments on commit 94cf884

Please sign in to comment.