diff options
author | Patrick Steinhardt <psteinhardt@gitlab.com> | 2023-09-14 10:36:42 +0300 |
---|---|---|
committer | Patrick Steinhardt <psteinhardt@gitlab.com> | 2023-09-18 15:05:40 +0300 |
commit | 85d054935371ff90c74dcad5c0f0aafce38fc32e (patch) | |
tree | d1ec602fcfba322882e8dadf53d826d3ab514e5f /internal/cgroups | |
parent | e0dd71b9d9fdc634ea75bfcae6f24112ad5dec25 (diff) |
tests: Stop using `NullLogger` in favor of our own internal logger
Stop using logrus' `NullLogger` in favor of our own internal logger that
can be set up with the testhelper package.
Diffstat (limited to 'internal/cgroups')
-rw-r--r-- | internal/cgroups/v1_linux_test.go | 6 | ||||
-rw-r--r-- | internal/cgroups/v2_linux_test.go | 3 |
2 files changed, 4 insertions, 5 deletions
diff --git a/internal/cgroups/v1_linux_test.go b/internal/cgroups/v1_linux_test.go index d8bc70383..ba8a55b29 100644 --- a/internal/cgroups/v1_linux_test.go +++ b/internal/cgroups/v1_linux_test.go @@ -15,7 +15,6 @@ import ( cgrps "github.com/containerd/cgroups/v3" "github.com/prometheus/client_golang/prometheus/testutil" - "github.com/sirupsen/logrus/hooks/test" "github.com/stretchr/testify/assert" "github.com/stretchr/testify/require" "gitlab.com/gitlab-org/gitaly/v16/internal/gitaly/config/cgroups" @@ -522,7 +521,8 @@ func TestPruneOldCgroups(t *testing.T) { pid := tc.setup(t, tc.cfg, mock) - logger, hook := test.NewNullLogger() + logger := testhelper.NewLogger(t) + hook := testhelper.AddLoggerHook(logger) mock.pruneOldCgroups(tc.cfg, logger) @@ -542,7 +542,7 @@ func TestPruneOldCgroups(t *testing.T) { } else { require.DirExists(t, oldGitalyProcessMemoryDir) require.DirExists(t, oldGitalyProcesssCPUDir) - require.Len(t, hook.Entries, 0) + require.Empty(t, hook.AllEntries()) } }) } diff --git a/internal/cgroups/v2_linux_test.go b/internal/cgroups/v2_linux_test.go index 0215edb39..96c5a3fdb 100644 --- a/internal/cgroups/v2_linux_test.go +++ b/internal/cgroups/v2_linux_test.go @@ -15,7 +15,6 @@ import ( cgrps "github.com/containerd/cgroups/v3" "github.com/prometheus/client_golang/prometheus/testutil" - "github.com/sirupsen/logrus/hooks/test" "github.com/stretchr/testify/assert" "github.com/stretchr/testify/require" "gitlab.com/gitlab-org/gitaly/v16/internal/gitaly/config/cgroups" @@ -500,7 +499,7 @@ func TestPruneOldCgroupsV2(t *testing.T) { pid := tc.setup(t, tc.cfg, mock) - logger, _ := test.NewNullLogger() + logger := testhelper.NewLogger(t) mock.pruneOldCgroups(tc.cfg, logger) // create cgroups directories with a different pid |