feat(netxmocks): implement mocks for netxlite.Resolver (#398)

While there, make sure we require using &netxmocks.Dialer.

Still part of https://github.com/ooni/probe/issues/1505
This commit is contained in:
Simone Basso 2021-06-23 16:21:13 +02:00 committed by GitHub
commit c5dd9a68f1
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
9 changed files with 96 additions and 16 deletions

View file

@ -13,7 +13,7 @@ import (
func TestErrorWrapperFailure(t *testing.T) {
ctx := context.Background()
d := &errorWrapperDialer{Dialer: netxmocks.Dialer{
d := &errorWrapperDialer{Dialer: &netxmocks.Dialer{
MockDialContext: func(ctx context.Context, network string, address string) (net.Conn, error) {
return nil, io.EOF
},
@ -43,7 +43,7 @@ func errorWrapperCheckErr(t *testing.T, err error, op string) {
func TestErrorWrapperSuccess(t *testing.T) {
ctx := context.Background()
d := &errorWrapperDialer{Dialer: netxmocks.Dialer{
d := &errorWrapperDialer{Dialer: &netxmocks.Dialer{
MockDialContext: func(ctx context.Context, network string, address string) (net.Conn, error) {
return &netxmocks.Conn{
MockRead: func(b []byte) (int, error) {