Fix the integration test from crashing

Sessions are expected to only have one running query (perhaps this is a
bug). So we need to make a new session for each of the benchmark runs,
timing only the running part.
This commit is contained in:
Barak Michener 2014-08-06 05:03:20 -04:00
parent f441fc4bbf
commit 0c3e0381f3

View file

@ -363,12 +363,18 @@ func runBench(n int, b *testing.B) {
if err != nil {
b.Fatalf("Failed to parse benchmark gremlin %s: %v", benchmarkQueries[n].message, err)
}
b.StopTimer()
b.ResetTimer()
for i := 0; i < b.N; i++ {
c := make(chan interface{}, 5)
ses := gremlin.NewSession(ts, cfg.Timeout, true)
// Do the parsing we know works.
ses.InputParses(benchmarkQueries[n].query)
b.StartTimer()
go ses.ExecInput(benchmarkQueries[n].query, c, 100)
for _ = range c {
}
b.StopTimer()
}
}