fix(tunnel): pass /absolute/path/to/tor to cretz/bine (#323)
* fix(tunnel): pass /absolute/path/to/tor to cretz/bine It seems cretz/bine is not aware of https://blog.golang.org/path-security for now. I am planning to send over a diff for that later today. In the meanwhile, do the right thing here, and make sure that we obtain the absolute path to the tor binary before we continue. This work is part of https://github.com/ooni/probe-engine/issues/283. * fix tests when tor is not installed
This commit is contained in:
parent
2539a17ff9
commit
a9b3a3b3a5
6 changed files with 136 additions and 5 deletions
|
|
@ -3,21 +3,21 @@ package tunnel_test
|
|||
import (
|
||||
"context"
|
||||
"io/ioutil"
|
||||
"os"
|
||||
"testing"
|
||||
|
||||
"github.com/apex/log"
|
||||
"github.com/ooni/probe-cli/v3/internal/engine"
|
||||
"github.com/ooni/probe-cli/v3/internal/engine/tunnel"
|
||||
"golang.org/x/sys/execabs"
|
||||
)
|
||||
|
||||
func TestTorStartStop(t *testing.T) {
|
||||
if testing.Short() {
|
||||
t.Skip("skip test in short mode")
|
||||
}
|
||||
torBinaryPath := "/usr/bin/tor"
|
||||
if m, err := os.Stat(torBinaryPath); err != nil || !m.Mode().IsRegular() {
|
||||
t.Skip("missing precondition for the test")
|
||||
torBinaryPath, err := execabs.LookPath("tor")
|
||||
if err != nil {
|
||||
t.Skip("missing precondition for the test: tor not in PATH")
|
||||
}
|
||||
tunnelDir, err := ioutil.TempDir("testdata", "tor")
|
||||
if err != nil {
|
||||
|
|
|
|||
Loading…
Reference in a new issue