Skip to content

Commit

Permalink
Re-using the same runner instance when executing specs after starting…
Browse files Browse the repository at this point in the history
… api.

This ensures runner is not started twice during execution. Fixes #34
  • Loading branch information
prateekbaheti committed May 25, 2015
1 parent 0ce3f12 commit 7c7cc02
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 10 deletions.
13 changes: 6 additions & 7 deletions gauge.go
Original file line number Diff line number Diff line change
Expand Up @@ -260,18 +260,17 @@ func executeSpecs(inParallel bool) {
handleCriticalError(err)
}
err, apiHandler := startAPIService(0)
apiHandler.runner.kill(getCurrentLogger())
if err != nil {
apiHandler.runner.kill(getCurrentLogger())
handleCriticalError(errors.New(fmt.Sprintf("Failed to start gauge API. %s\n", err.Error())))
}

runner, runnerError := startRunnerAndMakeConnection(manifest, getCurrentLogger())
if runnerError != nil {
handleCriticalError(errors.New(fmt.Sprintf("Failed to start a runner. %s\n", runnerError.Error())))
if apiHandler.runner == nil {
handleCriticalError(errors.New("Failed to start a runner\n"))
}
validateSpecs(manifest, specsToExecute, runner, conceptsDictionary)

validateSpecs(manifest, specsToExecute, apiHandler.runner, conceptsDictionary)
pluginHandler := startPlugins(manifest)
execution := newExecution(manifest, specsToExecute, runner, pluginHandler, parallelInfo, getCurrentLogger())
execution := newExecution(manifest, specsToExecute, apiHandler.runner, pluginHandler, parallelInfo, getCurrentLogger())
result := execution.start()
execution.finish()
exitCode := printExecutionStatus(result, specsSkipped)
Expand Down
4 changes: 1 addition & 3 deletions specDetails.go
Original file line number Diff line number Diff line change
Expand Up @@ -264,11 +264,9 @@ func (specInfoGatherer *specInfoGatherer) getStepsFromRunner(runner *testRunner)
if connErr == nil {
steps = append(steps, requestForSteps(runner)...)
logger.ApiLog.Debug("Steps got from runner: %v", steps)
}
if connErr != nil {
} else {
logger.ApiLog.Error("Runner connection failed: %s", connErr)
}

} else {
steps = append(steps, requestForSteps(runner)...)
logger.ApiLog.Debug("Steps got from runner: %v", steps)
Expand Down

0 comments on commit 7c7cc02

Please sign in to comment.