searchTestSuite returns a set of search test cases that ensure search behavior is consistent across block types and modules. The return parameters are: - trace ID - trace - a fully-populated trace that is searched for every condition. If testing a block format, then write this trace to the block. -
(traceID []byte)
| 2173 | // - searchesThatMatch - List of search requests that are expected to match the trace |
| 2174 | // - searchesThatDontMatch - List of requests that don't match the trace |
| 2175 | func makeExpectedTrace(traceID []byte) ( |
| 2176 | id []byte, |
| 2177 | tr *tempopb.Trace, |
| 2178 | start, end uint32, |
| 2179 | expected *tempopb.TraceSearchMetadata, |
| 2180 | ) { |
| 2181 | if traceID == nil { |
| 2182 | id = test.ValidTraceID(nil) |
| 2183 | } else { |
| 2184 | id = traceID |
| 2185 | } |
| 2186 | |
| 2187 | start = 1000 |
| 2188 | end = 1001 |
| 2189 | |
| 2190 | tr = &tempopb.Trace{ |
| 2191 | ResourceSpans: []*v1.ResourceSpans{ |
| 2192 | { |
| 2193 | Resource: &v1_resource.Resource{ |
| 2194 | Attributes: []*v1_common.KeyValue{ |
| 2195 | stringKV("service.name", "MyService"), |
| 2196 | stringKV("cluster", "MyCluster"), |
| 2197 | stringKV("namespace", "MyNamespace"), |
| 2198 | stringKV("pod", "MyPod"), |
| 2199 | stringKV("container", "MyContainer"), |
| 2200 | stringKV("k8s.cluster.name", "k8sCluster"), |
| 2201 | stringKV("k8s.namespace.name", "k8sNamespace"), |
| 2202 | stringKV("k8s.pod.name", "k8sPod"), |
| 2203 | stringKV("k8s.container.name", "k8sContainer"), |
| 2204 | stringKV("bat", "Baz"), |
| 2205 | stringKV("res-dedicated.01", "res-1a"), |
| 2206 | stringKV("res-dedicated.02", "res-2a"), |
| 2207 | stringKV(attributeWithTerminalChars, "foobar"), |
| 2208 | }, |
| 2209 | }, |
| 2210 | ScopeSpans: []*v1.ScopeSpans{ |
| 2211 | { |
| 2212 | Scope: &v1_common.InstrumentationScope{ |
| 2213 | Name: "scope-1", |
| 2214 | Version: "version-1", |
| 2215 | DroppedAttributesCount: 1, |
| 2216 | Attributes: []*v1_common.KeyValue{ |
| 2217 | stringKV("scope-attr-str", "scope-attr-1"), |
| 2218 | }, |
| 2219 | }, |
| 2220 | Spans: []*v1.Span{ |
| 2221 | { |
| 2222 | TraceId: id, |
| 2223 | Name: "MySpan", |
| 2224 | SpanId: []byte{1, 2, 3}, |
| 2225 | ParentSpanId: []byte{4, 5, 6}, |
| 2226 | StartTimeUnixNano: uint64(1000 * time.Second), |
| 2227 | EndTimeUnixNano: uint64(1001 * time.Second), |
| 2228 | Status: &v1.Status{ |
| 2229 | Code: v1.Status_STATUS_CODE_ERROR, |
| 2230 | }, |
| 2231 | Attributes: []*v1_common.KeyValue{ |
| 2232 | stringKV("http.method", "Get"), |
no test coverage detected