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

Function TestCacheInvalidation

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

Source from the content-addressed store, hash-verified

365}
366
367func TestCacheInvalidation(t *testing.T) {
368 // Add source and model
369 rt, id := testruntime.NewInstance(t)
370 testruntime.PutFiles(t, rt, id, map[string]string{
371 "/data/foo.csv": `a,b,c,d,e
3721,2,3,4,5
3731,2,3,4,5
3741,2,3,4,5
375`,
376 "/sources/foo.yaml": `
377connector: local_file
378path: data/foo.csv
379`,
380 "/models/bar.sql": `SELECT * FROM foo`,
381 })
382 testruntime.ReconcileParserAndWait(t, rt, id)
383 testruntime.RequireReconcileState(t, rt, id, 3, 0, 0)
384 testruntime.RequireOLAPTableCount(t, rt, id, "bar", 3)
385
386 testruntime.PutFiles(t, rt, id, map[string]string{
387 "/models/bar.sql": `SELECT * FROM foo LIMIT`,
388 })
389 testruntime.ReconcileParserAndWait(t, rt, id)
390 testruntime.RequireReconcileState(t, rt, id, 2, 1, 1)
391
392 testruntime.PutFiles(t, rt, id, map[string]string{
393 "/models/bar.sql": `SELECT * FROM foo LIMIT 1`,
394 })
395 testruntime.ReconcileParserAndWait(t, rt, id)
396 testruntime.RequireReconcileState(t, rt, id, 3, 0, 0)
397 testruntime.RequireOLAPTableCount(t, rt, id, "bar", 1) // limit in model should override the limit in the query
398}
399
400func TestSourceRefreshSchedule(t *testing.T) {
401 // Add source refresh schedule

Callers

nothing calls this directly

Calls 5

NewInstanceFunction · 0.92
PutFilesFunction · 0.92
ReconcileParserAndWaitFunction · 0.92
RequireReconcileStateFunction · 0.92
RequireOLAPTableCountFunction · 0.92

Tested by

no test coverage detected