(t *testing.T)
| 720 | } |
| 721 | |
| 722 | func TestCyclesWithTwoModels(t *testing.T) { |
| 723 | // Create cyclic model |
| 724 | rt, id := testruntime.NewInstance(t) |
| 725 | testruntime.PutFiles(t, rt, id, map[string]string{ |
| 726 | "/models/bar1.sql": `SELECT * FROM bar2`, |
| 727 | "/models/bar2.sql": `SELECT * FROM bar1`, |
| 728 | }) |
| 729 | bar1Model, bar1Res := newModel("SELECT * FROM bar2", "bar1", "bar2", 0) |
| 730 | bar1Res.Meta.ReconcileError = `dependency` |
| 731 | bar1Res.Meta.Refs[0].Kind = runtime.ResourceKindModel |
| 732 | bar1Model.State = &runtimev1.ModelState{} |
| 733 | bar2Model, bar2Res := newModel("SELECT * FROM bar1", "bar2", "bar1", 0) |
| 734 | bar2Res.Meta.ReconcileError = `dependency` |
| 735 | bar2Res.Meta.Refs[0].Kind = runtime.ResourceKindModel |
| 736 | bar2Model.State = &runtimev1.ModelState{} |
| 737 | testruntime.ReconcileParserAndWait(t, rt, id) |
| 738 | testruntime.RequireReconcileState(t, rt, id, 3, 2, 0) |
| 739 | testruntime.RequireResource(t, rt, id, bar1Res) |
| 740 | testruntime.RequireResource(t, rt, id, bar2Res) |
| 741 | |
| 742 | testruntime.DeleteFiles(t, rt, id, "/models/bar1.sql") |
| 743 | testruntime.ReconcileParserAndWait(t, rt, id) |
| 744 | testruntime.RequireReconcileState(t, rt, id, 2, 1, 0) |
| 745 | bar2Res.Meta.ReconcileError = `Catalog Error: Table with name bar1 does not exist!` |
| 746 | bar2Res.Meta.Refs = []*runtimev1.ResourceName{} |
| 747 | testruntime.RequireResource(t, rt, id, bar2Res) |
| 748 | } |
| 749 | |
| 750 | func TestSelfReference(t *testing.T) { |
| 751 | rt, id := testruntime.NewInstance(t) |
nothing calls this directly
no test coverage detected