From e1b8dd918418d7e1d984186752aac121013e8b60 Mon Sep 17 00:00:00 2001 From: Piotr Nestorow Date: Mon, 19 Feb 2024 14:01:53 +0100 Subject: [PATCH] Concept start end notify runner (#2483) * Notify Runner with concept start and end Signed-off-by: Piotr Nestorow * Add isConcept for concept step notification Signed-off-by: Piotr Nestorow * Gauge update after gauge-proto update Signed-off-by: Piotr Nestorow * Go 1.21 update Signed-off-by: Piotr Nestorow * Use ExecuteAndGetStatus to deliver Concept Start and End notification Signed-off-by: Piotr Nestorow * Send Concept start and end if runner supports these Signed-off-by: Piotr Nestorow * github.com/getgauge/common version update Signed-off-by: Piotr Nestorow --------- Signed-off-by: Piotr Nestorow --- execution/scenarioExecutor.go | 6 ++++++ go.mod | 2 +- go.sum | 4 ++-- logger/_testdata/logs/gauge.log | 0 runner/grpcRunner.go | 8 +++++++- runner/runner.go | 1 + version/version.go | 2 +- 7 files changed, 18 insertions(+), 5 deletions(-) create mode 100644 logger/_testdata/logs/gauge.log diff --git a/execution/scenarioExecutor.go b/execution/scenarioExecutor.go index dd439e7b7..9ae5d72d9 100644 --- a/execution/scenarioExecutor.go +++ b/execution/scenarioExecutor.go @@ -145,12 +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) + 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) + if (e.runner.Info().ConceptMessages) { + _ = e.runner.ExecuteAndGetStatus(message) + } } func (e *scenarioExecutor) createStepRequest(protoStep *gauge_messages.ProtoStep) *gauge_messages.ExecuteStepRequest { diff --git a/go.mod b/go.mod index 9071ceecd..050b9cd81 100644 --- a/go.mod +++ b/go.mod @@ -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-20231211152919-94c93e29f0b9 - github.com/getgauge/gauge-proto/go/gauge_messages v0.0.0-20240122132601-bb92eb77d703 + 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 diff --git a/go.sum b/go.sum index 8d6357431..ef447266a 100644 --- a/go.sum +++ b/go.sum @@ -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-20231211152919-94c93e29f0b9 h1:OwggKdL8AeteB2y0xJzloieq9CMhYG7YmKKMh6D8FLs= github.com/getgauge/common v0.0.0-20231211152919-94c93e29f0b9/go.mod h1:p/Q0+qO2bLq08PuxaHrxIgkvKlGGYHyXad33+zKIiXU= -github.com/getgauge/gauge-proto/go/gauge_messages v0.0.0-20240122132601-bb92eb77d703 h1:ZFK55KGnHAFpwk4YbQsp8r1ybf76MQcEVba5V21qB7w= -github.com/getgauge/gauge-proto/go/gauge_messages v0.0.0-20240122132601-bb92eb77d703/go.mod h1:grwwUhEUaDZHOj11RDIk5w7tciDv3fYDXeyYoL2BgGc= +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= diff --git a/logger/_testdata/logs/gauge.log b/logger/_testdata/logs/gauge.log new file mode 100644 index 000000000..e69de29bb diff --git a/runner/grpcRunner.go b/runner/grpcRunner.go index 6e2e310fc..281d44e3e 100644 --- a/runner/grpcRunner.go +++ b/runner/grpcRunner.go @@ -150,6 +150,12 @@ func (r *GrpcRunner) invokeServiceFor(message *gm.Message) (*gm.Message, error) case gm.Message_KillProcessRequest: _, _ = r.RunnerClient.Kill(context.Background(), message.KillProcessRequest) return nil, nil + case gm.Message_ConceptExecutionStarting: + _, err := r.RunnerClient.NotifyConceptExecutionStarting(context.Background(), message.ConceptExecutionStartingRequest) + return nil, err + case gm.Message_ConceptExecutionEnding: + _, err := r.RunnerClient.NotifyConceptExecutionEnding(context.Background(), message.ConceptExecutionEndingRequest) + return nil, err default: return nil, nil } @@ -221,7 +227,7 @@ func (r *GrpcRunner) ExecuteAndGetStatus(m *gm.Message) *gm.ProtoExecutionResult } return &gauge_messages.ProtoExecutionResult{Failed: true, ErrorMessage: err.Error()} } - return res.ExecutionStatusResponse.ExecutionResult + if res != nil { return res.ExecutionStatusResponse.ExecutionResult } else { return nil } } // Alive check if the runner process is still alive diff --git a/runner/runner.go b/runner/runner.go index b994ac5f5..81ed6e973 100644 --- a/runner/runner.go +++ b/runner/runner.go @@ -58,6 +58,7 @@ type RunnerInfo struct { GaugeVersionSupport version.VersionSupport LspLangId string GRPCSupport bool + ConceptMessages bool Killed bool } diff --git a/version/version.go b/version/version.go index 028212ab2..35c331023 100644 --- a/version/version.go +++ b/version/version.go @@ -14,7 +14,7 @@ import ( ) // CurrentGaugeVersion represents the current version of Gauge -var CurrentGaugeVersion = &Version{1, 6, 1} +var CurrentGaugeVersion = &Version{1, 6, 2} // BuildMetadata represents build information of current release (e.g, nightly build information) var BuildMetadata = ""