(t *testing.T)
| 216 | } |
| 217 | |
| 218 | func TestUpdateServer(t *testing.T) { |
| 219 | ctx, err := testutils.ContextWithNewLogger() |
| 220 | if err != nil { |
| 221 | t.Fatalf("error setting up logger: %s", err) |
| 222 | } |
| 223 | |
| 224 | addr, port := "127.0.0.1", 5000 |
| 225 | cfg := server.ServerConfig{ |
| 226 | Version: "0.0.0", |
| 227 | Address: addr, |
| 228 | Port: port, |
| 229 | } |
| 230 | |
| 231 | instrumentation, err := telemetry.CreateTelemetryInstrumentation(cfg.Version) |
| 232 | if err != nil { |
| 233 | t.Fatalf("unexpected error: %s", err) |
| 234 | } |
| 235 | |
| 236 | ctx = util.WithInstrumentation(ctx, instrumentation) |
| 237 | |
| 238 | s, err := server.NewServer(ctx, cfg) |
| 239 | if err != nil { |
| 240 | t.Fatalf("error setting up server: %s", err) |
| 241 | } |
| 242 | |
| 243 | newSources := map[string]sources.Source{ |
| 244 | "example-source": &alloydbpg.Source{ |
| 245 | Config: alloydbpg.Config{ |
| 246 | Name: "example-alloydb-source", |
| 247 | Type: "alloydb-postgres", |
| 248 | }, |
| 249 | }, |
| 250 | } |
| 251 | newAuth := map[string]auth.AuthService{"example-auth": nil} |
| 252 | newEmbeddingModels := map[string]embeddingmodels.EmbeddingModel{"example-model": nil} |
| 253 | newTools := map[string]tools.Tool{"example-tool": nil} |
| 254 | newToolsets := map[string]tools.Toolset{ |
| 255 | "example-toolset": { |
| 256 | ToolsetConfig: tools.ToolsetConfig{ |
| 257 | Name: "example-toolset", |
| 258 | }, |
| 259 | Tools: []*tools.Tool{}, |
| 260 | }, |
| 261 | } |
| 262 | newPrompts := map[string]prompts.Prompt{"example-prompt": nil} |
| 263 | newPromptsets := map[string]prompts.Promptset{ |
| 264 | "example-promptset": { |
| 265 | PromptsetConfig: prompts.PromptsetConfig{ |
| 266 | Name: "example-promptset", |
| 267 | }, |
| 268 | Prompts: []*prompts.Prompt{}, |
| 269 | }, |
| 270 | } |
| 271 | s.ResourceMgr.SetResources(newSources, newAuth, newEmbeddingModels, newTools, newToolsets, newPrompts, newPromptsets) |
| 272 | if err != nil { |
| 273 | t.Errorf("error updating server: %s", err) |
| 274 | } |
| 275 |
nothing calls this directly
no test coverage detected