diff options
author | Bjørn Erik Pedersen <[email protected]> | 2023-06-16 08:17:42 +0200 |
---|---|---|
committer | Bjørn Erik Pedersen <[email protected]> | 2023-06-18 13:03:04 +0200 |
commit | 7c9fada778e91976d4ba1cbe942235a9bbeaf5cb (patch) | |
tree | a717f6e0a5915777ae6859564acd13385213bbab /helpers/general_test.go | |
parent | 0e7944658660b5658b7640dce3cb346d7198d8c9 (diff) | |
download | hugo-7c9fada778e91976d4ba1cbe942235a9bbeaf5cb.tar.gz hugo-7c9fada778e91976d4ba1cbe942235a9bbeaf5cb.zip |
Replace the old log setup, with structured logging etc.
Fixes #11124
Diffstat (limited to 'helpers/general_test.go')
-rw-r--r-- | helpers/general_test.go | 56 |
1 files changed, 0 insertions, 56 deletions
diff --git a/helpers/general_test.go b/helpers/general_test.go index 9b2e4fc58..827411027 100644 --- a/helpers/general_test.go +++ b/helpers/general_test.go @@ -18,9 +18,7 @@ import ( "reflect" "strings" "testing" - "time" - "github.com/gohugoio/hugo/common/loggers" "github.com/gohugoio/hugo/helpers" qt "github.com/frankban/quicktest" @@ -55,60 +53,6 @@ func TestResolveMarkup(t *testing.T) { } } -func TestDistinctLoggerDoesNotLockOnWarningPanic(t *testing.T) { - // Testing to make sure logger mutex doesn't lock if warnings cause panics. - // func Warnf() of DistinctLogger is defined in general.go - l := helpers.NewDistinctLogger(loggers.NewWarningLogger()) - - // Set PanicOnWarning to true to reproduce issue 9380 - // Ensure global variable loggers.PanicOnWarning is reset to old value after test - if !loggers.PanicOnWarning.Load() { - loggers.PanicOnWarning.Store(true) - defer func() { - loggers.PanicOnWarning.Store(false) - }() - } - - // Establish timeout in case a lock occurs: - timeIsUp := make(chan bool) - timeOutSeconds := 1 - go func() { - time.Sleep(time.Second * time.Duration(timeOutSeconds)) - timeIsUp <- true - }() - - // Attempt to run multiple logging threads in parallel - counterC := make(chan int) - goroutines := 5 - - for i := 0; i < goroutines; i++ { - go func() { - defer func() { - // Intentional panic successfully recovered - notify counter channel - recover() - counterC <- 1 - }() - - l.Warnf("Placeholder template message: %v", "In this test, logging a warning causes a panic.") - }() - } - - // All goroutines should complete before timeout - var counter int - for { - select { - case <-counterC: - counter++ - if counter == goroutines { - return - } - case <-timeIsUp: - t.Errorf("Unable to log warnings with --panicOnWarning within alloted time of: %v seconds. Investigate possible mutex locking on panic in distinct warning logger.", timeOutSeconds) - return - } - } -} - func TestFirstUpper(t *testing.T) { for i, this := range []struct { in string |