Pull request 2304: AGDNS-2374-slog-querylog
Squashed commit of the following: commit e98e5efaaf5388551322933321df0707ad7b2a9c Author: Stanislav Chzhen <s.chzhen@adguard.com> Date: Thu Nov 21 13:15:51 2024 +0300 all: imp code commit fbe728c9aa03a325c2733c214412f9071faba5ed Author: Stanislav Chzhen <s.chzhen@adguard.com> Date: Mon Nov 18 20:57:15 2024 +0300 all: imp code commit ef715c58cb6621236424f55268390aa3f997f883 Author: Stanislav Chzhen <s.chzhen@adguard.com> Date: Mon Nov 18 16:39:35 2024 +0300 all: imp code commit cbb993f7ae4311b2a73ace7066a5dabf190291be Author: Stanislav Chzhen <s.chzhen@adguard.com> Date: Mon Nov 18 14:03:42 2024 +0300 all: imp code commit 8d88d799303c7e3d15322fee87780fedb408ea13 Author: Stanislav Chzhen <s.chzhen@adguard.com> Date: Fri Nov 15 15:57:07 2024 +0300 all: slog querylog
This commit is contained in:
@@ -5,6 +5,8 @@ import (
|
||||
"testing"
|
||||
"time"
|
||||
|
||||
"github.com/AdguardTeam/golibs/logutil/slogutil"
|
||||
"github.com/AdguardTeam/golibs/testutil"
|
||||
"github.com/AdguardTeam/golibs/timeutil"
|
||||
"github.com/miekg/dns"
|
||||
"github.com/stretchr/testify/assert"
|
||||
@@ -36,6 +38,7 @@ func TestQueryLog_Search_findClient(t *testing.T) {
|
||||
}
|
||||
|
||||
l, err := newQueryLog(Config{
|
||||
Logger: slogutil.NewDiscardLogger(),
|
||||
FindClient: findClient,
|
||||
BaseDir: t.TempDir(),
|
||||
RotationIvl: timeutil.Day,
|
||||
@@ -45,7 +48,11 @@ func TestQueryLog_Search_findClient(t *testing.T) {
|
||||
AnonymizeClientIP: false,
|
||||
})
|
||||
require.NoError(t, err)
|
||||
t.Cleanup(l.Close)
|
||||
|
||||
ctx := testutil.ContextWithTimeout(t, testTimeout)
|
||||
testutil.CleanupAndRequireSuccess(t, func() (err error) {
|
||||
return l.Shutdown(ctx)
|
||||
})
|
||||
|
||||
q := &dns.Msg{
|
||||
Question: []dns.Question{{
|
||||
@@ -81,7 +88,7 @@ func TestQueryLog_Search_findClient(t *testing.T) {
|
||||
olderThan: time.Now().Add(10 * time.Second),
|
||||
limit: 3,
|
||||
}
|
||||
entries, _ := l.search(sp)
|
||||
entries, _ := l.search(ctx, sp)
|
||||
assert.Equal(t, 2, findClientCalls)
|
||||
|
||||
require.Len(t, entries, 3)
|
||||
|
||||
Reference in New Issue
Block a user