func startEngine() error { enginePath, err := exec.LookPath("cgr-engine") if err != nil { return errors.New("Cannot find cgr-engine executable") } stopEngine() engine := exec.Command(enginePath, "-config_dir", cfgPath) if err := engine.Start(); err != nil { return fmt.Errorf("Cannot start cgr-engine: %s", err.Error()) } time.Sleep(time.Duration(*waitRater) * time.Millisecond) // Give time to rater to fire up return nil }
func TestTutLclStartEngine(t *testing.T) { if !*testLocal { return } enginePath, err := exec.LookPath("cgr-engine") if err != nil { t.Fatal("Cannot find cgr-engine executable") } exec.Command("pkill", "cgr-engine").Run() // Just to make sure another one is not running, bit brutal maybe we can fine tune it engine := exec.Command(enginePath, "-config", tutCfgPath) if err := engine.Start(); err != nil { t.Fatal(err) } time.Sleep(time.Duration(*waitRater) * time.Millisecond) // Give time to rater to fire up }