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

Function TestAuditLogConfigDatabaseEventInGlobal

rest/config_test.go:701–717  ·  view source on GitHub ↗
(t *testing.T)

Source from the content-addressed store, hash-verified

699}
700
701func TestAuditLogConfigDatabaseEventInGlobal(t *testing.T) {
702 base.ResetGlobalTestLogging(t)
703 base.InitializeMemoryLoggers()
704
705 sc := NewEmptyStartupConfig()
706 sc.Logging.LogFilePath = t.TempDir()
707 sc.Logging.Audit.Enabled = base.Ptr(true)
708 sc.Logging.Audit.EnabledEvents = []uint{
709 uint(base.AuditIDSyncGatewayStartup), // global, non-filterable
710 uint(base.AuditIDUserCreate), // database, filterable
711 uint(base.AuditIDSyncGatewayCollectInfoStart), // global, filterable
712 }
713
714 err := sc.SetupAndValidateLogging(base.TestCtx(t))
715 assert.ErrorContains(t, err, "1 errors")
716 assert.ErrorContains(t, err, "audit event ID 54100 \"Create user\" can only be configured at the database level")
717}
718
719func TestServerConfigValidate(t *testing.T) {
720 base.SetUpTestLogging(t, base.LevelInfo, base.KeyAll)

Callers

nothing calls this directly

Calls 6

ResetGlobalTestLoggingFunction · 0.92
InitializeMemoryLoggersFunction · 0.92
PtrFunction · 0.92
TestCtxFunction · 0.92
NewEmptyStartupConfigFunction · 0.85

Tested by

no test coverage detected