refactor(tunnel): remove nil tunnels hack (#296)
* refactor(tunnel): remove nil tunnels hack This code was originally introduced because a tunnel could be nil in session.go. I have verified that every invocation of tunnel.Start is careful to ensure that we have a tunnel name and that we don't manipulate a nil tunnel. For this reason, I'd rather remove this tricky bit of code and further simplify the tunnel code. Part of https://github.com/ooni/probe/issues/985 * even better docs
This commit is contained in:
parent
c5ad5eedeb
commit
2bafb179c3
7 changed files with 69 additions and 82 deletions
|
|
@ -43,17 +43,6 @@ func TestTorTunnelNonNil(t *testing.T) {
|
|||
}
|
||||
}
|
||||
|
||||
func TestTorTunnelNil(t *testing.T) {
|
||||
var tun *torTunnel
|
||||
if tun.BootstrapTime() != 0 {
|
||||
t.Fatal("not the bootstrap time we expected")
|
||||
}
|
||||
if tun.SOCKS5ProxyURL() != nil {
|
||||
t.Fatal("not the url we expected")
|
||||
}
|
||||
tun.Stop() // ensure we don't crash
|
||||
}
|
||||
|
||||
func TestTorStartWithCancelledContext(t *testing.T) {
|
||||
ctx, cancel := context.WithCancel(context.Background())
|
||||
cancel() // fail immediately
|
||||
|
|
|
|||
Loading…
Reference in a new issue