Capturing the output of the engine in tests

This commit is contained in:
DanB
2014-02-18 09:25:10 +01:00
parent 8008c76154
commit e60fc8cb96

View File

@@ -88,10 +88,11 @@ func TestFsCsvStartEngine(t *testing.T) {
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, "-rater", "-scheduler", "-cdrs", "-mediator", "-config", path.Join(*dataDir, "conf", "cgrates.cfg"))
if err := engine.Start(); err != nil {
t.Fatal("Cannot start cgr-engine: ", err.Error())
}
go func() {
eng := exec.Command(enginePath, "-rater", "-scheduler", "-cdrs", "-mediator", "-config", path.Join(*dataDir, "conf", "cgrates.cfg"))
out, _ := eng.CombinedOutput()
engine.Logger.Info(fmt.Sprintf("CgrEngine-TestFsCsv: %s", out))
}()
time.Sleep(time.Duration(*waitRater) * time.Millisecond) // Give time to rater to fire up
}