(t *testing.T)
| 1194 | } |
| 1195 | |
| 1196 | func TestAlert(t *testing.T) { |
| 1197 | rt, id := testruntime.NewInstance(t) |
| 1198 | testruntime.PutFiles(t, rt, id, map[string]string{ |
| 1199 | "/data/foo.csv": `__time,country |
| 1200 | 2024-01-01T00:00:00Z,Denmark |
| 1201 | `, |
| 1202 | "/sources/foo.yaml": ` |
| 1203 | connector: local_file |
| 1204 | path: data/foo.csv |
| 1205 | `, |
| 1206 | "/models/bar.sql": `SELECT * FROM foo`, |
| 1207 | "/metrics/dash.yaml": ` |
| 1208 | version: 1 |
| 1209 | type: metrics_view |
| 1210 | display_name: Dash |
| 1211 | model: bar |
| 1212 | dimensions: |
| 1213 | - column: country |
| 1214 | measures: |
| 1215 | - expression: count(*) |
| 1216 | `, |
| 1217 | }) |
| 1218 | testruntime.ReconcileParserAndWait(t, rt, id) |
| 1219 | testruntime.RequireReconcileState(t, rt, id, 4, 0, 0) |
| 1220 | |
| 1221 | _, metricsRes := newMetricsView("dash", "bar", "", []any{"count(*)", runtimev1.Type_CODE_INT64}, []any{"country", runtimev1.Type_CODE_STRING}) |
| 1222 | testruntime.RequireResource(t, rt, id, metricsRes) |
| 1223 | } |
| 1224 | |
| 1225 | func newSource(name, path, localFileHash string, rows int64) (*runtimev1.Model, *runtimev1.Resource) { |
| 1226 | source := &runtimev1.Model{ |
nothing calls this directly
no test coverage detected