refactor: move tunnel pkg down one level (#358)

* refactor: move tunnel pkg down one level

While there, reduce unnecessary dependency on external packages.

* file I forgot to commit
This commit is contained in:
Simone Basso 2021-06-04 15:15:41 +02:00 committed by GitHub
parent 39aec6677d
commit 3cb6c7c6fb
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
21 changed files with 69 additions and 65 deletions

View File

@ -17,12 +17,12 @@ import (
"github.com/ooni/probe-cli/v3/internal/engine/experiment/urlgetter" "github.com/ooni/probe-cli/v3/internal/engine/experiment/urlgetter"
"github.com/ooni/probe-cli/v3/internal/engine/httpheader" "github.com/ooni/probe-cli/v3/internal/engine/httpheader"
"github.com/ooni/probe-cli/v3/internal/randx"
"github.com/ooni/probe-cli/v3/internal/engine/model" "github.com/ooni/probe-cli/v3/internal/engine/model"
"github.com/ooni/probe-cli/v3/internal/engine/netx" "github.com/ooni/probe-cli/v3/internal/engine/netx"
"github.com/ooni/probe-cli/v3/internal/engine/netx/archival" "github.com/ooni/probe-cli/v3/internal/engine/netx/archival"
"github.com/ooni/probe-cli/v3/internal/engine/netx/errorx" "github.com/ooni/probe-cli/v3/internal/engine/netx/errorx"
"github.com/ooni/probe-cli/v3/internal/engine/netx/selfcensor" "github.com/ooni/probe-cli/v3/internal/engine/netx/selfcensor"
"github.com/ooni/probe-cli/v3/internal/randx"
) )
const ( const (

View File

@ -11,11 +11,11 @@ import (
"strings" "strings"
"time" "time"
"github.com/ooni/probe-cli/v3/internal/randx"
"github.com/ooni/probe-cli/v3/internal/engine/model" "github.com/ooni/probe-cli/v3/internal/engine/model"
"github.com/ooni/probe-cli/v3/internal/engine/netx" "github.com/ooni/probe-cli/v3/internal/engine/netx"
"github.com/ooni/probe-cli/v3/internal/engine/netx/archival" "github.com/ooni/probe-cli/v3/internal/engine/netx/archival"
"github.com/ooni/probe-cli/v3/internal/engine/netx/errorx" "github.com/ooni/probe-cli/v3/internal/engine/netx/errorx"
"github.com/ooni/probe-cli/v3/internal/randx"
) )
const ( const (

View File

@ -10,7 +10,7 @@ import (
"github.com/ooni/probe-cli/v3/internal/engine/netx/archival" "github.com/ooni/probe-cli/v3/internal/engine/netx/archival"
"github.com/ooni/probe-cli/v3/internal/engine/netx/errorx" "github.com/ooni/probe-cli/v3/internal/engine/netx/errorx"
"github.com/ooni/probe-cli/v3/internal/engine/netx/trace" "github.com/ooni/probe-cli/v3/internal/engine/netx/trace"
"github.com/ooni/probe-cli/v3/internal/engine/tunnel" "github.com/ooni/probe-cli/v3/internal/tunnel"
) )
// The Getter gets the specified target in the context of the // The Getter gets the specified target in the context of the

View File

@ -6,8 +6,8 @@ import (
"github.com/google/go-cmp/cmp" "github.com/google/go-cmp/cmp"
"github.com/ooni/probe-cli/v3/internal/engine/experiment/urlgetter" "github.com/ooni/probe-cli/v3/internal/engine/experiment/urlgetter"
"github.com/ooni/probe-cli/v3/internal/engine/experiment/webconnectivity" "github.com/ooni/probe-cli/v3/internal/engine/experiment/webconnectivity"
"github.com/ooni/probe-cli/v3/internal/randx"
"github.com/ooni/probe-cli/v3/internal/engine/netx/archival" "github.com/ooni/probe-cli/v3/internal/engine/netx/archival"
"github.com/ooni/probe-cli/v3/internal/randx"
) )
func TestHTTPBodyLengthChecks(t *testing.T) { func TestHTTPBodyLengthChecks(t *testing.T) {

View File

@ -9,8 +9,8 @@ import (
"net/http" "net/http"
"time" "time"
"github.com/ooni/probe-cli/v3/internal/multierror"
"github.com/ooni/probe-cli/v3/internal/engine/netx" "github.com/ooni/probe-cli/v3/internal/engine/netx"
"github.com/ooni/probe-cli/v3/internal/multierror"
) )
var ( var (

View File

@ -17,9 +17,9 @@ import (
"github.com/ooni/probe-cli/v3/internal/engine/netx" "github.com/ooni/probe-cli/v3/internal/engine/netx"
"github.com/ooni/probe-cli/v3/internal/engine/netx/bytecounter" "github.com/ooni/probe-cli/v3/internal/engine/netx/bytecounter"
"github.com/ooni/probe-cli/v3/internal/engine/probeservices" "github.com/ooni/probe-cli/v3/internal/engine/probeservices"
"github.com/ooni/probe-cli/v3/internal/engine/tunnel"
"github.com/ooni/probe-cli/v3/internal/kvstore" "github.com/ooni/probe-cli/v3/internal/kvstore"
"github.com/ooni/probe-cli/v3/internal/platform" "github.com/ooni/probe-cli/v3/internal/platform"
"github.com/ooni/probe-cli/v3/internal/tunnel"
"github.com/ooni/probe-cli/v3/internal/version" "github.com/ooni/probe-cli/v3/internal/version"
) )

View File

@ -23,21 +23,26 @@ type Logger interface {
// to fill all the mandatory fields. You SHOULD NOT modify the content of this // to fill all the mandatory fields. You SHOULD NOT modify the content of this
// structure while in use, because that may lead to data races. // structure while in use, because that may lead to data races.
type Config struct { type Config struct {
// Logger is the logger to use. If empty we use a default // Name is the MANDATORY name of the tunnel. We support
// implementation that does not emit any output.
Logger Logger
// Name is the mandatory name of the tunnel. We support
// "tor", "psiphon", and "fake" tunnels. You SHOULD // "tor", "psiphon", and "fake" tunnels. You SHOULD
// use "fake" tunnels only for testing: they don't provide // use "fake" tunnels only for testing: they don't provide
// any real tunneling, just a socks5 proxy. // any real tunneling, just a socks5 proxy.
Name string Name string
// Session is the mandatory measurement session, or a suitable // Session is the MANDATORY measurement session, or a suitable
// mock of the required functionality. That is, the possibility // mock of the required functionality. That is, the possibility
// of obtaining a valid psiphon configuration. // of obtaining a valid psiphon configuration.
Session Session Session Session
// TunnelDir is the MANDATORY directory in which the tunnel SHOULD
// store its state, if any. If this field is empty, the
// Start function fails with ErrEmptyTunnelDir.
TunnelDir string
// Logger is the optional logger to use. If empty we use a default
// implementation that does not emit any output.
Logger Logger
// TorArgs contains the optional arguments that you want us to pass // TorArgs contains the optional arguments that you want us to pass
// to the tor binary when invoking it. By default we do not // to the tor binary when invoking it. By default we do not
// pass any extra argument. This flag might be useful to // pass any extra argument. This flag might be useful to
@ -48,11 +53,6 @@ type Config struct {
// executing. When not set, we execute `tor`. // executing. When not set, we execute `tor`.
TorBinary string TorBinary string
// TunnelDir is the mandatory directory in which the tunnel SHOULD
// store its state, if any. If this field is empty, the
// Start function fails with ErrEmptyTunnelDir.
TunnelDir string
// testExecabsLookPath allows us to mock exeabs.LookPath // testExecabsLookPath allows us to mock exeabs.LookPath
testExecabsLookPath func(name string) (string, error) testExecabsLookPath func(name string) (string, error)

View File

@ -7,7 +7,7 @@ import (
"github.com/apex/log" "github.com/apex/log"
"github.com/ooni/probe-cli/v3/internal/engine" "github.com/ooni/probe-cli/v3/internal/engine"
"github.com/ooni/probe-cli/v3/internal/engine/tunnel" "github.com/ooni/probe-cli/v3/internal/tunnel"
) )
func TestFakeStartStop(t *testing.T) { func TestFakeStartStop(t *testing.T) {

View File

@ -8,13 +8,12 @@ import (
"testing" "testing"
"github.com/armon/go-socks5" "github.com/armon/go-socks5"
"github.com/ooni/probe-cli/v3/internal/engine/internal/mockable"
) )
func TestFakeWithCancelledContext(t *testing.T) { func TestFakeWithCancelledContext(t *testing.T) {
ctx, cancel := context.WithCancel(context.Background()) ctx, cancel := context.WithCancel(context.Background())
cancel() // immediately fail cancel() // immediately fail
sess := &mockable.Session{} sess := &MockableSession{}
tunnel, err := fakeStart(ctx, &Config{ tunnel, err := fakeStart(ctx, &Config{
Session: sess, Session: sess,
TunnelDir: "testdata", TunnelDir: "testdata",
@ -29,7 +28,7 @@ func TestFakeWithCancelledContext(t *testing.T) {
func TestFakeWithEmptyTunnelDir(t *testing.T) { func TestFakeWithEmptyTunnelDir(t *testing.T) {
ctx := context.Background() ctx := context.Background()
sess := &mockable.Session{} sess := &MockableSession{}
tunnel, err := fakeStart(ctx, &Config{ tunnel, err := fakeStart(ctx, &Config{
Session: sess, Session: sess,
TunnelDir: "", TunnelDir: "",
@ -45,7 +44,7 @@ func TestFakeWithEmptyTunnelDir(t *testing.T) {
func TestFakeWithFailingMkdirAll(t *testing.T) { func TestFakeWithFailingMkdirAll(t *testing.T) {
expected := errors.New("mocked error") expected := errors.New("mocked error")
ctx := context.Background() ctx := context.Background()
sess := &mockable.Session{} sess := &MockableSession{}
tunnel, err := fakeStart(ctx, &Config{ tunnel, err := fakeStart(ctx, &Config{
Session: sess, Session: sess,
TunnelDir: "testdata", TunnelDir: "testdata",
@ -64,7 +63,7 @@ func TestFakeWithFailingMkdirAll(t *testing.T) {
func TestFakeSocks5NewFails(t *testing.T) { func TestFakeSocks5NewFails(t *testing.T) {
expected := errors.New("mocked error") expected := errors.New("mocked error")
ctx := context.Background() ctx := context.Background()
sess := &mockable.Session{} sess := &MockableSession{}
tunnel, err := fakeStart(ctx, &Config{ tunnel, err := fakeStart(ctx, &Config{
Session: sess, Session: sess,
TunnelDir: "testdata", TunnelDir: "testdata",
@ -83,7 +82,7 @@ func TestFakeSocks5NewFails(t *testing.T) {
func TestFakeNetListenFails(t *testing.T) { func TestFakeNetListenFails(t *testing.T) {
expected := errors.New("mocked error") expected := errors.New("mocked error")
ctx := context.Background() ctx := context.Background()
sess := &mockable.Session{} sess := &MockableSession{}
tunnel, err := fakeStart(ctx, &Config{ tunnel, err := fakeStart(ctx, &Config{
Session: sess, Session: sess,
TunnelDir: "testdata", TunnelDir: "testdata",

View File

@ -7,7 +7,7 @@ import (
"github.com/apex/log" "github.com/apex/log"
"github.com/ooni/probe-cli/v3/internal/engine" "github.com/ooni/probe-cli/v3/internal/engine"
"github.com/ooni/probe-cli/v3/internal/engine/tunnel" "github.com/ooni/probe-cli/v3/internal/tunnel"
) )
func TestPsiphonStartStop(t *testing.T) { func TestPsiphonStartStop(t *testing.T) {

View File

@ -6,14 +6,13 @@ import (
"os" "os"
"testing" "testing"
"github.com/ooni/probe-cli/v3/internal/engine/internal/mockable"
"github.com/ooni/psiphon/oopsi/github.com/Psiphon-Labs/psiphon-tunnel-core/ClientLibrary/clientlib" "github.com/ooni/psiphon/oopsi/github.com/Psiphon-Labs/psiphon-tunnel-core/ClientLibrary/clientlib"
) )
func TestPsiphonWithCancelledContext(t *testing.T) { func TestPsiphonWithCancelledContext(t *testing.T) {
ctx, cancel := context.WithCancel(context.Background()) ctx, cancel := context.WithCancel(context.Background())
cancel() // immediately fail cancel() // immediately fail
sess := &mockable.Session{} sess := &MockableSession{}
tunnel, err := psiphonStart(ctx, &Config{ tunnel, err := psiphonStart(ctx, &Config{
Session: sess, Session: sess,
TunnelDir: "testdata", TunnelDir: "testdata",
@ -28,7 +27,7 @@ func TestPsiphonWithCancelledContext(t *testing.T) {
func TestPsiphonWithEmptyTunnelDir(t *testing.T) { func TestPsiphonWithEmptyTunnelDir(t *testing.T) {
ctx := context.Background() ctx := context.Background()
sess := &mockable.Session{} sess := &MockableSession{}
tunnel, err := psiphonStart(ctx, &Config{ tunnel, err := psiphonStart(ctx, &Config{
Session: sess, Session: sess,
TunnelDir: "", TunnelDir: "",
@ -43,8 +42,8 @@ func TestPsiphonWithEmptyTunnelDir(t *testing.T) {
func TestPsiphonFetchPsiphonConfigFailure(t *testing.T) { func TestPsiphonFetchPsiphonConfigFailure(t *testing.T) {
expected := errors.New("mocked error") expected := errors.New("mocked error")
sess := &mockable.Session{ sess := &MockableSession{
MockableFetchPsiphonConfigErr: expected, Err: expected,
} }
tunnel, err := psiphonStart(context.Background(), &Config{ tunnel, err := psiphonStart(context.Background(), &Config{
Session: sess, Session: sess,
@ -60,8 +59,8 @@ func TestPsiphonFetchPsiphonConfigFailure(t *testing.T) {
func TestPsiphonMkdirAllFailure(t *testing.T) { func TestPsiphonMkdirAllFailure(t *testing.T) {
expected := errors.New("mocked error") expected := errors.New("mocked error")
sess := &mockable.Session{ sess := &MockableSession{
MockableFetchPsiphonConfigResult: []byte(`{}`), Result: []byte(`{}`),
} }
tunnel, err := psiphonStart(context.Background(), &Config{ tunnel, err := psiphonStart(context.Background(), &Config{
Session: sess, Session: sess,
@ -80,8 +79,8 @@ func TestPsiphonMkdirAllFailure(t *testing.T) {
func TestPsiphonStartFailure(t *testing.T) { func TestPsiphonStartFailure(t *testing.T) {
expected := errors.New("mocked error") expected := errors.New("mocked error")
sess := &mockable.Session{ sess := &MockableSession{
MockableFetchPsiphonConfigResult: []byte(`{}`), Result: []byte(`{}`),
} }
tunnel, err := psiphonStart(context.Background(), &Config{ tunnel, err := psiphonStart(context.Background(), &Config{
Session: sess, Session: sess,

View File

@ -0,0 +1,17 @@
package tunnel
import "context"
// MockableSession is a mockable session.
type MockableSession struct {
// Result contains the bytes of the psiphon config.
Result []byte
// Err is the error, if any.
Err error
}
// FetchPsiphonConfig implements ExperimentSession.FetchPsiphonConfig
func (sess *MockableSession) FetchPsiphonConfig(ctx context.Context) ([]byte, error) {
return sess.Result, sess.Err
}

View File

@ -7,7 +7,7 @@ import (
"github.com/apex/log" "github.com/apex/log"
"github.com/ooni/probe-cli/v3/internal/engine" "github.com/ooni/probe-cli/v3/internal/engine"
"github.com/ooni/probe-cli/v3/internal/engine/tunnel" "github.com/ooni/probe-cli/v3/internal/tunnel"
"golang.org/x/sys/execabs" "golang.org/x/sys/execabs"
) )

View File

@ -14,7 +14,6 @@ import (
"github.com/cretz/bine/control" "github.com/cretz/bine/control"
"github.com/cretz/bine/tor" "github.com/cretz/bine/tor"
"github.com/ooni/probe-cli/v3/internal/engine/internal/mockable"
) )
// torCloser is used to mock a running tor process, which // torCloser is used to mock a running tor process, which
@ -53,7 +52,7 @@ func TestTorWithCancelledContext(t *testing.T) {
ctx, cancel := context.WithCancel(context.Background()) ctx, cancel := context.WithCancel(context.Background())
cancel() // fail immediately cancel() // fail immediately
tun, err := torStart(ctx, &Config{ tun, err := torStart(ctx, &Config{
Session: &mockable.Session{}, Session: &MockableSession{},
TunnelDir: "testdata", TunnelDir: "testdata",
}) })
if !errors.Is(err, context.Canceled) { if !errors.Is(err, context.Canceled) {
@ -67,7 +66,7 @@ func TestTorWithCancelledContext(t *testing.T) {
func TestTorWithEmptyTunnelDir(t *testing.T) { func TestTorWithEmptyTunnelDir(t *testing.T) {
ctx := context.Background() ctx := context.Background()
tun, err := torStart(ctx, &Config{ tun, err := torStart(ctx, &Config{
Session: &mockable.Session{}, Session: &MockableSession{},
TunnelDir: "", TunnelDir: "",
}) })
if !errors.Is(err, ErrEmptyTunnelDir) { if !errors.Is(err, ErrEmptyTunnelDir) {
@ -81,7 +80,7 @@ func TestTorWithEmptyTunnelDir(t *testing.T) {
func TestTorBinaryNotFoundFailure(t *testing.T) { func TestTorBinaryNotFoundFailure(t *testing.T) {
ctx := context.Background() ctx := context.Background()
tun, err := torStart(ctx, &Config{ tun, err := torStart(ctx, &Config{
Session: &mockable.Session{}, Session: &MockableSession{},
TorBinary: "/nonexistent/directory/tor", TorBinary: "/nonexistent/directory/tor",
TunnelDir: "testdata", TunnelDir: "testdata",
}) })
@ -97,7 +96,7 @@ func TestTorStartFailure(t *testing.T) {
expected := errors.New("mocked error") expected := errors.New("mocked error")
ctx := context.Background() ctx := context.Background()
tun, err := torStart(ctx, &Config{ tun, err := torStart(ctx, &Config{
Session: &mockable.Session{}, Session: &MockableSession{},
TunnelDir: "testdata", TunnelDir: "testdata",
testExecabsLookPath: func(name string) (string, error) { testExecabsLookPath: func(name string) (string, error) {
return "/usr/local/bin/tor", nil return "/usr/local/bin/tor", nil
@ -118,7 +117,7 @@ func TestTorEnableNetworkFailure(t *testing.T) {
expected := errors.New("mocked error") expected := errors.New("mocked error")
ctx := context.Background() ctx := context.Background()
tun, err := torStart(ctx, &Config{ tun, err := torStart(ctx, &Config{
Session: &mockable.Session{}, Session: &MockableSession{},
TunnelDir: "testdata", TunnelDir: "testdata",
testExecabsLookPath: func(name string) (string, error) { testExecabsLookPath: func(name string) (string, error) {
return "/usr/local/bin/tor", nil return "/usr/local/bin/tor", nil
@ -142,7 +141,7 @@ func TestTorGetInfoFailure(t *testing.T) {
expected := errors.New("mocked error") expected := errors.New("mocked error")
ctx := context.Background() ctx := context.Background()
tun, err := torStart(ctx, &Config{ tun, err := torStart(ctx, &Config{
Session: &mockable.Session{}, Session: &MockableSession{},
TunnelDir: "testdata", TunnelDir: "testdata",
testExecabsLookPath: func(name string) (string, error) { testExecabsLookPath: func(name string) (string, error) {
return "/usr/local/bin/tor", nil return "/usr/local/bin/tor", nil
@ -168,7 +167,7 @@ func TestTorGetInfoFailure(t *testing.T) {
func TestTorGetInfoInvalidNumberOfKeys(t *testing.T) { func TestTorGetInfoInvalidNumberOfKeys(t *testing.T) {
ctx := context.Background() ctx := context.Background()
tun, err := torStart(ctx, &Config{ tun, err := torStart(ctx, &Config{
Session: &mockable.Session{}, Session: &MockableSession{},
TunnelDir: "testdata", TunnelDir: "testdata",
testExecabsLookPath: func(name string) (string, error) { testExecabsLookPath: func(name string) (string, error) {
return "/usr/local/bin/tor", nil return "/usr/local/bin/tor", nil
@ -194,7 +193,7 @@ func TestTorGetInfoInvalidNumberOfKeys(t *testing.T) {
func TestTorGetInfoInvalidKey(t *testing.T) { func TestTorGetInfoInvalidKey(t *testing.T) {
ctx := context.Background() ctx := context.Background()
tun, err := torStart(ctx, &Config{ tun, err := torStart(ctx, &Config{
Session: &mockable.Session{}, Session: &MockableSession{},
TunnelDir: "testdata", TunnelDir: "testdata",
testExecabsLookPath: func(name string) (string, error) { testExecabsLookPath: func(name string) (string, error) {
return "/usr/local/bin/tor", nil return "/usr/local/bin/tor", nil
@ -220,7 +219,7 @@ func TestTorGetInfoInvalidKey(t *testing.T) {
func TestTorGetInfoInvalidProxyType(t *testing.T) { func TestTorGetInfoInvalidProxyType(t *testing.T) {
ctx := context.Background() ctx := context.Background()
tun, err := torStart(ctx, &Config{ tun, err := torStart(ctx, &Config{
Session: &mockable.Session{}, Session: &MockableSession{},
TunnelDir: "testdata", TunnelDir: "testdata",
testExecabsLookPath: func(name string) (string, error) { testExecabsLookPath: func(name string) (string, error) {
return "/usr/local/bin/tor", nil return "/usr/local/bin/tor", nil
@ -246,7 +245,7 @@ func TestTorGetInfoInvalidProxyType(t *testing.T) {
func TestTorUnsupportedProxy(t *testing.T) { func TestTorUnsupportedProxy(t *testing.T) {
ctx := context.Background() ctx := context.Background()
tun, err := torStart(ctx, &Config{ tun, err := torStart(ctx, &Config{
Session: &mockable.Session{}, Session: &MockableSession{},
TunnelDir: "testdata", TunnelDir: "testdata",
testExecabsLookPath: func(name string) (string, error) { testExecabsLookPath: func(name string) (string, error) {
return "/usr/local/bin/tor", nil return "/usr/local/bin/tor", nil

View File

@ -5,18 +5,14 @@ import (
"errors" "errors"
"testing" "testing"
"github.com/apex/log" "github.com/ooni/probe-cli/v3/internal/tunnel"
"github.com/ooni/probe-cli/v3/internal/engine/internal/mockable"
"github.com/ooni/probe-cli/v3/internal/engine/tunnel"
) )
func TestStartNoTunnel(t *testing.T) { func TestStartNoTunnel(t *testing.T) {
ctx := context.Background() ctx := context.Background()
tun, err := tunnel.Start(ctx, &tunnel.Config{ tun, err := tunnel.Start(ctx, &tunnel.Config{
Name: "", Name: "",
Session: &mockable.Session{ Session: &tunnel.MockableSession{},
MockableLogger: log.Log,
},
}) })
if !errors.Is(err, tunnel.ErrUnsupportedTunnelName) { if !errors.Is(err, tunnel.ErrUnsupportedTunnelName) {
t.Fatal("not the error we expected", err) t.Fatal("not the error we expected", err)
@ -30,10 +26,8 @@ func TestStartPsiphonWithCancelledContext(t *testing.T) {
ctx, cancel := context.WithCancel(context.Background()) ctx, cancel := context.WithCancel(context.Background())
cancel() // fail immediately cancel() // fail immediately
tun, err := tunnel.Start(ctx, &tunnel.Config{ tun, err := tunnel.Start(ctx, &tunnel.Config{
Name: "psiphon", Name: "psiphon",
Session: &mockable.Session{ Session: &tunnel.MockableSession{},
MockableLogger: log.Log,
},
TunnelDir: "testdata", TunnelDir: "testdata",
}) })
if !errors.Is(err, context.Canceled) { if !errors.Is(err, context.Canceled) {
@ -48,10 +42,8 @@ func TestStartTorWithCancelledContext(t *testing.T) {
ctx, cancel := context.WithCancel(context.Background()) ctx, cancel := context.WithCancel(context.Background())
cancel() // fail immediately cancel() // fail immediately
tun, err := tunnel.Start(ctx, &tunnel.Config{ tun, err := tunnel.Start(ctx, &tunnel.Config{
Name: "tor", Name: "tor",
Session: &mockable.Session{ Session: &tunnel.MockableSession{},
MockableLogger: log.Log,
},
TunnelDir: "testdata", TunnelDir: "testdata",
}) })
if !errors.Is(err, context.Canceled) { if !errors.Is(err, context.Canceled) {
@ -65,10 +57,8 @@ func TestStartTorWithCancelledContext(t *testing.T) {
func TestStartInvalidTunnel(t *testing.T) { func TestStartInvalidTunnel(t *testing.T) {
ctx := context.Background() ctx := context.Background()
tun, err := tunnel.Start(ctx, &tunnel.Config{ tun, err := tunnel.Start(ctx, &tunnel.Config{
Name: "antani", Name: "antani",
Session: &mockable.Session{ Session: &tunnel.MockableSession{},
MockableLogger: log.Log,
},
TunnelDir: "testdata", TunnelDir: "testdata",
}) })
if !errors.Is(err, tunnel.ErrUnsupportedTunnelName) { if !errors.Is(err, tunnel.ErrUnsupportedTunnelName) {