Merged in feature/chatbot1 (pull request #223)
Chatbot functionality * baseline working * missing test file * more tests
This commit is contained in:
@@ -3,6 +3,7 @@ package queryapi_test
|
||||
import (
|
||||
queryapi "queryorchestration/api/queryAPI"
|
||||
"queryorchestration/internal/backgroundtask"
|
||||
"queryorchestration/internal/bot"
|
||||
"queryorchestration/internal/client"
|
||||
clientupdate "queryorchestration/internal/client/update"
|
||||
"queryorchestration/internal/collector"
|
||||
@@ -18,15 +19,22 @@ import (
|
||||
"queryorchestration/internal/folder"
|
||||
"queryorchestration/internal/label"
|
||||
"queryorchestration/internal/server/api"
|
||||
"queryorchestration/internal/serviceconfig/chatbot"
|
||||
"queryorchestration/internal/serviceconfig/queue/clientsync"
|
||||
"queryorchestration/internal/uisettings"
|
||||
)
|
||||
|
||||
// ControllerConfig provides test configuration for API controllers.
|
||||
// Note: Query-related configurations have been removed. See remove_query_plan.md.
|
||||
//
|
||||
// ChatbotConfig is embedded so initializeTestConfig can populate it
|
||||
// from the same env vars the production binary reads. Without this
|
||||
// embedding, bot.New would reject the empty config in
|
||||
// createControllerServices.
|
||||
type ControllerConfig struct {
|
||||
api.BaseConfig
|
||||
clientsync.ClientSyncConfig
|
||||
chatbot.ChatbotConfig
|
||||
BackgroundRunner *backgroundtask.Runner
|
||||
}
|
||||
|
||||
@@ -57,6 +65,15 @@ func createControllerServices(cfg *ControllerConfig) *queryapi.Services {
|
||||
eul := eula.New(cfg)
|
||||
uiSvc := uisettings.New(cfg)
|
||||
customSchema := customschema.New(cfg, &customschema.SchemaValidator{}, customschema.NewSlogAuditSink(cfg.GetLogger()))
|
||||
// Bot service requires a validated ChatbotConfig. The test env in
|
||||
// internal/test/container.go and initializeTestConfig set the five
|
||||
// CHATBOT_* variables to placeholder values that pass Validate. Any
|
||||
// failure here represents a missing test-env wiring, so we panic
|
||||
// rather than silently continuing with a nil service.
|
||||
botSvc, err := bot.New(cfg.ChatbotConfig, cfg)
|
||||
if err != nil {
|
||||
panic("test: bot.New failed: " + err.Error())
|
||||
}
|
||||
|
||||
return &queryapi.Services{
|
||||
Export: exp,
|
||||
@@ -74,5 +91,6 @@ func createControllerServices(cfg *ControllerConfig) *queryapi.Services {
|
||||
Folder: fld,
|
||||
Label: lbl,
|
||||
Eula: eul,
|
||||
Bot: botSvc,
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user