func validateTrace()

in crossdock/behavior/trace/behavior.go [159:187]


func validateTrace(
	t crossdock.T,
	target *Downstream,
	resp *Response,
	service string,
	level int,
	traceID string,
	sampled bool,
	baggage string,
) bool {
	service = fmt.Sprintf("S%d(%s)", level, service)
	checks := crossdock.Checks(t)
	s := true
	s = checks.Equal(traceID, resp.Span.TraceID, "Trace ID must match in %s", service) && s
	s = checks.Equal(baggage, resp.Span.Baggage, "Baggage must match in %s", service) && s
	s = checks.Equal(sampled, resp.Span.Sampled, "Sampled must match in %s", service) && s
	if target != nil {
		if resp.Downstream == nil {
			t.Errorf("Should have downstream in S%d(%s)", level, service)
			s = false
		} else {
			s = validateTrace(t, target.Downstream, resp.Downstream,
				target.HostPort, level+1, traceID, sampled, baggage) && s
		}
	} else if resp.Downstream != nil {
		s = checks.Nil(resp.Downstream, "Should not have downstream in %s", service) && s
	}
	return s
}