Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Compatibility errors #1

Closed
nvborisenko opened this issue Dec 21, 2019 · 13 comments
Closed

Compatibility errors #1

nvborisenko opened this issue Dec 21, 2019 · 13 comments

Comments

@nvborisenko
Copy link

nvborisenko commented Dec 21, 2019

I am trying to use this library to listen to incoming events from gauge. I am creating reporting plugin.

How I do it:

using (var gaugeConnection = new GaugeConnection(tcpClientWrapper))
  {
    while (gaugeConnection.Connected)
      {
        var messageBytes = gaugeConnection.ReadBytes();
        var message = Message.Parser.ParseFrom(messageBytes.ToArray());
        if (message.MessageType == Message.Types.MessageType.SuiteExecutionResult)
        {
          // do some stuff
        }
        if (message.MessageType == Message.Types.MessageType.KillProcessRequest)
        {
          // exit
        }
      }

And I got exception:

Program Error: 1 : 18:55:59.7798871 : 1-ReportPortal.Gauge : Unhandler error: Google.Protobuf.InvalidProtocolBufferException: Mismatched end-group tag. Started with field 12; ended with field 5
   at Google.Protobuf.CodedInputStream.SkipGroup(UInt32 startGroupTag)
   at Google.Protobuf.CodedInputStream.SkipLastField()
   at Google.Protobuf.CodedInputStream.SkipGroup(UInt32 startGroupTag)
   at Google.Protobuf.CodedInputStream.SkipLastField()
   at Google.Protobuf.CodedInputStream.SkipGroup(UInt32 startGroupTag)
   at Google.Protobuf.UnknownFieldSet.MergeFieldFrom(CodedInputStream input)
   at Google.Protobuf.UnknownFieldSet.MergeFieldFrom(UnknownFieldSet unknownFields, CodedInputStream input)
   at Gauge.Messages.Message.MergeFrom(CodedInputStream input)
   at Google.Protobuf.MessageExtensions.MergeFrom(IMessage message, Byte[] data, Boolean discardUnknownFields)
   at Google.Protobuf.MessageParser`1.ParseFrom(Byte[] data)
   at ReportPortal.GaugePlugin.Program.Main(String[] args)

I blame compatibility between gauge core and gauge runner and gauge any else. I guess that proto messages are not actualized in some gauge layer. Please confirm it or point me how to create reporting plugin in right way in the world of .Net.

Environment:

  • gauge 1.0.5/1.0.6
  • runner: java/dotnet
Gauge version: 1.0.6
Commit Hash: 2bc49db

Plugins
-------
html-report (4.0.8)
java (0.7.3)
reportportal (1.1.0)
screenshot (0.0.1)

Sometimes I get Wire protocol error.

@nvborisenko
Copy link
Author

Based on gauge source code I can say that recently gauge introduced grpc events. Considering this fact I am also wondering how to use it. Brief information about it would be enough.

@sriv
Copy link
Member

sriv commented Dec 23, 2019

@nvborisenko yes, you are right. Gauge is moving to gRPC. However, this is yet to be released. This feature is under development, and we expect to support the older mechanism and give users enough notice before deprecating it.

The information for gauge's gRPC schema/events are discussed here: https://spectrum.chat/gauge/engineering/proto-messages-used-by-gauge-and-its-plugins-to-exchange-information-during-the-authoring-and-execution~4cb1ac64-751a-4903-a317-2f5e454fd0f1 . Please feel free to post your recommendations.

As for this issue - I can try to replicate the issue, but I do not have a report portal instance. If you can point me to any step to replicate this issue, that'll be helpful.

@nvborisenko
Copy link
Author

Thumbs up for gRPC.

Does it mean that at this moment released gauge and plugins use mixed technologies?

@sriv
Copy link
Member

sriv commented Dec 26, 2019

Does it mean that at this moment released gauge and plugins use mixed technologies?

Right now we haven't released any plugin with gRPC support. However, we might do it (i.e. release a plugin with gRPC support, before Gauge core's gRPC support). This would mean that the plugin's gRPC feature is toggled off.

@nvborisenko
Copy link
Author

Ok, what about initial issue where grpc is not used?

I just developed plugin, with the code above, and this code raises exception. Code is very simple, just listening to incoming proto messages.

@negiDharmendra
Copy link

@nvborisenko Gauge and its plugins with GRPC support has been released.

@nvborisenko
Copy link
Author

Ok, thanks for letting me know. My initial issue was about incompatibility between parties.

Just watch out and discover what version of proto messages is used by plugins/runners. Java/Dotnet/AnyReporterPlugin references to different proto messages.. I believe..

@nvborisenko
Copy link
Author

Fixed in v1.0.7 and Gauge.CSharp.Core 0.3.7 nuget package.

@nvborisenko
Copy link
Author

Reopening it, trying new grpc capabilities and it seems I am missing something, Please help.

Here is how I start server:

            var server = new Server();
            var s = Reporter.BindService(new MyHandler(server));
            server.Services.Add(s);
            var g_port = server.Ports.Add(new ServerPort("127.0.0.1", 0, ServerCredentials.Insecure));
            TraceLogger.Info($"Listening on port: {g_port}");
            server.Start();
            TraceLogger.Info("Server has started.");

            server.ShutdownTask.Wait();

And MyHandler implementation:

public class MyHandler : Gauge.Messages.Reporter.ReporterBase
        {
            private static ITraceLogger TraceLogger = TraceLogManager.GetLogger<MyHandler>();

            private Server _server;

            public MyHandler(Server server)
            {
                _server = server;
            }

            public override Task<Empty> NotifyExecutionStarting(ExecutionStartingRequest request, ServerCallContext context)
            {
                TraceLogger.Info("NotifyExecutionStarting received");
                return Task.FromResult(new Empty());
            }

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

            public override Task<Empty> Kill(KillProcessRequest request, ServerCallContext context)
            {
                try
                {
                    TraceLogger.Info("KillProcessrequest received");
                    return Task.FromResult(new Empty());
                }
                finally
                {
                    _server.ShutdownAsync();
                }
            }
        }

The issue is the methods in MyHandler are never being executed.

At the same time gauge runner prints error: Error starting plugin ReportPortal 1.1.0. timed out connecting to reportportal

@BugDiver
Copy link
Member

@nvborisenko One thing which I can think of is grpc_support. The plugins using the grpc APIs need to enable this by adding a capability in the plugin.json file.
Ex: https://github.com/getgauge/html-report/blob/f08507de77905bdfd848934b7af4338896dec747/plugin.json#L21

@nvborisenko
Copy link
Author

Right, the capability was added. Didn't work. Any other thoughts?

@nvborisenko
Copy link
Author

Ha, plugin has to share server port via stdout..

Console.Write($"Listening on port:{g_port}"); without extra scpaces, no Console.WriteLine(), exactly Console.Write().

Amazing communication.

@nvborisenko
Copy link
Author

Closing it, thanks for support.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Development

No branches or pull requests

4 participants