diff --git a/clients/go/cmd/mxgw-go/main.go b/clients/go/cmd/mxgw-go/main.go index 768ea8c..3604d40 100644 --- a/clients/go/cmd/mxgw-go/main.go +++ b/clients/go/cmd/mxgw-go/main.go @@ -263,6 +263,11 @@ func runPing(ctx context.Context, args []string, stdout, stderr io.Writer) error Reply: mustMarshalProto(reply), }) } + // DiagnosticMessage carries the echoed ping text set by the gateway. + // Fall back to the kind string when the gateway returns an empty message + // (forward-compat guard for future gateway versions). writeCommandOutput + // is not reused here because it would print the opaque Kind enum rather + // than the human-readable echo. echo := reply.GetDiagnosticMessage() if echo == "" { echo = reply.GetKind().String() diff --git a/clients/go/cmd/mxgw-go/main_test.go b/clients/go/cmd/mxgw-go/main_test.go index 4e02a39..efbe9c4 100644 --- a/clients/go/cmd/mxgw-go/main_test.go +++ b/clients/go/cmd/mxgw-go/main_test.go @@ -255,6 +255,13 @@ func TestRunPingJSON(t *testing.T) { if out.Command != "ping" { t.Fatalf("command = %q, want %q", out.Command, "ping") } + // The fake gateway echoes "pong:" in diagnostic_message; verify the + // echo appears in the serialised reply so a future regression that wired + // PingRaw to the wrong proto field would be caught here. + replyStr := string(out.Reply) + if !strings.Contains(replyStr, "pong:hello") { + t.Fatalf("ping JSON reply missing echoed message %q; reply = %s", "pong:hello", replyStr) + } } // TestRunPingRequiresSessionID verifies the ping subcommand rejects missing session-id.