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

Function TestMultiCollectionDCP

rest/api_collections_test.go:247–277  ·  view source on GitHub ↗
(t *testing.T)

Source from the content-addressed store, hash-verified

245}
246
247func TestMultiCollectionDCP(t *testing.T) {
248 base.TestRequiresCollections(t)
249 base.SkipImportTestsIfNotEnabled(t)
250
251 const numCollections = 2
252
253 rt := NewRestTesterMultipleCollections(t, &RestTesterConfig{
254 DatabaseConfig: &DatabaseConfig{DbConfig: DbConfig{AutoImport: true}},
255 }, numCollections)
256 defer rt.Close()
257
258 colls := rt.GetDbCollections()
259 require.Len(t, colls, numCollections)
260
261 for _, c := range colls {
262 _, err := c.GetCollectionDatastore().Add(t.Name(), 0, map[string]any{"test": true})
263 require.NoError(t, err)
264 }
265
266 // ensure the docs are picked up by the import DCP feed and actually gets imported
267 err := rt.WaitForCondition(func() bool {
268 return rt.GetDatabase().DbStats.SharedBucketImport().ImportCount.Value() == numCollections
269 })
270 require.NoError(t, err)
271
272 rt.WaitForPendingChanges()
273
274 for _, ks := range rt.GetKeyspaces() {
275 rt.WaitForChanges(1, fmt.Sprintf("/%s/_changes", ks), "", true)
276 }
277}
278
279func TestMultiCollectionChannelAccess(t *testing.T) {
280 base.TestRequiresCollections(t)

Callers

nothing calls this directly

Calls 15

TestRequiresCollectionsFunction · 0.92
GetDbCollectionsMethod · 0.80
WaitForConditionMethod · 0.80
SharedBucketImportMethod · 0.80
GetKeyspacesMethod · 0.80
WaitForChangesMethod · 0.80
CloseMethod · 0.65
LenMethod · 0.65
NameMethod · 0.65

Tested by

no test coverage detected