(t *testing.T)
| 109 | } |
| 110 | |
| 111 | func 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": ` |
| 118 | olap_connector: duckdb |
| 119 | `, |
| 120 | "connectors/duckdb.yaml": ` |
| 121 | type: connector |
| 122 | driver: duckdb |
| 123 | managed: 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 | |
| 161 | func TestS3Introspection(t *testing.T) { |
| 162 | // Setup a project with the S3 connector |
nothing calls this directly
no test coverage detected