From e96fd6e42dd1545df6ffbfed02a6e27575d3b5a1 Mon Sep 17 00:00:00 2001 From: Andrey Meshkov Date: Wed, 15 Apr 2020 14:11:31 +0300 Subject: [PATCH] -: fix qlog test on Windows --- home/home_test.go | 2 +- querylog/qlog.go | 4 +++- 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/home/home_test.go b/home/home_test.go index 8a46e493..4e22e1ba 100644 --- a/home/home_test.go +++ b/home/home_test.go @@ -112,9 +112,9 @@ func TestHome(t *testing.T) { dir := prepareTestDir() defer func() { _ = os.RemoveAll(dir) }() - _ = os.MkdirAll(filepath.Join(Context.getDataDir(), filterDir), 0755) fn := filepath.Join(dir, "AdGuardHome.yaml") + // Prepare the test config assert.True(t, ioutil.WriteFile(fn, []byte(yamlConf), 0644) == nil) fn, _ = filepath.Abs(fn) diff --git a/querylog/qlog.go b/querylog/qlog.go index 9dab0acb..f8792d8f 100644 --- a/querylog/qlog.go +++ b/querylog/qlog.go @@ -206,7 +206,9 @@ func (l *queryLog) getData(params getDataParams) map[string]interface{} { fileEntries, oldest, total := l.searchFiles(params) if params.OlderThan.IsZero() { - params.OlderThan = now + // In case if the timer is not precise (for instance, on Windows) + // We really want to get all records including those added just before the call + params.OlderThan = now.Add(time.Millisecond) } // add from memory buffer