ooni-probe-cli/internal/engine/netx/resolver/chain_test.go

30 lines
625 B
Go
Raw Normal View History

package resolver_test
import (
"context"
"testing"
"github.com/ooni/probe-cli/v3/internal/engine/netx/resolver"
2021-06-23 15:53:12 +02:00
"github.com/ooni/probe-cli/v3/internal/netxlite"
)
func TestChainLookupHost(t *testing.T) {
r := resolver.ChainResolver{
Primary: resolver.NewFakeResolverThatFails(),
Secondary: &netxlite.ResolverSystem{},
}
if r.Address() != "" {
t.Fatal("invalid address")
}
if r.Network() != "chain" {
t.Fatal("invalid network")
}
addrs, err := r.LookupHost(context.Background(), "www.google.com")
if err != nil {
t.Fatal(err)
}
if addrs == nil {
t.Fatal("expect non nil return value here")
}
}