(t *testing.T)
| 663 | } |
| 664 | |
| 665 | func TestInterdependence(t *testing.T) { |
| 666 | // Test D -> C, D -> A, C -> A,B (-> = refs) |
| 667 | // Test error propagation on source error |
| 668 | |
| 669 | // Create interdependent model |
| 670 | rt, id := testruntime.NewInstance(t) |
| 671 | testruntime.PutFiles(t, rt, id, map[string]string{ |
| 672 | "/data/foo.csv": `a,b,c,d,e |
| 673 | 1,2,3,4,5 |
| 674 | 1,2,3,4,5 |
| 675 | 1,2,3,4,5 |
| 676 | `, |
| 677 | "/sources/foo.yaml": ` |
| 678 | connector: local_file |
| 679 | path: data/foo.csv |
| 680 | `, |
| 681 | "/models/bar1.sql": `SELECT * FROM foo`, |
| 682 | "/models/bar2.sql": `SELECT * FROM bar1`, |
| 683 | "/models/bar3.sql": `SELECT * FROM bar2`, |
| 684 | "/metrics/dash.yaml": ` |
| 685 | version: 1 |
| 686 | type: metrics_view |
| 687 | display_name: Dash |
| 688 | model: bar3 |
| 689 | dimensions: |
| 690 | - column: b |
| 691 | - column: c |
| 692 | measures: |
| 693 | - expression: count(*) |
| 694 | - expression: avg(a) |
| 695 | `, |
| 696 | }) |
| 697 | metrics, metricsRes := newMetricsView("dash", "bar3", "", []any{"count(*)", runtimev1.Type_CODE_INT64, "avg(a)", runtimev1.Type_CODE_FLOAT64}, []any{"b", runtimev1.Type_CODE_INT64, "c", runtimev1.Type_CODE_INT64}) |
| 698 | testruntime.ReconcileParserAndWait(t, rt, id) |
| 699 | testruntime.RequireReconcileState(t, rt, id, 6, 0, 0) |
| 700 | testruntime.RequireOLAPTableCount(t, rt, id, "bar1", 3) |
| 701 | testruntime.RequireOLAPTableCount(t, rt, id, "bar2", 3) |
| 702 | testruntime.RequireOLAPTableCount(t, rt, id, "bar3", 3) |
| 703 | testruntime.RequireResource(t, rt, id, metricsRes) |
| 704 | |
| 705 | // Update the source to invalid file |
| 706 | testruntime.PutFiles(t, rt, id, map[string]string{ |
| 707 | "/sources/foo.yaml": ` |
| 708 | connector: local_file |
| 709 | path: data/bar.csv |
| 710 | `, |
| 711 | }) |
| 712 | testruntime.ReconcileParserAndWait(t, rt, id) |
| 713 | testruntime.RequireReconcileState(t, rt, id, 6, 5, 0) |
| 714 | testruntime.RequireNoOLAPTable(t, rt, id, "bar1") |
| 715 | testruntime.RequireNoOLAPTable(t, rt, id, "bar2") |
| 716 | testruntime.RequireNoOLAPTable(t, rt, id, "bar3") |
| 717 | metricsRes.Meta.ReconcileError = `table "bar3" does not exist` |
| 718 | metrics.State = &runtimev1.MetricsViewState{} |
| 719 | testruntime.RequireResource(t, rt, id, metricsRes) |
| 720 | } |
| 721 | |
| 722 | func TestCyclesWithTwoModels(t *testing.T) { |
nothing calls this directly
no test coverage detected