Pull request: querylog: fix logic

Merge in DNS/adguard-home from fix-querylog-logs to master

Squashed commit of the following:

commit db6edb86f1f024c85efd3bca3ceb6dfc6ce04edd
Merge: d1981696 a3968658
Author: Ainar Garipov <A.Garipov@AdGuard.COM>
Date:   Mon Dec 13 13:48:25 2021 +0300

    Merge branch 'master' into fix-querylog-logs

commit d1981696782ca9adc5213f76cdbe2dc9f859f921
Author: Ainar Garipov <A.Garipov@AdGuard.COM>
Date:   Fri Dec 10 21:14:04 2021 +0300

    querylog: fix logic
This commit is contained in:
Ainar Garipov
2021-12-13 13:55:41 +03:00
parent a396865869
commit 0bd436f4b0
6 changed files with 40 additions and 29 deletions

View File

@@ -175,7 +175,7 @@ func TestQLogFile_SeekTS_good(t *testing.T) {
assert.NotEqualValues(t, 0, ts)
// Try seeking to that line now.
pos, _, err := q.SeekTS(ts)
pos, _, err := q.seekTS(ts)
require.NoError(t, err)
assert.NotEqualValues(t, 0, pos)
@@ -228,7 +228,7 @@ func TestQLogFile_SeekTS_bad(t *testing.T) {
assert.NotEqualValues(t, 0, tc.ts)
var depth int
_, depth, err = q.SeekTS(tc.ts)
_, depth, err = q.seekTS(tc.ts)
assert.NotEmpty(t, l.num)
require.Error(t, err)
@@ -340,7 +340,7 @@ func TestQLog_Seek(t *testing.T) {
q := NewTestQLogFileData(t, data)
_, depth, err := q.SeekTS(timestamp.Add(time.Second * time.Duration(tc.delta)).UnixNano())
_, depth, err := q.seekTS(timestamp.Add(time.Second * time.Duration(tc.delta)).UnixNano())
require.Truef(t, errors.Is(err, tc.wantErr), "%v", err)
assert.Equal(t, tc.wantDepth, depth)
})