MCPcopy Index your code
hub / github.com/rilldata/rill / Test_ResolveFeatureFlags

Function Test_ResolveFeatureFlags

runtime/feature_flags_test.go:10–147  ·  view source on GitHub ↗
(t *testing.T)

Source from the content-addressed store, hash-verified

8)
9
10func Test_ResolveFeatureFlags(t *testing.T) {
11 featureFlagTemplates := map[string]string{
12 "dimension_search": `{{if eq (.user.domain) "rilldata.com"}}true{{end}}`,
13 "alerts": `'{{.user.domain}}' = 'rilldata.com'`,
14 "reports": `'{{.user.domain}}' in ['rilldata.com', 'gmail.com']`,
15 "chat": `{{not .user.embed}}`,
16 "dashboard_chat": `{{.user.embed}}`,
17 }
18
19 tests := []struct {
20 name string
21 userAttrs map[string]any
22 featureFlags map[string]bool
23 }{
24 {
25 name: "rilldata user",
26 userAttrs: map[string]any{
27 "domain": "rilldata.com",
28 },
29 featureFlags: map[string]bool{
30 "exports": true,
31 "cloudDataViewer": false,
32 "dimensionSearch": true,
33 "twoTieredNavigation": false,
34 "rillTime": true,
35 "hidePublicUrl": false,
36 "exportHeader": false,
37 "alerts": true,
38 "reports": true,
39 "chat": true,
40 "dashboardChat": false,
41 "developerChat": true,
42 "chatCharts": true,
43 "deploy": true,
44 "developerAgent": true,
45 "stickyDashboardState": false,
46 "cloudEditing": false,
47 "customCharts": false,
48 "disablePersistentDashboardState": false,
49 },
50 },
51 {
52 name: "gmail user",
53 userAttrs: map[string]any{
54 "domain": "gmail.com",
55 },
56 featureFlags: map[string]bool{
57 "exports": true,
58 "cloudDataViewer": false,
59 "dimensionSearch": false,
60 "twoTieredNavigation": false,
61 "rillTime": true,
62 "hidePublicUrl": false,
63 "exportHeader": false,
64 "alerts": false,
65 "reports": true,
66 "chat": true,
67 "dashboardChat": false,

Callers

nothing calls this directly

Calls 2

ResolveFeatureFlagsFunction · 0.85
RunMethod · 0.45

Tested by

no test coverage detected