refactor(netx): move dialer's mockable types in mockablex (#368)
Part of https://github.com/ooni/probe/issues/1591
This commit is contained in:
parent
b8cae3f5a6
commit
5b73230a6d
14 changed files with 455 additions and 173 deletions
|
|
@ -4,15 +4,21 @@ import (
|
|||
"context"
|
||||
"errors"
|
||||
"io"
|
||||
"net"
|
||||
"testing"
|
||||
|
||||
"github.com/apex/log"
|
||||
"github.com/ooni/probe-cli/v3/internal/engine/netx/dialer"
|
||||
"github.com/ooni/probe-cli/v3/internal/engine/netx/mockablex"
|
||||
)
|
||||
|
||||
func TestLoggingDialerFailure(t *testing.T) {
|
||||
d := dialer.LoggingDialer{
|
||||
Dialer: dialer.EOFDialer{},
|
||||
Dialer: mockablex.Dialer{
|
||||
MockDialContext: func(ctx context.Context, network string, address string) (net.Conn, error) {
|
||||
return nil, io.EOF
|
||||
},
|
||||
},
|
||||
Logger: log.Log,
|
||||
}
|
||||
conn, err := d.DialContext(context.Background(), "tcp", "www.google.com:443")
|
||||
|
|
|
|||
Loading…
Reference in a new issue