mirror of
https://github.com/Ed1s0nZ/CyberStrikeAI.git
synced 2026-10-22 15:18:33 +02:00
fix: retain knowledge indexing errors and explain failure causes
This commit is contained in:
1 parent
bb96a084e0
commit
5dc9cb1541
7 files changed
+94
-11
No files matched your search
@@ -0,0 +1,20 @@
|
||||
package handler
|
||||
|
||||
import (
|
||||
"testing"
|
||||
"time"
|
||||
)
|
||||
|
||||
func TestKnowledgeIndexFailureRemainsVisibleUntilCleared(t *testing.T) {
|
||||
occurred := time.Now().Add(-time.Hour)
|
||||
status := map[string]interface{}{}
|
||||
appendKnowledgeIndexError(status, "test-only embedding failure: 401 Unauthorized", occurred)
|
||||
if status["last_error"] == nil || status["last_error_time"] != occurred.Format(time.RFC3339) {
|
||||
t.Fatal("older failure disappeared")
|
||||
}
|
||||
cleared := map[string]interface{}{}
|
||||
appendKnowledgeIndexError(cleared, "", time.Time{})
|
||||
if _, ok := cleared["last_error"]; ok {
|
||||
t.Fatal("cleared failure remained")
|
||||
}
|
||||
}
|
||||
Reference in new issue
Block a user