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

Function TestSelfReference

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

Source from the content-addressed store, hash-verified

748}
749
750func TestSelfReference(t *testing.T) {
751 rt, id := testruntime.NewInstance(t)
752 testruntime.PutFiles(t, rt, id, map[string]string{
753 "/models/bar1.sql": `SELECT * FROM bar1`,
754 })
755 bar1Model, bar1Res := newModel("SELECT * FROM bar1", "bar1", "bar1", 0)
756 bar1Res.Meta.Refs[0].Kind = runtime.ResourceKindModel
757 bar1Res.Meta.ReconcileError = `cyclic dependency`
758 bar1Model.State = &runtimev1.ModelState{}
759
760 testruntime.ReconcileParserAndWait(t, rt, id)
761 testruntime.RequireReconcileState(t, rt, id, 2, 1, 0)
762 testruntime.RequireResource(t, rt, id, bar1Res)
763
764 testruntime.DeleteFiles(t, rt, id, "/models/bar1.sql")
765 testruntime.ReconcileParserAndWait(t, rt, id)
766 testruntime.RequireReconcileState(t, rt, id, 1, 0, 0)
767}
768
769func TestCyclesWithThreeModels(t *testing.T) {
770 // Create cyclic model

Callers

nothing calls this directly

Calls 7

NewInstanceFunction · 0.92
PutFilesFunction · 0.92
ReconcileParserAndWaitFunction · 0.92
RequireReconcileStateFunction · 0.92
RequireResourceFunction · 0.92
DeleteFilesFunction · 0.92
newModelFunction · 0.85

Tested by

no test coverage detected