Skip to content

Commit

Permalink
fix
Browse files Browse the repository at this point in the history
  • Loading branch information
szolin committed May 27, 2020
1 parent dc38f66 commit db76471
Showing 1 changed file with 18 additions and 0 deletions.
18 changes: 18 additions & 0 deletions home/whois_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -2,11 +2,29 @@ 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
return Context.dnsServer.Prepare(conf)
}

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

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

0 comments on commit db76471

Please sign in to comment.