Add Neo loading in test preparation
- Integrated Neo loading in the Prepare function of testutils.go to ensure the Neo environment is initialized before running tests. - Updated error handling to log failures in loading Neo, enhancing test reliability and feedback. - Adjusted variable assignment for Knowledge Base loading to maintain consistency in error handling.
This commit is contained in:
parent
d8f267694d
commit
b5812a7f2f
1 changed files with 8 additions and 1 deletions
|
|
@ -16,6 +16,7 @@ import (
|
||||||
"github.com/gin-gonic/gin"
|
"github.com/gin-gonic/gin"
|
||||||
"github.com/yaoapp/yao/config"
|
"github.com/yaoapp/yao/config"
|
||||||
"github.com/yaoapp/yao/kb"
|
"github.com/yaoapp/yao/kb"
|
||||||
|
"github.com/yaoapp/yao/neo"
|
||||||
"github.com/yaoapp/yao/openapi"
|
"github.com/yaoapp/yao/openapi"
|
||||||
"github.com/yaoapp/yao/openapi/oauth"
|
"github.com/yaoapp/yao/openapi/oauth"
|
||||||
"github.com/yaoapp/yao/openapi/oauth/types"
|
"github.com/yaoapp/yao/openapi/oauth/types"
|
||||||
|
|
@ -153,8 +154,14 @@ func Prepare(t *testing.T) string {
|
||||||
// Step 1: Initialize base test environment with all Yao dependencies
|
// Step 1: Initialize base test environment with all Yao dependencies
|
||||||
test.Prepare(t, config.Conf)
|
test.Prepare(t, config.Conf)
|
||||||
|
|
||||||
|
// Load Neo
|
||||||
|
err := neo.Load(config.Conf)
|
||||||
|
if err != nil {
|
||||||
|
t.Fatalf("Failed to load Neo: %v", err)
|
||||||
|
}
|
||||||
|
|
||||||
// Step 1.5: Initialize Knowledge Base (must be done before OpenAPI load)
|
// Step 1.5: Initialize Knowledge Base (must be done before OpenAPI load)
|
||||||
_, err := kb.Load(config.Conf)
|
_, err = kb.Load(config.Conf)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
// KB loading failure is not fatal for tests, just log it
|
// KB loading failure is not fatal for tests, just log it
|
||||||
t.Logf("Warning: Failed to load Knowledge Base: %v", err)
|
t.Logf("Warning: Failed to load Knowledge Base: %v", err)
|
||||||
|
|
|
||||||
Loading…
Add table
Reference in a new issue