MCPcopy Index your code
hub / github.com/rilldata/rill / TestAlert

Function TestAlert

runtime/parser/parser_test.go:1490–1578  ·  view source on GitHub ↗
(t *testing.T)

Source from the content-addressed store, hash-verified

1488}
1489
1490func TestAlert(t *testing.T) {
1491 ctx := context.Background()
1492 repo := makeRepo(t, map[string]string{
1493 `rill.yaml`: ``,
1494 // model m1
1495 `models/m1.sql`: `SELECT 1`,
1496 `alerts/a1.yaml`: `
1497type: alert
1498display_name: My Alert
1499
1500refs:
1501 - model/m1
1502
1503refresh:
1504 ref_update: true
1505 cron: '0 * * * *'
1506
1507watermark: inherit
1508
1509intervals:
1510 duration: PT1H
1511 limit: 10
1512
1513query:
1514 name: MetricsViewToplist
1515 args:
1516 metrics_view: mv1
1517 for:
1518 user_email: benjamin@example.com
1519
1520on_recover: true
1521renotify: true
1522renotify_after: 24h
1523
1524notify:
1525 email:
1526 recipients:
1527 - benjamin@example.com
1528
1529annotations:
1530 foo: bar
1531`,
1532 })
1533
1534 resources := []*Resource{
1535 {
1536 Name: ResourceName{Kind: ResourceKindModel, Name: "m1"},
1537 Paths: []string{"/models/m1.sql"},
1538 ModelSpec: &runtimev1.ModelSpec{
1539 RefreshSchedule: &runtimev1.Schedule{RefUpdate: true},
1540 InputConnector: "duckdb",
1541 InputProperties: must(structpb.NewStruct(map[string]any{"sql": `SELECT 1`})),
1542 OutputConnector: "duckdb",
1543 ChangeMode: runtimev1.ModelChangeMode_MODEL_CHANGE_MODE_RESET,
1544 },
1545 },
1546 {
1547 Name: ResourceName{Kind: ResourceKindAlert, Name: "a1"},

Callers

nothing calls this directly

Calls 4

makeRepoFunction · 0.85
mustFunction · 0.70
ParseFunction · 0.70

Tested by

no test coverage detected