| 1 | package hostrpc |
| 2 | |
| 3 | import ( |
| 4 | "encoding/json" |
| 5 | "strings" |
| 6 | "testing" |
| 7 | ) |
| 8 | |
| 9 | // A dev build or a telemetry-off configuration has no lifecycle tracker, so the |
| 10 | // identifiers are empty. The shell requires the keys to be present; dropping |
| 11 | // them made every such service fail the handshake. |
| 12 | func TestHelloResultAlwaysCarriesRunAndIncidentKeys(t *testing.T) { |
| 13 | body, err := json.Marshal(HelloResult{DiagnosticsEnabled: false}) |
| 14 | if err != nil { |
| 15 | t.Fatal(err) |
| 16 | } |
| 17 | for _, key := range []string{`"runId":""`, `"incidentId":""`} { |
| 18 | if !strings.Contains(string(body), key) { |
| 19 | t.Fatalf("hello result omitted %s: %s", key, body) |
| 20 | } |
| 21 | } |
| 22 | } |
| 23 |