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

Function TestComplete

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

Source from the content-addressed store, hash-verified

17)
18
19func TestComplete(t *testing.T) {
20 // Add source, model, and dashboard
21 rt, id := testruntime.NewInstance(t)
22 testruntime.PutFiles(t, rt, id, map[string]string{
23 "/data/foo.csv": `a,b,c,d,e
241,2,3,4,5
251,2,3,4,5
261,2,3,4,5
27`,
28 "/sources/foo.yaml": `
29connector: local_file
30path: data/foo.csv
31`,
32 "/models/bar.sql": `
33SELECT * FROM foo
34`,
35 "/metrics/foobar.yaml": `
36version: 1
37type: metrics_view
38model: bar
39dimensions:
40- name: a
41 column: a
42measures:
43- name: b
44 expression: count(*)
45`,
46 })
47 testruntime.ReconcileParserAndWait(t, rt, id)
48 testruntime.RequireReconcileState(t, rt, id, 4, 0, 0)
49
50 // Verify the source
51 testruntime.RequireResource(t, rt, id, &runtimev1.Resource{
52 Meta: &runtimev1.ResourceMeta{
53 Name: &runtimev1.ResourceName{Kind: runtime.ResourceKindModel, Name: "foo"},
54 Owner: runtime.GlobalProjectParserName,
55 FilePaths: []string{"/sources/foo.yaml"},
56 },
57 Resource: &runtimev1.Resource_Model{
58 Model: &runtimev1.Model{
59 Spec: &runtimev1.ModelSpec{
60 InputConnector: "local_file",
61 OutputConnector: "duckdb",
62 InputProperties: testruntime.Must(structpb.NewStruct(map[string]any{"path": "data/foo.csv", "local_files_hash": localFileHash(t, rt, id, []string{"data/foo.csv"})})),
63 OutputProperties: testruntime.Must(structpb.NewStruct(map[string]any{"materialize": true})),
64 RefreshSchedule: &runtimev1.Schedule{RefUpdate: true},
65 DefinedAsSource: true,
66 ChangeMode: runtimev1.ModelChangeMode_MODEL_CHANGE_MODE_RESET,
67 },
68 State: &runtimev1.ModelState{
69 ExecutorConnector: "duckdb",
70 ResultConnector: "duckdb",
71 ResultProperties: testruntime.Must(structpb.NewStruct(map[string]any{"table": "foo", "used_model_name": true, "view": false})),
72 ResultTable: "foo",
73 RowsTotal: 3,
74 },
75 },
76 },

Callers

nothing calls this directly

Calls 10

NewInstanceFunction · 0.92
PutFilesFunction · 0.92
ReconcileParserAndWaitFunction · 0.92
RequireReconcileStateFunction · 0.92
RequireResourceFunction · 0.92
MustFunction · 0.92
RequireOLAPTableFunction · 0.92
RequireOLAPTableCountFunction · 0.92
RequireNoOLAPTableFunction · 0.92
localFileHashFunction · 0.85

Tested by

no test coverage detected