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

Method updatePersistedConfig

rest/utilities_testing.go:2664–2669  ·  view source on GitHub ↗

updatePersistedConfig is a helper function to update the persisted db config for a given db in the rest tester, bypassing the REST API and not (yet) reloading the database. this can be used to test upgrades or changes in behaviour on older configurations (i.e. change a config to an older state that

(dbName string, updateFunc func(*DatabaseConfig))

Source from the content-addressed store, hash-verified

2662// updatePersistedConfig is a helper function to update the persisted db config for a given db in the rest tester, bypassing the REST API and not (yet) reloading the database.
2663// this can be used to test upgrades or changes in behaviour on older configurations (i.e. change a config to an older state that may not pass new validation rules)
2664func (rt *RestTester) updatePersistedConfig(dbName string, updateFunc func(*DatabaseConfig)) {
2665 // it's safe to just hold the read lock to fetch 'dbName' entry, since we're not modifying the map itself (adding or removing a database by name)
2666 rt.ServerContext()._databasesLock.RLock()
2667 defer rt.ServerContext()._databasesLock.RUnlock()
2668 updateFunc(&rt.ServerContext()._dbConfigs[dbName].DatabaseConfig)
2669}
2670
2671func setChannelsAllCollections(dbConfig DbConfig, principal *auth.PrincipalConfig, channels ...string) {
2672 if dbConfig.Scopes == nil {

Callers 3

TestAllowConflictsConfigFunction · 0.95

Calls 3

ServerContextMethod · 0.95
RLockMethod · 0.80
RUnlockMethod · 0.80

Tested by 3

TestAllowConflictsConfigFunction · 0.76