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

Function TestResolveTemplatedString

runtime/server/templated_strings_test.go:17–49  ·  view source on GitHub ↗

TestResolveTemplatedString is a basic integration test that verifies the RPC delegates to the text resolver. Comprehensive test coverage lives in runtime/resolvers/text_test.go.

(t *testing.T)

Source from the content-addressed store, hash-verified

15// TestResolveTemplatedString is a basic integration test that verifies the RPC delegates to the text resolver.
16// Comprehensive test coverage lives in runtime/resolvers/text_test.go.
17func TestResolveTemplatedString(t *testing.T) {
18 rt, instanceID := testruntime.NewInstanceWithOptions(t, testruntime.InstanceOptions{
19 Files: map[string]string{
20 "rill.yaml": "",
21 "model.sql": `
22SELECT 'US' AS country, 100 AS revenue
23UNION ALL
24SELECT 'UK' AS country, 200 AS revenue
25`,
26 "mv.yaml": `
27type: metrics_view
28version: 1
29model: model
30dimensions:
31- column: country
32measures:
33- name: total_revenue
34 expression: SUM(revenue)
35`,
36 },
37 })
38 testruntime.RequireReconcileState(t, rt, instanceID, 3, 0, 0)
39
40 srv, err := server.NewServer(t.Context(), &server.Options{}, rt, zap.NewNop(), ratelimit.NewNoop(), activity.NewNoopClient())
41 require.NoError(t, err)
42
43 res, err := srv.ResolveTemplatedString(testCtx(), &runtimev1.ResolveTemplatedStringRequest{
44 InstanceId: instanceID,
45 Body: `Revenue: {{ metrics_sql "SELECT total_revenue FROM mv" }}`,
46 })
47 require.NoError(t, err)
48 require.Equal(t, "Revenue: 300", res.Body)
49}

Callers

nothing calls this directly

Calls 8

NewInstanceWithOptionsFunction · 0.92
RequireReconcileStateFunction · 0.92
NewServerFunction · 0.92
NewNoopFunction · 0.92
NewNoopClientFunction · 0.92
testCtxFunction · 0.85
ContextMethod · 0.65

Tested by

no test coverage detected