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

Function createAuditLoggingRestTester

rest/audit_test.go:1601–1644  ·  view source on GitHub ↗
(t *testing.T)

Source from the content-addressed store, hash-verified

1599}
1600
1601func createAuditLoggingRestTester(t *testing.T) *RestTester {
1602 if !base.IsEnterpriseEdition() {
1603 t.Skip("Audit logging only works in EE")
1604 }
1605 // get tempdir before resetting global loggers, since the logger cleanup needs to happen before deletion
1606 tempdir := t.TempDir()
1607 base.ResetGlobalTestLogging(t)
1608 base.InitializeMemoryLoggers()
1609 rt := NewRestTester(t, &RestTesterConfig{
1610 GuestEnabled: true, // for blip testing
1611 PersistentConfig: true,
1612 SyncFn: `function(doc) {channel(doc.channels);}`,
1613 MutateStartupConfig: func(config *StartupConfig) {
1614 config.Logging = base.LoggingConfig{
1615 LogFilePath: tempdir,
1616 Audit: &base.AuditLoggerConfig{
1617 FileLoggerConfig: base.FileLoggerConfig{
1618 Enabled: base.Ptr(true),
1619 CollationBufferSize: base.Ptr(0), // avoid data race in collation with FlushLogBuffers test code
1620 },
1621 },
1622 Console: &base.ConsoleLoggerConfig{
1623 FileLoggerConfig: base.FileLoggerConfig{
1624 Enabled: base.Ptr(true),
1625 },
1626 },
1627 Info: &base.FileLoggerConfig{
1628 Enabled: base.Ptr(false),
1629 CollationBufferSize: base.Ptr(0), // avoid data race in collation with FlushLogBuffers test code
1630 },
1631 Debug: &base.FileLoggerConfig{
1632 Enabled: base.Ptr(false),
1633 CollationBufferSize: base.Ptr(0), // avoid data race in collation with FlushLogBuffers test code
1634 },
1635 Trace: &base.FileLoggerConfig{
1636 Enabled: base.Ptr(false),
1637 CollationBufferSize: base.Ptr(0), // avoid data race in collation with FlushLogBuffers test code
1638 },
1639 }
1640 require.NoError(t, config.SetupAndValidateLogging(base.TestCtx(t)))
1641 },
1642 })
1643 return rt
1644}
1645
1646// TestAuditBlipAttachmentCRUD uses BLIP replication to test attachment CRUD operations and ensures each event is audited correctly.
1647func TestAuditBlipAttachmentCRUD(t *testing.T) {

Calls 7

IsEnterpriseEditionFunction · 0.92
ResetGlobalTestLoggingFunction · 0.92
InitializeMemoryLoggersFunction · 0.92
PtrFunction · 0.92
TestCtxFunction · 0.92
NewRestTesterFunction · 0.85

Tested by

no test coverage detected