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)
| 3546 | // The star channel is a special channel in Sync Gateway that provides access to all |
| 3547 | // documents, and disabling it is not supported. |
| 3548 | func 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 | |
| 3578 | func TestFetchBackupRevisionWithAttachmentWhenCurrentHasNone(t *testing.T) { |
| 3579 | rt := NewRestTester(t, &RestTesterConfig{ |
nothing calls this directly
no test coverage detected