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

Function TestS3Model

runtime/ai/developer_agent_test.go:111–159  ·  view source on GitHub ↗
(t *testing.T)

Source from the content-addressed store, hash-verified

109}
110
111func TestS3Model(t *testing.T) {
112 // Setup a basic empty project
113 rt, instanceID := testruntime.NewInstanceWithOptions(t, testruntime.InstanceOptions{
114 AIConnector: "openai",
115 TestConnectors: []string{"s3"}, // Add environment variables for the test S3 connector
116 Files: map[string]string{
117 "rill.yaml": `
118olap_connector: duckdb
119`,
120 "connectors/duckdb.yaml": `
121type: connector
122driver: duckdb
123managed: true
124`,
125 },
126 })
127 testruntime.RequireReconcileState(t, rt, instanceID, 2, 0, 0)
128
129 // Initialize eval
130 s := newEval(t, rt, instanceID)
131
132 // Ask it to build a DuckDB model for CSV files in S3
133 var res *ai.RouterAgentResult
134 _, err := s.CallTool(t.Context(), ai.RoleUser, ai.RouterAgentName, &res, ai.RouterAgentArgs{
135 Prompt: "I have some CSV files in S3. Can you create a connector for S3 and a DuckDB model that loads the data at s3://integration-test.rilldata.com/glob_test/y=*/*.csv? I've already added environment variables for S3 access. Please proceed without asking clarifying questions.",
136 })
137 require.NoError(t, err)
138 require.Equal(t, ai.DeveloperAgentName, res.Agent)
139
140 // Check that it doesn't have any parse or reconcile errors.
141 testruntime.RequireReconcileState(t, rt, instanceID, -1, 0, 0)
142
143 // Check there's a DuckDB and S3 connector
144 ctrl, err := rt.Controller(t.Context(), instanceID)
145 require.NoError(t, err)
146 connectors, err := ctrl.List(t.Context(), runtime.ResourceKindConnector, "", false)
147 require.NoError(t, err)
148 var connectorNames []string
149 for _, c := range connectors {
150 connectorNames = append(connectorNames, c.Meta.Name.Name)
151 }
152 require.Contains(t, connectorNames, "duckdb")
153 require.Contains(t, connectorNames, "s3")
154
155 // Check there's a model created
156 models, err := ctrl.List(t.Context(), runtime.ResourceKindModel, "", false)
157 require.NoError(t, err)
158 require.Greater(t, len(models), 0)
159}
160
161func TestS3Introspection(t *testing.T) {
162 // Setup a project with the S3 connector

Callers

nothing calls this directly

Calls 8

NewInstanceWithOptionsFunction · 0.92
RequireReconcileStateFunction · 0.92
newEvalFunction · 0.85
CallToolMethod · 0.80
ControllerMethod · 0.80
ListMethod · 0.80
ContainsMethod · 0.80
ContextMethod · 0.65

Tested by

no test coverage detected