(t *testing.T)
| 103 | } |
| 104 | |
| 105 | func TestEngine_XFunctions(t *testing.T) { |
| 106 | ctx := context.Background() |
| 107 | reg := prometheus.NewRegistry() |
| 108 | |
| 109 | now := time.Now() |
| 110 | start := time.Now().Add(-time.Minute * 5) |
| 111 | step := time.Minute |
| 112 | queryable := promqltest.LoadedStorage(t, "") |
| 113 | opts := promql.EngineOpts{ |
| 114 | Logger: utillog.GoKitLogToSlog(log.NewNopLogger()), |
| 115 | Reg: reg, |
| 116 | } |
| 117 | queryEngine := New(opts, ThanosEngineConfig{Enabled: true, EnableXFunctions: true}, reg) |
| 118 | |
| 119 | for name := range parse.XFunctions { |
| 120 | t.Run(name, func(t *testing.T) { |
| 121 | _, err := queryEngine.NewInstantQuery(ctx, queryable, nil, fmt.Sprintf("%s(foo[1m])", name), now) |
| 122 | require.NoError(t, err) |
| 123 | |
| 124 | _, err = queryEngine.NewRangeQuery(ctx, queryable, nil, fmt.Sprintf("%s(foo[1m])", name), start, now, step) |
| 125 | require.NoError(t, err) |
| 126 | }) |
| 127 | } |
| 128 | } |
| 129 | |
| 130 | func TestEngine_With_Logical_Plan(t *testing.T) { |
| 131 | ctx := context.Background() |
nothing calls this directly
no test coverage detected