validateRootSpan takes span slice as input, check if there are rootspans match the expected name and the status code is not error
(t *testing.T, spanNameExpected string, spans []tracetest.SpanStub)
| 47 | // validateRootSpan takes span slice as input, check if there are rootspans match the expected |
| 48 | // name and the status code is not error |
| 49 | func validateRootSpan(t *testing.T, spanNameExpected string, spans []tracetest.SpanStub) { |
| 50 | for _, span := range spans { |
| 51 | //We only look for root span |
| 52 | //A span is root span if its parent SpanContext is invalid |
| 53 | if !span.Parent.IsValid() { |
| 54 | if span.Name == spanNameExpected { |
| 55 | assert.NotEqual(t, span.Status.Code, codes.Error) |
| 56 | return |
| 57 | } |
| 58 | } |
| 59 | } |
| 60 | t.Fatalf("Expected span %s not found", spanNameExpected) |
| 61 | } |
searching dependent graphs…