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

Function TestRenameReconciling

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

Source from the content-addressed store, hash-verified

633}
634
635func TestRenameReconciling(t *testing.T) {
636 adbidsPath, err := filepath.Abs("testruntime/testdata/ad_bids/data/AdBids.csv.gz")
637 require.NoError(t, err)
638
639 rt, id := testruntime.NewInstance(t)
640 testruntime.PutFiles(t, rt, id, map[string]string{
641 "/sources/foo.yaml": `
642connector: local_file
643path: ` + adbidsPath,
644 })
645
646 // Trigger a reconcile, but don't wait for it to complete
647 ctrl, err := rt.Controller(context.Background(), id)
648 require.NoError(t, err)
649 err = ctrl.Reconcile(context.Background(), runtime.GlobalProjectParserName)
650 require.NoError(t, err)
651
652 // Imperfect way to wait until the reconcile is in progress, but not completed (AdBids seems to take about 100ms to ingest).
653 // This seems good enough in practice, and if there's a bug, it will at least identify it some of the time!
654 time.Sleep(5 * time.Millisecond)
655
656 // Rename the resource while the reconcile is still running
657 testruntime.RenameFile(t, rt, id, "/sources/foo.yaml", "/sources/bar.yaml")
658
659 // Wait for it to complete and verify the output is stable
660 testruntime.ReconcileParserAndWait(t, rt, id)
661 testruntime.RequireReconcileState(t, rt, id, 2, 0, 0)
662 testruntime.RequireOLAPTable(t, rt, id, "bar")
663}
664
665func TestInterdependence(t *testing.T) {
666 // Test D -> C, D -> A, C -> A,B (-> = refs)

Callers

nothing calls this directly

Calls 8

NewInstanceFunction · 0.92
PutFilesFunction · 0.92
RenameFileFunction · 0.92
ReconcileParserAndWaitFunction · 0.92
RequireReconcileStateFunction · 0.92
RequireOLAPTableFunction · 0.92
ControllerMethod · 0.80
ReconcileMethod · 0.65

Tested by

no test coverage detected