Skip to content

Commit

Permalink
Send Concept start and end if runner supports these
Browse files Browse the repository at this point in the history
Signed-off-by: Piotr Nestorow <[email protected]>
  • Loading branch information
PiotrNestor committed Feb 15, 2024
1 parent af22569 commit 88a268e
Show file tree
Hide file tree
Showing 5 changed files with 20 additions and 15 deletions.
14 changes: 9 additions & 5 deletions execution/scenarioExecutor.go
Original file line number Diff line number Diff line change
Expand Up @@ -145,14 +145,18 @@ func (e *scenarioExecutor) notifyBeforeConcept(conceptResult *result.ScenarioRes
message := &gauge_messages.Message{MessageType: gauge_messages.Message_ConceptExecutionStarting,
ConceptExecutionStartingRequest: &gauge_messages.ConceptExecutionStartingRequest{CurrentExecutionInfo: e.currentExecutionInfo, Stream: int32(e.stream)}}
e.pluginHandler.NotifyPlugins(message)
_ = e.runner.ExecuteAndGetStatus(message)
if (e.runner.Info().ConceptMessages) {
_ = e.runner.ExecuteAndGetStatus(message)
}
}

func (e *scenarioExecutor) notifyAfterConcept(conceptResult *result.ScenarioResult) {
message := &gauge_messages.Message{MessageType: gauge_messages.Message_ConceptExecutionEnding,
ConceptExecutionEndingRequest: &gauge_messages.ConceptExecutionEndingRequest{CurrentExecutionInfo: e.currentExecutionInfo, Stream: int32(e.stream)}}
e.pluginHandler.NotifyPlugins(message)
_ = e.runner.ExecuteAndGetStatus(message)
if (e.runner.Info().ConceptMessages) {
_ = e.runner.ExecuteAndGetStatus(message)
}
}

func (e *scenarioExecutor) createStepRequest(protoStep *gauge_messages.ProtoStep) *gauge_messages.ExecuteStepRequest {
Expand Down Expand Up @@ -201,7 +205,7 @@ func (e *scenarioExecutor) executeConcept(item *gauge.Step, protoConcept *gauge_

// Add the Concept step data to the Execution info that is sent to plugins
stepRequest := e.createStepRequest(protoConcept.ConceptStep)
e.currentExecutionInfo.CurrentStep = &gauge_messages.StepInfo{Step: stepRequest, IsFailed: false, IsConcept: true}
e.currentExecutionInfo.CurrentStep = &gauge_messages.StepInfo{Step: stepRequest, IsFailed: false}
event.Notify(event.NewExecutionEvent(event.ConceptStart, item, nil, e.stream, e.currentExecutionInfo))
e.notifyBeforeConcept(scenarioResult)

Expand All @@ -218,7 +222,7 @@ func (e *scenarioExecutor) executeConcept(item *gauge.Step, protoConcept *gauge_
}
// The concept is finishing after a step failure
// Restore the Concept step data in the Execution info that is sent to plugins
e.currentExecutionInfo.CurrentStep = &gauge_messages.StepInfo{Step: stepRequest, IsFailed: false, IsConcept: true}
e.currentExecutionInfo.CurrentStep = &gauge_messages.StepInfo{Step: stepRequest, IsFailed: false}
defer event.Notify(event.NewExecutionEvent(event.ConceptEnd, nil, cptResult, e.stream, e.currentExecutionInfo))
defer e.notifyAfterConcept(scenarioResult)

Expand All @@ -229,7 +233,7 @@ func (e *scenarioExecutor) executeConcept(item *gauge.Step, protoConcept *gauge_
cptResult.UpdateConceptExecResult()

// Restore the Concept step to the Execution info that is sent to plugins
e.currentExecutionInfo.CurrentStep = &gauge_messages.StepInfo{Step: stepRequest, IsFailed: false, IsConcept: true}
e.currentExecutionInfo.CurrentStep = &gauge_messages.StepInfo{Step: stepRequest, IsFailed: false}
defer event.Notify(event.NewExecutionEvent(event.ConceptEnd, nil, cptResult, e.stream, e.currentExecutionInfo))
defer e.notifyAfterConcept(scenarioResult)

Expand Down
2 changes: 1 addition & 1 deletion execution/stepExecutor.go
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ type stepExecutor struct {
// TODO: stepExecutor should not consume both gauge.Step and gauge_messages.ProtoStep. The usage of ProtoStep should be eliminated.
func (e *stepExecutor) executeStep(step *gauge.Step, protoStep *gauge_messages.ProtoStep) *result.StepResult {
stepRequest := e.createStepRequest(protoStep)
e.currentExecutionInfo.CurrentStep = &gauge_messages.StepInfo{Step: stepRequest, IsFailed: false, IsConcept: false}
e.currentExecutionInfo.CurrentStep = &gauge_messages.StepInfo{Step: stepRequest, IsFailed: false}
stepResult := result.NewStepResult(protoStep)
for i := range step.GetFragments() {
stepFragmet := step.GetFragments()[i]
Expand Down
6 changes: 3 additions & 3 deletions go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ require (
github.com/daviddengcn/go-colortext v1.0.0
github.com/fsnotify/fsnotify v1.7.0
github.com/getgauge/common v0.0.0-20231026143554-1599dddc7f01
github.com/getgauge/gauge-proto/go/gauge_messages v0.0.0-20240213132655-d676f0e170fb
github.com/getgauge/gauge-proto/go/gauge_messages v0.0.0-20240215051240-9e50dbd68dfa
github.com/golang/protobuf v1.5.3
github.com/magiconair/properties v1.8.7
github.com/natefinch/lumberjack v2.0.0+incompatible
Expand All @@ -18,8 +18,8 @@ require (
github.com/sourcegraph/jsonrpc2 v0.2.0
github.com/spf13/cobra v1.8.0
github.com/spf13/pflag v1.0.5
google.golang.org/genproto/googleapis/rpc v0.0.0-20240205150955-31a09d347014
google.golang.org/grpc v1.61.0
google.golang.org/genproto/googleapis/rpc v0.0.0-20240213162025-012b6fc9bca9
google.golang.org/grpc v1.61.1
google.golang.org/protobuf v1.32.0
gopkg.in/check.v1 v1.0.0-20201130134442-10cb98267c6c
)
Expand Down
12 changes: 6 additions & 6 deletions go.sum
Original file line number Diff line number Diff line change
Expand Up @@ -13,8 +13,8 @@ github.com/fsnotify/fsnotify v1.7.0 h1:8JEhPFa5W2WU7YfeZzPNqzMP6Lwt7L2715Ggo0nos
github.com/fsnotify/fsnotify v1.7.0/go.mod h1:40Bi/Hjc2AVfZrqy+aj+yEI+/bRxZnMJyTJwOpGvigM=
github.com/getgauge/common v0.0.0-20231026143554-1599dddc7f01 h1:YS9Wlu7GKlfQcPzs1tTQ30nsjeAdJeJUqQq+j35YpVo=
github.com/getgauge/common v0.0.0-20231026143554-1599dddc7f01/go.mod h1:p/Q0+qO2bLq08PuxaHrxIgkvKlGGYHyXad33+zKIiXU=
github.com/getgauge/gauge-proto/go/gauge_messages v0.0.0-20240213132655-d676f0e170fb h1:cj1aQODxopfVOLwNl/YxWecp0hUHVFvF4j5q4tIm5XE=
github.com/getgauge/gauge-proto/go/gauge_messages v0.0.0-20240213132655-d676f0e170fb/go.mod h1:B2BNUpaYWBn2UQIXm1vbFGm1dYPayIqWCwNZduA0Hcg=
github.com/getgauge/gauge-proto/go/gauge_messages v0.0.0-20240215051240-9e50dbd68dfa h1:yUuCvJmCxXlC4nhEtGjVDjgYTuB6t7lqN9aX/9FlQkc=
github.com/getgauge/gauge-proto/go/gauge_messages v0.0.0-20240215051240-9e50dbd68dfa/go.mod h1:qf8Dv2iFBwlgpBZBOKjW9JDaYi5lHqXNYXEHTXd62Uw=
github.com/golang/protobuf v1.5.0/go.mod h1:FsONVRAS9T7sI+LIUmWTfcYkHO4aIWwzhcaSAoJOfIk=
github.com/golang/protobuf v1.5.3 h1:KhyjKVUg7Usr/dYsdSqoFveMYd5ko72D+zANwlG1mmg=
github.com/golang/protobuf v1.5.3/go.mod h1:XVQd3VNwM+JqD3oG2Ue2ip4fOMUkwXdXDdiuN0vRsmY=
Expand Down Expand Up @@ -69,10 +69,10 @@ golang.org/x/sys v0.17.0/go.mod h1:/VUhepiaJMQUp4+oa/7Zr1D23ma6VTLIYjOOTFZPUcA=
golang.org/x/text v0.14.0 h1:ScX5w1eTa3QqT8oi6+ziP7dTV1S2+ALU0bI+0zXKWiQ=
golang.org/x/text v0.14.0/go.mod h1:18ZOQIKpY8NJVqYksKHtTdi31H5itFRjB5/qKTNYzSU=
golang.org/x/xerrors v0.0.0-20191204190536-9bdfabe68543/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0=
google.golang.org/genproto/googleapis/rpc v0.0.0-20240205150955-31a09d347014 h1:FSL3lRCkhaPFxqi0s9o+V4UI2WTzAVOvkgbd4kVV4Wg=
google.golang.org/genproto/googleapis/rpc v0.0.0-20240205150955-31a09d347014/go.mod h1:SaPjaZGWb0lPqs6Ittu0spdfrOArqji4ZdeP5IC/9N4=
google.golang.org/grpc v1.61.0 h1:TOvOcuXn30kRao+gfcvsebNEa5iZIiLkisYEkf7R7o0=
google.golang.org/grpc v1.61.0/go.mod h1:VUbo7IFqmF1QtCAstipjG0GIoq49KvMe9+h1jFLBNJs=
google.golang.org/genproto/googleapis/rpc v0.0.0-20240213162025-012b6fc9bca9 h1:hZB7eLIaYlW9qXRfCq/qDaPdbeY3757uARz5Vvfv+cY=
google.golang.org/genproto/googleapis/rpc v0.0.0-20240213162025-012b6fc9bca9/go.mod h1:YUWgXUFRPfoYK1IHMuxH5K6nPEXSCzIMljnQ59lLRCk=
google.golang.org/grpc v1.61.1 h1:kLAiWrZs7YeDM6MumDe7m3y4aM6wacLzM1Y/wiLP9XY=
google.golang.org/grpc v1.61.1/go.mod h1:VUbo7IFqmF1QtCAstipjG0GIoq49KvMe9+h1jFLBNJs=
google.golang.org/protobuf v1.26.0-rc.1/go.mod h1:jlhhOSvTdKEhbULTjvd4ARK9grFBp09yW+WbY/TyQbw=
google.golang.org/protobuf v1.26.0/go.mod h1:9q0QmTI4eRPtz6boOQmLYwt+qCgq0jsYwAQnmE0givc=
google.golang.org/protobuf v1.32.0 h1:pPC6BG5ex8PDFnkbrGU3EixyhKcQ2aDuBS36lqK/C7I=
Expand Down
1 change: 1 addition & 0 deletions runner/runner.go
Original file line number Diff line number Diff line change
Expand Up @@ -58,6 +58,7 @@ type RunnerInfo struct {
GaugeVersionSupport version.VersionSupport
LspLangId string
GRPCSupport bool
ConceptMessages bool
Killed bool
}

Expand Down

0 comments on commit 88a268e

Please sign in to comment.