Skip to content

Commit

Permalink
-(home): fix whois test
Browse files Browse the repository at this point in the history
  • Loading branch information
ameshkov committed Jun 17, 2020
1 parent 5f10806 commit 4ce337c
Showing 1 changed file with 3 additions and 9 deletions.
12 changes: 3 additions & 9 deletions home/whois_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -2,28 +2,22 @@ package home

import (
"testing"
"time"

"github.com/AdguardTeam/AdGuardHome/dnsforward"
"github.com/AdguardTeam/dnsproxy/proxy"
"github.com/stretchr/testify/assert"
)

func prepareTestDNSServer() error {
config.DNS.Port = 1234
Context.dnsServer = dnsforward.NewServer(nil, nil, nil)
conf := &dnsforward.ServerConfig{}
uc, err := proxy.ParseUpstreamsConfig([]string{"1.1.1.1"}, nil, time.Second*5)
if err != nil {
return err
}
conf.UpstreamConfig = &uc
conf.UpstreamDNS = []string{"8.8.8.8"}
return Context.dnsServer.Prepare(conf)
}

func TestWhois(t *testing.T) {
err := prepareTestDNSServer()
assert.Nil(t, err)
assert.Nil(t, prepareTestDNSServer())
defer func() { Context = homeContext{} }()

w := Whois{timeoutMsec: 5000}
resp, err := w.queryAll("8.8.8.8")
Expand Down

0 comments on commit 4ce337c

Please sign in to comment.