mirror of
https://github.com/lukaszraczylo/graphql-monitoring-proxy.git
synced 2026-06-05 23:03:48 +00:00
Gofmt the codebase.
This commit is contained in:
+14
-14
@@ -31,73 +31,73 @@ func (suite *EventsTestSuite) Test_EnableHasuraEventCleaner() {
|
||||
cfgMutex.RLock()
|
||||
originalConfig := cfg.HasuraEventCleaner
|
||||
cfgMutex.RUnlock()
|
||||
|
||||
|
||||
defer func() {
|
||||
cfgMutex.Lock()
|
||||
cfg.HasuraEventCleaner = originalConfig
|
||||
cfgMutex.Unlock()
|
||||
}()
|
||||
|
||||
|
||||
// Set up test condition with proper synchronization
|
||||
cfgMutex.Lock()
|
||||
cfg.HasuraEventCleaner.Enable = false
|
||||
cfgMutex.Unlock()
|
||||
|
||||
|
||||
// Test function
|
||||
enableHasuraEventCleaner()
|
||||
|
||||
|
||||
// No assertions needed as we're just testing coverage
|
||||
// The function should return early without error
|
||||
})
|
||||
|
||||
|
||||
// Test case: missing database URL
|
||||
suite.Run("missing database URL", func() {
|
||||
// Save original config with proper synchronization
|
||||
cfgMutex.RLock()
|
||||
originalConfig := cfg.HasuraEventCleaner
|
||||
cfgMutex.RUnlock()
|
||||
|
||||
|
||||
defer func() {
|
||||
cfgMutex.Lock()
|
||||
cfg.HasuraEventCleaner = originalConfig
|
||||
cfgMutex.Unlock()
|
||||
}()
|
||||
|
||||
|
||||
// Set up test condition with proper synchronization
|
||||
cfgMutex.Lock()
|
||||
cfg.HasuraEventCleaner.Enable = true
|
||||
cfg.HasuraEventCleaner.EventMetadataDb = ""
|
||||
cfgMutex.Unlock()
|
||||
|
||||
|
||||
// Test function
|
||||
enableHasuraEventCleaner()
|
||||
|
||||
|
||||
// No assertions needed as we're just testing coverage
|
||||
// The function should log a warning and return early
|
||||
})
|
||||
|
||||
|
||||
// Test case: database URL provided but we don't actually connect in the test
|
||||
suite.Run("database URL provided", func() {
|
||||
// Save original config with proper synchronization
|
||||
cfgMutex.RLock()
|
||||
originalConfig := cfg.HasuraEventCleaner
|
||||
cfgMutex.RUnlock()
|
||||
|
||||
|
||||
defer func() {
|
||||
cfgMutex.Lock()
|
||||
cfg.HasuraEventCleaner = originalConfig
|
||||
cfgMutex.Unlock()
|
||||
}()
|
||||
|
||||
|
||||
// Set up test condition with proper synchronization
|
||||
cfgMutex.Lock()
|
||||
cfg.HasuraEventCleaner.Enable = true
|
||||
cfg.HasuraEventCleaner.EventMetadataDb = "postgres://fake:fake@localhost:5432/fake"
|
||||
cfg.HasuraEventCleaner.ClearOlderThan = 7
|
||||
cfgMutex.Unlock()
|
||||
|
||||
|
||||
// We're not going to call enableHasuraEventCleaner() here because it would
|
||||
// try to connect to a database. Instead, we're just increasing coverage
|
||||
// for the configuration path by setting these values.
|
||||
})
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user