feat: 算力引擎 Go 后端核心(new-api)
- 统一 OpenAI 兼容 /v1 中继 + 渠道/额度/令牌/流水 - 各领域包:relay 模型网关、model 数据层、controller 管理 API
This commit is contained in:
@@ -0,0 +1,31 @@
|
||||
package kitutil
|
||||
|
||||
import (
|
||||
"testing"
|
||||
|
||||
"github.com/stretchr/testify/assert"
|
||||
)
|
||||
|
||||
func TestErrorHooksRemainDistinct(t *testing.T) {
|
||||
previousError := logError.Load()
|
||||
previousSystemError := logSystemError.Load()
|
||||
t.Cleanup(func() {
|
||||
logError.Store(previousError)
|
||||
logSystemError.Store(previousSystemError)
|
||||
})
|
||||
|
||||
var ordinaryMessages []string
|
||||
var systemMessages []string
|
||||
SetLogging(nil, func(message string) {
|
||||
ordinaryMessages = append(ordinaryMessages, message)
|
||||
})
|
||||
SetSystemErrorLogging(func(message string) {
|
||||
systemMessages = append(systemMessages, message)
|
||||
})
|
||||
|
||||
LogError("invalid dto")
|
||||
LogSystemError("converter failure")
|
||||
|
||||
assert.Equal(t, []string{"invalid dto"}, ordinaryMessages)
|
||||
assert.Equal(t, []string{"converter failure"}, systemMessages)
|
||||
}
|
||||
Reference in New Issue
Block a user