Skip to content

Commit

Permalink
Generating code from updated proto files | #165
Browse files Browse the repository at this point in the history
  • Loading branch information
kashishm committed Aug 3, 2016
1 parent cf3ea86 commit 44c7ebe
Show file tree
Hide file tree
Showing 4 changed files with 77 additions and 77 deletions.
32 changes: 16 additions & 16 deletions execution/api.go
Original file line number Diff line number Diff line change
Expand Up @@ -82,26 +82,26 @@ func listenExecutionEvents(stream gauge_messages.Execution_ExecuteServer) {
})
case event.ScenarioEnd:
stream.Send(&gauge_messages.ExecutionResponse{
Type: gauge_messages.ExecutionResponse_ScenarioEnd.Enum(),
ID: proto.String(fmt.Sprintf("%s:%d", e.ExecutionInfo.CurrentSpec.GetFileName(), e.Item.(*gauge.Scenario).Heading.LineNo)),
Status: getStatus(e.Result.(*result.ScenarioResult)),
ExecutionTime: proto.Int64(e.Result.ExecTime()),
Errors: getErrors(e.Result.(*result.ScenarioResult).ProtoScenario.GetScenarioItems()),
PreHookFailure: getHookFailure(e.Result.GetPreHook()),
PostHookFailure: getHookFailure(e.Result.GetPostHook()),
Type: gauge_messages.ExecutionResponse_ScenarioEnd.Enum(),
ID: proto.String(fmt.Sprintf("%s:%d", e.ExecutionInfo.CurrentSpec.GetFileName(), e.Item.(*gauge.Scenario).Heading.LineNo)),
Status: getStatus(e.Result.(*result.ScenarioResult)),
ExecutionTime: proto.Int64(e.Result.ExecTime()),
Errors: getErrors(e.Result.(*result.ScenarioResult).ProtoScenario.GetScenarioItems()),
BeforeHookFailure: getHookFailure(e.Result.GetPreHook()),
AfterHookFailure: getHookFailure(e.Result.GetPostHook()),
})
case event.SpecEnd:
stream.Send(&gauge_messages.ExecutionResponse{
Type: gauge_messages.ExecutionResponse_SpecEnd.Enum(),
ID: proto.String(fmt.Sprintf(e.ExecutionInfo.CurrentSpec.GetFileName())),
PreHookFailure: getHookFailure(e.Result.GetPreHook()),
PostHookFailure: getHookFailure(e.Result.GetPostHook()),
Type: gauge_messages.ExecutionResponse_SpecEnd.Enum(),
ID: proto.String(fmt.Sprintf(e.ExecutionInfo.CurrentSpec.GetFileName())),
BeforeHookFailure: getHookFailure(e.Result.GetPreHook()),
AfterHookFailure: getHookFailure(e.Result.GetPostHook()),
})
case event.SuiteEnd:
stream.Send(&gauge_messages.ExecutionResponse{
Type: gauge_messages.ExecutionResponse_SuiteEnd.Enum(),
PreHookFailure: getHookFailure(e.Result.GetPreHook()),
PostHookFailure: getHookFailure(e.Result.GetPostHook()),
Type: gauge_messages.ExecutionResponse_SuiteEnd.Enum(),
BeforeHookFailure: getHookFailure(e.Result.GetPreHook()),
AfterHookFailure: getHookFailure(e.Result.GetPostHook()),
})
return
}
Expand All @@ -120,7 +120,7 @@ func getErrorResponse(errs ...error) *gauge_messages.ExecutionResponse {
func getHookFailure(hookFailure **gauge_messages.ProtoHookFailure) *gauge_messages.ExecutionResponse_ExecutionError {
if hookFailure != nil && *hookFailure != nil {
return &gauge_messages.ExecutionResponse_ExecutionError{
ScreenShot: (**hookFailure).ScreenShot,
Screenshot: (**hookFailure).ScreenShot,
ErrorMessage: (**hookFailure).ErrorMessage,
StackTrace: (**hookFailure).StackTrace,
}
Expand All @@ -141,7 +141,7 @@ func getErrors(items []*gauge_messages.ProtoItem) []*gauge_messages.ExecutionRes
errors = append(errors, &gauge_messages.ExecutionResponse_ExecutionError{
StackTrace: res.StackTrace,
ErrorMessage: res.ErrorMessage,
ScreenShot: res.ScreenShot,
Screenshot: res.ScreenShot,
})
}
case gauge_messages.ProtoItem_Concept:
Expand Down
14 changes: 7 additions & 7 deletions execution/api_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -237,10 +237,10 @@ func (s *MySuite) TestListenSpecEndExecutionEvent(c *C) {
}, 0, ei))

expected := &gauge_messages.ExecutionResponse{
Type: gauge_messages.ExecutionResponse_SpecEnd.Enum(),
ID: proto.String("example.spec"),
PreHookFailure: &gauge_messages.ExecutionResponse_ExecutionError{ErrorMessage: proto.String("err msg")},
PostHookFailure: &gauge_messages.ExecutionResponse_ExecutionError{ErrorMessage: proto.String("err msg")},
Type: gauge_messages.ExecutionResponse_SpecEnd.Enum(),
ID: proto.String("example.spec"),
BeforeHookFailure: &gauge_messages.ExecutionResponse_ExecutionError{ErrorMessage: proto.String("err msg")},
AfterHookFailure: &gauge_messages.ExecutionResponse_ExecutionError{ErrorMessage: proto.String("err msg")},
}
c.Assert(<-actual, DeepEquals, expected)
}
Expand All @@ -254,9 +254,9 @@ func (s *MySuite) TestListenSuiteEndExecutionEvent(c *C) {
event.Notify(event.NewExecutionEvent(event.SuiteEnd, nil, &result.SuiteResult{PreSuite: hookFailure, PostSuite: hookFailure}, 0, gauge_messages.ExecutionInfo{}))

expected := &gauge_messages.ExecutionResponse{
Type: gauge_messages.ExecutionResponse_SuiteEnd.Enum(),
PreHookFailure: &gauge_messages.ExecutionResponse_ExecutionError{ErrorMessage: proto.String("err msg")},
PostHookFailure: &gauge_messages.ExecutionResponse_ExecutionError{ErrorMessage: proto.String("err msg")},
Type: gauge_messages.ExecutionResponse_SuiteEnd.Enum(),
BeforeHookFailure: &gauge_messages.ExecutionResponse_ExecutionError{ErrorMessage: proto.String("err msg")},
AfterHookFailure: &gauge_messages.ExecutionResponse_ExecutionError{ErrorMessage: proto.String("err msg")},
}
c.Assert(<-actual, DeepEquals, expected)
}
Expand Down
2 changes: 1 addition & 1 deletion gauge-proto
Submodule gauge-proto updated 1 files
+8 −8 api_v2.proto
106 changes: 53 additions & 53 deletions gauge_messages/api_v2.pb.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

0 comments on commit 44c7ebe

Please sign in to comment.