New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
CBG-2201: Added LeakyBucket support to the rest tester under integration tests #5679
Conversation
59b81c4
to
65609e4
Compare
Can you take a look at the build failure? Probably a break after rebasing or something
|
…o AddDatabaseFromConfigWithBucket
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
A few questions on how we're switching from default to named collection. I'm also wondering if this approach will be compatible with future changes to support multiple collections in a single RestTester context?
} | ||
} | ||
if unclosedBucketWarnings != "" { | ||
panic(unclosedBucketWarnings) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I don't recall the background for this change - is this to better catch this scenario pre-merge?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Originally, this was put in when a Leaky TestBucket was to be passed in to the RT in-order to make sure the bucket was closed manually at the end of the test and can't be missed. I left this change in (even though a TB is no longer passed in) because it would be useful in general as it is quite easy to miss a bucket being left unclosed when not going through all the test logs.
rest/utilities_testing.go
Outdated
|
||
collectionBucket.Spec.Scope = scope | ||
collectionBucket.Spec.Collection = collection | ||
collectionBucket.Collection = collectionBucket.Collection.Bucket().Scope(*scope).Collection(*collection) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
What exactly is going on here? testBucket.Bucket is initialized as a gocb Collection targeting the default collection, and if we have a named collection we're using the associated Bucket() to swap to the underlying collection to the named collection?
Are there any allocations associated with the default collection that need to be cleaned up? I know Collection.Close() doesn't really do any work, but it feels a bit unusual to assign collectionBucket.Collection twice in this setup.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There are no extra allocations done when changing the scope and collection to a named scope and collection. This is because the GoCB Scope
and Collection
functions return the provided bucket wrapped in a GoCB Scope
and Collection
struct.
The change to add scopes and collections when using a leaky bucket is a temporary measure that can be ripped out once tests are backed by collections. |
…ion tests (#5679) * CBG-2201: Added LeakyBucket support to the rest tester under integration tests * Fixed normal buckets double closing causing panic * Added RT option to use leaky bucket on DB * Added panic is not using a leaky bucket£ * Addressed PR feedback, change add database function with connect fn to AddDatabaseFromConfigWithBucket * Added collection support, and use TB on DB if provided in RT if provided * Address PR feedback * Rest tester makes leaky bucket when needed * Modified TestBlipGetCollections to pick up new leaky bucket changes * Removed createScopesAndCollections
…ion tests (#5679) * CBG-2201: Added LeakyBucket support to the rest tester under integration tests * Fixed normal buckets double closing causing panic * Added RT option to use leaky bucket on DB * Added panic is not using a leaky bucket£ * Addressed PR feedback, change add database function with connect fn to AddDatabaseFromConfigWithBucket * Added collection support, and use TB on DB if provided in RT if provided * Address PR feedback * Rest tester makes leaky bucket when needed * Modified TestBlipGetCollections to pick up new leaky bucket changes * Removed createScopesAndCollections
CBG-2201
Pre-review checklist
fmt.Print
,log.Print
, ...)base.UD(docID)
,base.MD(dbName)
)docs/api
Integration Tests
xattrs=true
https://jenkins.sgwdev.com/job/SyncGateway-Integration/675/