testcontainers-java
testcontainers-java copied to clipboard
[couchbase] Add support for scopes and collections.
This changeset allows to specify scopes and collections to be automatically created, which is available with Couchbase Server 7.0 and later.
The BucketDefinition is expanded to take a ScopeDefinition which itself
can be configured with CollectionDefinitions. During startup, after the
bucket is created, the scopes and collections are stored on the server.
Note that as a nice "bonus", similar to a primary index being automatically
created on a bucket by default (can be turned off), this change also
automatically adds a primary index for each collection created, as long
as the query service is also enabled.
If the server does not support it, a descriptive error message is shown.
Further Reviewer notes:
- The primary index creation and keyspace checks have been refactored
into their own methods since they are now called from two places: once
for the bucket only and once for bucket, scope and collection triple.
- A test case has been added to verify using custom scopes and collections.
To make this work, the enterprise image has been bumped to 7.0 from 6.6.
The community image is left at 6.6 - we could bump it too, but this gives
us a little more test coverage on server versions (pre and post collection
support) for free.