MCPcopy Create free account
hub / github.com/rilldata/rill / TestAlert

Function TestAlert

runtime/controller_test.go:1196–1223  ·  view source on GitHub ↗
(t *testing.T)

Source from the content-addressed store, hash-verified

1194}
1195
1196func 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
12002024-01-01T00:00:00Z,Denmark
1201`,
1202 "/sources/foo.yaml": `
1203connector: local_file
1204path: data/foo.csv
1205`,
1206 "/models/bar.sql": `SELECT * FROM foo`,
1207 "/metrics/dash.yaml": `
1208version: 1
1209type: metrics_view
1210display_name: Dash
1211model: bar
1212dimensions:
1213- column: country
1214measures:
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
1225func newSource(name, path, localFileHash string, rows int64) (*runtimev1.Model, *runtimev1.Resource) {
1226 source := &runtimev1.Model{

Callers

nothing calls this directly

Calls 6

NewInstanceFunction · 0.92
PutFilesFunction · 0.92
ReconcileParserAndWaitFunction · 0.92
RequireReconcileStateFunction · 0.92
RequireResourceFunction · 0.92
newMetricsViewFunction · 0.70

Tested by

no test coverage detected