Skip to content

Commit

Permalink
Update grpc services with new concept events
Browse files Browse the repository at this point in the history
  • Loading branch information
nvborisenko committed Feb 1, 2024
1 parent f1c33cc commit ed26950
Show file tree
Hide file tree
Showing 6 changed files with 106 additions and 34 deletions.
52 changes: 35 additions & 17 deletions src/ReportPortal.GaugePlugin/GrpcMessages/messages.proto
Original file line number Diff line number Diff line change
@@ -1,26 +1,15 @@
// Copyright 2015 ThoughtWorks, Inc.

// This file is part of gauge-proto.

// gauge-proto is free software: you can redistribute it and/or modify
// it under the terms of the GNU General Public License as published by
// the Free Software Foundation, either version 3 of the License, or
// (at your option) any later version.

// gauge-proto is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU General Public License for more details.

// You should have received a copy of the GNU General Public License
// along with gauge-proto. If not, see <http://www.gnu.org/licenses/>.

/*----------------------------------------------------------------
* Copyright (c) ThoughtWorks, Inc.
* Licensed under the Apache License, Version 2.0
* See LICENSE in the project root for license information.
*----------------------------------------------------------------*/

// The comments are exported to Markdown, hence they may contain markdown syntax and cross-refs.
syntax = "proto3";
package gauge.messages;
option csharp_namespace = "Gauge.Messages";
option java_package = "com.thoughtworks.gauge";
option go_package = "github.com/getgauge/gauge-proto/go/gauge_messages";

import "spec.proto";

Expand Down Expand Up @@ -118,6 +107,27 @@ message StepExecutionEndingRequest {
int32 stream = 3;
}

/// Sent at start of Concept Execution.
message ConceptExecutionStartingRequest {
/// Holds the current step execution info.
ExecutionInfo currentExecutionInfo = 1;
/// Holds step result in step execution starting.
/// Some fields will not be populated before execution.
gauge.messages.ProtoStepResult stepResult = 2;

int32 stream = 3;
}

/// Sent at end of Concept Execution.
message ConceptExecutionEndingRequest {
/// Holds the current step execution info.
ExecutionInfo currentExecutionInfo = 1;
/// Holds step result in step execution ending.
gauge.messages.ProtoStepResult stepResult = 2;

int32 stream = 3;
}

/// Contains command line arguments which passed by user during execution.
message ExecutionArg {
/// Holds the flag name passed from command line.
Expand Down Expand Up @@ -319,6 +329,8 @@ message StepNameResponse {
string fileName = 4;
/// Range of step
gauge.messages.Span span = 5;
/// Flag indicating if the given Step defined in some external library and the source code can not be accessed.
bool isExternal = 6;
}

/// Response when a unsupported message request is sent.
Expand Down Expand Up @@ -483,6 +495,8 @@ message Message {
ImplementationFileGlobPatternResponse = 32;
SuiteExecutionResultItem = 33;
KeepAlive = 34;
ConceptExecutionStarting = 35;
ConceptExecutionEnding = 36;
}

MessageType messageType = 1;
Expand Down Expand Up @@ -561,4 +575,8 @@ message Message {
SuiteExecutionResultItem suiteExecutionResultItem = 36;
/// [KeepAlive ](#gauge.messages.KeepAlive )
KeepAlive keepAlive = 37;
/// [ConceptExecutionStartingRequest](#gauge.messages.ConceptExecutionStartingRequest)
ConceptExecutionStartingRequest conceptExecutionStartingRequest = 38;
/// [ConceptExecutionEndingRequest](#gauge.messages.ConceptExecutionEndingRequest)
ConceptExecutionEndingRequest conceptExecutionEndingRequest = 39;
}
17 changes: 17 additions & 0 deletions src/ReportPortal.GaugePlugin/GrpcMessages/services.proto
Original file line number Diff line number Diff line change
@@ -1,7 +1,14 @@
/*----------------------------------------------------------------
* Copyright (c) ThoughtWorks, Inc.
* Licensed under the Apache License, Version 2.0
* See LICENSE in the project root for license information.
*----------------------------------------------------------------*/

syntax = "proto3";
package gauge.messages;
option csharp_namespace = "Gauge.Messages";
option java_package = "com.thoughtworks.gauge";
option go_package = "github.com/getgauge/gauge-proto/go/gauge_messages";

import "messages.proto";

Expand Down Expand Up @@ -136,6 +143,16 @@ service Reporter {
// Accepts a ScenarioExecutionStartingRequest message and returns a Empty message
rpc NotifyScenarioExecutionStarting(ScenarioExecutionStartingRequest) returns (Empty);

// NotifyConceptExecutionStarting is a RPC to tell plugins that the concept execution has started.
//
// Accepts a ConceptExecutionStartingRequest message and returns a Empty message
rpc NotifyConceptExecutionStarting(ConceptExecutionStartingRequest) returns (Empty);

// NotifyConceptExecutionEnding is a RPC to tell plugins that the concept execution has finished.
//
// Accepts a ConceptExecutionEndingRequest message and returns a Empty message
rpc NotifyConceptExecutionEnding(ConceptExecutionEndingRequest) returns (Empty);

// NotifyStepExecutionStarting is a RPC to tell plugins that the step execution has started.
//
// Accepts a StepExecutionStartingRequest message and returns a Empty message
Expand Down
23 changes: 8 additions & 15 deletions src/ReportPortal.GaugePlugin/GrpcMessages/spec.proto
Original file line number Diff line number Diff line change
@@ -1,23 +1,14 @@
// Copyright 2015 ThoughtWorks, Inc.
/*----------------------------------------------------------------
* Copyright (c) ThoughtWorks, Inc.
* Licensed under the Apache License, Version 2.0
* See LICENSE in the project root for license information.
*----------------------------------------------------------------*/

// This file is part of gauge-proto.

// gauge-proto is free software: you can redistribute it and/or modify
// it under the terms of the GNU General Public License as published by
// the Free Software Foundation, either version 3 of the License, or
// (at your option) any later version.

// gauge-proto is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU General Public License for more details.

// You should have received a copy of the GNU General Public License
// along with gauge-proto. If not, see <http://www.gnu.org/licenses/>.
syntax = "proto3";
package gauge.messages;
option csharp_namespace = "Gauge.Messages";
option java_package = "com.thoughtworks.gauge";
option go_package = "github.com/getgauge/gauge-proto/go/gauge_messages";

// The comments are exported to Markdown, hence they may contain markdown syntax and cross-refs.

Expand Down Expand Up @@ -147,6 +138,8 @@ message ProtoScenario {
repeated string preHookScreenshotFiles = 21;
/// Screenshots captured on post hook exec time to be available on reports
repeated string postHookScreenshotFiles = 22;
/// Number of retires
int64 retriesCount = 23;
}

/// A proto object representing a Span of content
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@
</PackageReference>
<PackageReference Include="Google.Protobuf" Version="3.25.2" />
<PackageReference Include="Grpc.AspNetCore" Version="2.60.0" />
<PackageReference Include="ReportPortal.Shared" Version="3.6.1" />
<PackageReference Include="ReportPortal.Shared" Version="3.6.2" />
</ItemGroup>

<ItemGroup>
Expand Down
10 changes: 10 additions & 0 deletions src/ReportPortal.GaugePlugin/Services/EmptyMessagesHandler.cs
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,16 @@ public override Task<Empty> NotifyScenarioExecutionEnding(ScenarioExecutionEndin
return Task.FromResult(new Empty());
}

public override Task<Empty> NotifyConceptExecutionStarting(ConceptExecutionStartingRequest request, ServerCallContext context)
{
return Task.FromResult(new Empty());
}

public override Task<Empty> NotifyConceptExecutionEnding(ConceptExecutionEndingRequest request, ServerCallContext context)
{
return Task.FromResult(new Empty());
}

public override Task<Empty> NotifyStepExecutionStarting(StepExecutionStartingRequest request, ServerCallContext context)
{
return Task.FromResult(new Empty());
Expand Down
36 changes: 35 additions & 1 deletion src/ReportPortal.GaugePlugin/Services/ReportMessagesHandler.cs
Original file line number Diff line number Diff line change
Expand Up @@ -139,6 +139,40 @@ public override Task<Empty> NotifyScenarioExecutionEnding(ScenarioExecutionEndin
return Task.FromResult(new Empty());
}

public override Task<Empty> NotifyConceptExecutionStarting(ConceptExecutionStartingRequest request, ServerCallContext context)
{
try
{
TraceLogger.Info($"{nameof(NotifyConceptExecutionStarting)} received");
TraceLogger.Verbose(request.ToString());

// do nothing for now
}
catch (Exception exp)
{
TraceLogger.Error(exp.ToString());
}

return Task.FromResult(new Empty());
}

public override Task<Empty> NotifyConceptExecutionEnding(ConceptExecutionEndingRequest request, ServerCallContext context)
{
try
{
TraceLogger.Info($"{nameof(NotifyConceptExecutionEnding)} received");
TraceLogger.Verbose(request.ToString());

// do nothing for now
}
catch (Exception exp)
{
TraceLogger.Error(exp.ToString());
}

return Task.FromResult(new Empty());
}

public override Task<Empty> NotifyStepExecutionStarting(StepExecutionStartingRequest request, ServerCallContext context)
{
try
Expand Down Expand Up @@ -193,7 +227,7 @@ public override Task<Empty> Kill(KillProcessRequest request, ServerCallContext c
{
Console.Write("Finishing to send results to Report Portal... ");
var sw = Stopwatch.StartNew();

_sender.Sync();

Console.WriteLine($"Successfully sent at {_sender.LaunchReporter.Info.Url} Elapsed: {sw.Elapsed}");
Expand Down

0 comments on commit ed26950

Please sign in to comment.