diff options
author | Igor Drozdov <idrozdov@gitlab.com> | 2021-08-02 05:17:13 +0000 |
---|---|---|
committer | Igor Drozdov <idrozdov@gitlab.com> | 2021-08-02 05:17:13 +0000 |
commit | 00735e0bbf51e28bcec5086d9d0f62999d19d2c5 (patch) | |
tree | f5a516a237c8856c46a569615ad63d2d37f3bb0d /internal/testhelper/testhelper.go | |
parent | b7edd7dd9f957c6b14d3bfa4407aca9ddfbe4f52 (diff) | |
parent | 72d70eab03d38b7c01054b7c598d17afe177212a (diff) | |
download | gitlab-shell-00735e0bbf51e28bcec5086d9d0f62999d19d2c5.tar.gz |
Merge branch '477-remove-logrus-tests' into 'main'
Remove some unreliable tests
Closes #477
See merge request gitlab-org/gitlab-shell!503
Diffstat (limited to 'internal/testhelper/testhelper.go')
-rw-r--r-- | internal/testhelper/testhelper.go | 25 |
1 files changed, 0 insertions, 25 deletions
diff --git a/internal/testhelper/testhelper.go b/internal/testhelper/testhelper.go index 933da00..65fb975 100644 --- a/internal/testhelper/testhelper.go +++ b/internal/testhelper/testhelper.go @@ -7,11 +7,8 @@ import ( "path" "runtime" "testing" - "time" "github.com/otiai10/copy" - "github.com/sirupsen/logrus" - "github.com/sirupsen/logrus/hooks/test" "github.com/stretchr/testify/require" ) @@ -75,25 +72,3 @@ func Setenv(key, value string) (func(), error) { err := os.Setenv(key, value) return func() { os.Setenv(key, oldValue) }, err } - -func SetupLogger() *test.Hook { - logger, hook := test.NewNullLogger() - logrus.SetOutput(logger.Writer()) - - return hook -} - -// logrus fires a Goroutine to write the output log, but there's no way to -// flush all outstanding hooks to fire. We just wait up to a second -// for an event to appear. -func WaitForLogEvent(hook *test.Hook) bool { - for i := 0; i < 10; i++ { - if entry := hook.LastEntry(); entry != nil { - return true - } - - time.Sleep(100 * time.Millisecond) - } - - return false -} |