Kill Tor once the unit tests have finsihed
the build was successful
Details
the build was successful
Details
This commit is contained in:
parent
a8d31e2adb
commit
3888ece4d3
|
@ -35,6 +35,7 @@ pipeline:
|
|||
- ./tmp/tor -f ./testing/torrc
|
||||
- sleep 15
|
||||
- sh testing/tests.sh
|
||||
- pkill -9 tor
|
||||
integration-tests:
|
||||
when:
|
||||
repo: openprivacy/connectivity
|
||||
|
|
|
@ -10,7 +10,9 @@ import (
|
|||
|
||||
func TestLaunchTor(t *testing.T) {
|
||||
log.SetLevel(log.LevelDebug)
|
||||
err := tor.GenerateTorrc("examplehashedpassword", "../tmp/torrc")
|
||||
// Create the tor data directory if it doesn't already exist..
|
||||
os.MkdirAll("../tmp/data/tor", 0700)
|
||||
err := tor.GenerateTorrc("examplehashedpassword", "../tmp/data/tor/torrc")
|
||||
|
||||
if err != nil {
|
||||
t.Fatalf("failed to create torrc file: %v", err)
|
||||
|
|
|
@ -3,6 +3,7 @@ package tor
|
|||
import (
|
||||
"context"
|
||||
"errors"
|
||||
"fmt"
|
||||
"git.openprivacy.ca/openprivacy/connectivity"
|
||||
"git.openprivacy.ca/openprivacy/log"
|
||||
"github.com/cretz/bine/control"
|
||||
|
@ -282,9 +283,16 @@ func startTor(appDirectory string, bundledTorPath string, controlPort int, authe
|
|||
}
|
||||
}
|
||||
log.Debugf("launching system tor\n")
|
||||
|
||||
// check if the torrc file is present where expected
|
||||
if _, err := os.Stat(path.Join(dataDir, "torrc")); os.IsNotExist(err) {
|
||||
log.Debugf("torrc file does not exist at %v", path.Join(dataDir, "torrc"))
|
||||
return nil, fmt.Errorf("torrc file does not exist at %v", path.Join(dataDir, "torrc"))
|
||||
}
|
||||
|
||||
// if not, try running system tor
|
||||
if checkCmdlineTorVersion("tor") {
|
||||
t, err := tor.Start(nil, &tor.StartConf{EnableNetwork: true, DataDir: dataDir, TorrcFile: "torrc", DebugWriter: nil, ProcessCreator: newHideCmd("tor")})
|
||||
t, err := tor.Start(nil, &tor.StartConf{EnableNetwork: true, DataDir: dataDir, TorrcFile: path.Join(dataDir, "torrc"), DebugWriter: nil, ProcessCreator: newHideCmd("tor")})
|
||||
if err == nil {
|
||||
tp.t = t
|
||||
return tp, nil
|
||||
|
@ -296,7 +304,7 @@ func startTor(appDirectory string, bundledTorPath string, controlPort int, authe
|
|||
// try running bundledTor
|
||||
if bundledTorPath != "" && checkCmdlineTorVersion(bundledTorPath) {
|
||||
log.Debugln("using bundled tor '" + bundledTorPath + "'")
|
||||
t, err := tor.Start(nil, &tor.StartConf{EnableNetwork: true, DataDir: dataDir, TorrcFile: "torrc", ExePath: bundledTorPath, DebugWriter: nil, ProcessCreator: newHideCmd(bundledTorPath)})
|
||||
t, err := tor.Start(nil, &tor.StartConf{EnableNetwork: true, DataDir: dataDir, TorrcFile: path.Join(dataDir, "torrc"), ExePath: bundledTorPath, DebugWriter: nil, ProcessCreator: newHideCmd(bundledTorPath)})
|
||||
if err != nil {
|
||||
log.Debugf("Error running bundled tor: %v\n", err)
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue