(t *testing.T)
| 2033 | } |
| 2034 | |
| 2035 | func TestSpansetExistence(t *testing.T) { |
| 2036 | tests := []struct { |
| 2037 | query string |
| 2038 | span Span |
| 2039 | matches bool |
| 2040 | }{ |
| 2041 | // return traces where .foo exists |
| 2042 | { |
| 2043 | query: `{ .foo != nil }`, |
| 2044 | span: &mockSpan{ |
| 2045 | attributes: map[Attribute]Static{ |
| 2046 | NewAttribute("bar"): NewStaticString("bzz"), |
| 2047 | }, |
| 2048 | }, |
| 2049 | matches: false, |
| 2050 | }, |
| 2051 | { |
| 2052 | query: `{ .bar != nil }`, |
| 2053 | span: &mockSpan{ |
| 2054 | attributes: map[Attribute]Static{ |
| 2055 | NewAttribute("bar"): NewStaticString("bzz"), |
| 2056 | }, |
| 2057 | }, |
| 2058 | matches: true, |
| 2059 | }, |
| 2060 | { |
| 2061 | query: `{ .int != nil }`, |
| 2062 | span: &mockSpan{ |
| 2063 | attributes: map[Attribute]Static{ |
| 2064 | NewAttribute("int"): NewStaticInt(1), |
| 2065 | }, |
| 2066 | }, |
| 2067 | matches: true, |
| 2068 | }, |
| 2069 | { |
| 2070 | query: `{ .duration != nil }`, |
| 2071 | span: &mockSpan{ |
| 2072 | attributes: map[Attribute]Static{ |
| 2073 | NewAttribute("duration"): NewStaticDuration(time.Minute), |
| 2074 | }, |
| 2075 | }, |
| 2076 | matches: true, |
| 2077 | }, |
| 2078 | { |
| 2079 | query: `{ .float != nil }`, |
| 2080 | span: &mockSpan{ |
| 2081 | attributes: map[Attribute]Static{ |
| 2082 | NewAttribute("float"): NewStaticFloat(2.0), |
| 2083 | }, |
| 2084 | }, |
| 2085 | matches: true, |
| 2086 | }, |
| 2087 | { |
| 2088 | query: `{ nil = nil }`, |
| 2089 | span: &mockSpan{ |
| 2090 | attributes: map[Attribute]Static{ |
| 2091 | NewAttribute("float"): NewStaticFloat(2.0), |
| 2092 | }, |
nothing calls this directly
no test coverage detected