refactor(netx): dialer does not use legacy/netx anymore (#370)

Part of https://github.com/ooni/probe-engine/issues/897
This commit is contained in:
Simone Basso 2021-06-09 00:29:40 +02:00 committed by GitHub
commit ee35b10a98
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
4 changed files with 8 additions and 41 deletions

View file

@ -7,14 +7,13 @@ import (
"net"
"testing"
"github.com/ooni/probe-cli/v3/internal/engine/legacy/netx/dialid"
"github.com/ooni/probe-cli/v3/internal/engine/netx/dialer"
"github.com/ooni/probe-cli/v3/internal/engine/netx/errorx"
"github.com/ooni/probe-cli/v3/internal/engine/netx/mockablex"
)
func TestErrorWrapperFailure(t *testing.T) {
ctx := dialid.WithDialID(context.Background())
ctx := context.Background()
d := dialer.ErrorWrapperDialer{Dialer: mockablex.Dialer{
MockDialContext: func(ctx context.Context, network string, address string) (net.Conn, error) {
return nil, io.EOF
@ -35,9 +34,6 @@ func errorWrapperCheckErr(t *testing.T, err error, op string) {
if !errors.As(err, &errWrapper) {
t.Fatal("cannot cast to ErrWrapper")
}
if errWrapper.DialID == 0 {
t.Fatal("unexpected DialID")
}
if errWrapper.Operation != op {
t.Fatal("unexpected Operation")
}
@ -47,7 +43,7 @@ func errorWrapperCheckErr(t *testing.T, err error, op string) {
}
func TestErrorWrapperSuccess(t *testing.T) {
ctx := dialid.WithDialID(context.Background())
ctx := context.Background()
d := dialer.ErrorWrapperDialer{Dialer: mockablex.Dialer{
MockDialContext: func(ctx context.Context, network string, address string) (net.Conn, error) {
return &mockablex.Conn{