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

Function TestSourceRefreshSchedule

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

Source from the content-addressed store, hash-verified

398}
399
400func TestSourceRefreshSchedule(t *testing.T) {
401 // Add source refresh schedule
402 rt, id := testruntime.NewInstance(t)
403 testruntime.PutFiles(t, rt, id, map[string]string{
404 "/data/foo.csv": `a,b,c,d,e
4051,2,3,4,5
4061,2,3,4,5
4071,2,3,4,5`,
408 "/sources/foo.yaml": `
409connector: local_file
410path: data/foo.csv
411invalidate_on_change: false
412refresh:
413 every: 1
414`,
415 })
416 testruntime.ReconcileParserAndWait(t, rt, id)
417 testruntime.RequireReconcileState(t, rt, id, 2, 0, 0)
418 testruntime.RequireOLAPTableCount(t, rt, id, "foo", 3)
419
420 // update the data file with only 2 rows
421 testruntime.PutFiles(t, rt, id, map[string]string{
422 "/data/foo.csv": `a,b,c,d,e
4231,2,3,4,5
4241,2,3,4,5`,
425 })
426 testruntime.ReconcileParserAndWait(t, rt, id)
427 // no change in data just yet
428 testruntime.RequireOLAPTableCount(t, rt, id, "foo", 3)
429
430 // wait to make sure the data is ingested
431 time.Sleep(2 * time.Second) // TODO: is there a way to decrease this wait time?
432 testruntime.ReconcileParserAndWait(t, rt, id)
433 // data has changed
434 testruntime.RequireOLAPTableCount(t, rt, id, "foo", 2)
435}
436
437func TestSourceAndModelNameCollission(t *testing.T) {
438 // Add source for a file

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