Skip to content

Commit

Permalink
all: rollback more
Browse files Browse the repository at this point in the history
  • Loading branch information
ainar-g committed Mar 10, 2021
1 parent 989811b commit c1645e2
Show file tree
Hide file tree
Showing 4 changed files with 11 additions and 11 deletions.
11 changes: 5 additions & 6 deletions internal/querylog/qlog_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -8,10 +8,9 @@ import (
"testing"
"time"

"github.com/AdguardTeam/dnsproxy/proxyutil"

"github.com/AdguardTeam/AdGuardHome/internal/aghtest"
"github.com/AdguardTeam/AdGuardHome/internal/dnsfilter"
"github.com/AdguardTeam/dnsproxy/proxyutil"
"github.com/miekg/dns"
"github.com/stretchr/testify/assert"
"github.com/stretchr/testify/require"
Expand All @@ -29,7 +28,7 @@ func TestQueryLog(t *testing.T) {
FileEnabled: true,
Interval: 1,
MemSize: 100,
BaseDir: t.TempDir(),
BaseDir: aghtest.PrepareTestDir(t),
})

// Add disk entries.
Expand Down Expand Up @@ -131,7 +130,7 @@ func TestQueryLogOffsetLimit(t *testing.T) {
Enabled: true,
Interval: 1,
MemSize: 100,
BaseDir: t.TempDir(),
BaseDir: aghtest.PrepareTestDir(t),
})

const (
Expand Down Expand Up @@ -205,7 +204,7 @@ func TestQueryLogMaxFileScanEntries(t *testing.T) {
FileEnabled: true,
Interval: 1,
MemSize: 100,
BaseDir: t.TempDir(),
BaseDir: aghtest.PrepareTestDir(t),
})

const entNum = 10
Expand Down Expand Up @@ -233,7 +232,7 @@ func TestQueryLogFileDisabled(t *testing.T) {
FileEnabled: false,
Interval: 1,
MemSize: 2,
BaseDir: t.TempDir(),
BaseDir: aghtest.PrepareTestDir(t),
})

addEntry(l, "example1.org", net.IPv4(1, 1, 1, 1), net.IPv4(2, 2, 2, 1))
Expand Down
5 changes: 3 additions & 2 deletions internal/querylog/qlogfile_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ import (
"testing"
"time"

"github.com/AdguardTeam/AdGuardHome/internal/aghtest"
"github.com/stretchr/testify/assert"
"github.com/stretchr/testify/require"
)
Expand All @@ -35,7 +36,7 @@ func prepareTestFiles(t *testing.T, filesNum, linesNum int) []string {
lineTime, _ := time.Parse(time.RFC3339Nano, "2020-02-18T22:36:35.920973+03:00")
lineIP := uint32(0)

dir := t.TempDir()
dir := aghtest.PrepareTestDir(t)

files := make([]string, filesNum)
for j := range files {
Expand Down Expand Up @@ -281,7 +282,7 @@ func TestQLogFile(t *testing.T) {
}

func NewTestQLogFileData(t *testing.T, data string) (file *QLogFile) {
f, err := ioutil.TempFile(t.TempDir(), "*.txt")
f, err := ioutil.TempFile(aghtest.PrepareTestDir(t), "*.txt")
require.Nil(t, err)
t.Cleanup(func() {
assert.Nil(t, f.Close())
Expand Down
4 changes: 2 additions & 2 deletions internal/updater/updater_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -100,7 +100,7 @@ func TestUpdateGetVersion(t *testing.T) {
}

func TestUpdate(t *testing.T) {
wd := t.TempDir()
wd := aghtest.PrepareTestDir(t)

assert.Nil(t, ioutil.WriteFile(filepath.Join(wd, "AdGuardHome"), []byte("AdGuardHome"), 0o755))
assert.Nil(t, ioutil.WriteFile(filepath.Join(wd, "README.md"), []byte("README.md"), 0o644))
Expand Down Expand Up @@ -166,7 +166,7 @@ func TestUpdate(t *testing.T) {
}

func TestUpdateWindows(t *testing.T) {
wd := t.TempDir()
wd := aghtest.PrepareTestDir(t)

assert.Nil(t, ioutil.WriteFile(filepath.Join(wd, "AdGuardHome.exe"), []byte("AdGuardHome.exe"), 0o755))
assert.Nil(t, ioutil.WriteFile(filepath.Join(wd, "README.md"), []byte("README.md"), 0o644))
Expand Down
2 changes: 1 addition & 1 deletion internal/util/autohosts_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ func TestMain(m *testing.M) {
func prepareTestFile(t *testing.T) (f *os.File) {
t.Helper()

dir := t.TempDir()
dir := aghtest.PrepareTestDir(t)

f, err := ioutil.TempFile(dir, "")
require.Nil(t, err)
Expand Down

0 comments on commit c1645e2

Please sign in to comment.