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

Function TestDisableAllowStarChannel

rest/api_test.go:3548–3576  ·  view source on GitHub ↗

TestDisableAllowStarChannel verifies that the database configuration does not allow a database to be loaded with the `enable_star_channel` property to be set to false. The star channel is a special channel in Sync Gateway that provides access to all documents, and disabling it is not supported.

(t *testing.T)

Source from the content-addressed store, hash-verified

3546// The star channel is a special channel in Sync Gateway that provides access to all
3547// documents, and disabling it is not supported.
3548func TestDisableAllowStarChannel(t *testing.T) {
3549 ctx := t.Context()
3550 rt := NewRestTester(t, &RestTesterConfig{
3551 PersistentConfig: true,
3552 SyncFn: channels.DocChannelsSyncFunction,
3553 })
3554 defer rt.Close()
3555
3556 const (
3557 dbName = "db"
3558 errResp = "enable_star_channel cannot be set to false"
3559 )
3560
3561 dbConfig := rt.NewDbConfig()
3562 dbConfig.Name = dbName
3563
3564 resp := rt.CreateDatabase(dbName, dbConfig)
3565 RequireStatus(t, resp, http.StatusCreated)
3566
3567 // Attempting to disable `enable_star_channel`
3568 rt.updatePersistedConfig(dbName, func(config *DatabaseConfig) {
3569 config.CacheConfig.ChannelCacheConfig.EnableStarChannel = base.Ptr(false)
3570 })
3571
3572 // Reloading the database after updating the config
3573 _, err := rt.ServerContext().ReloadDatabase(ctx, dbName, false)
3574 assert.Error(t, err, errResp)
3575 base.DebugfCtx(t.Context(), base.KeySGTest, "additional logs")
3576}
3577
3578func TestFetchBackupRevisionWithAttachmentWhenCurrentHasNone(t *testing.T) {
3579 rt := NewRestTester(t, &RestTesterConfig{

Callers

nothing calls this directly

Calls 12

CloseMethod · 0.95
NewDbConfigMethod · 0.95
CreateDatabaseMethod · 0.95
updatePersistedConfigMethod · 0.95
ServerContextMethod · 0.95
PtrFunction · 0.92
DebugfCtxFunction · 0.92
NewRestTesterFunction · 0.85
RequireStatusFunction · 0.85
ReloadDatabaseMethod · 0.80
ContextMethod · 0.65
ErrorMethod · 0.45

Tested by

no test coverage detected