5759c1862e
M0-M7 已完成:核心网关(身份/RBAC/TOTP/OIDC/SAML/Provider/配额/路由/内容策略/审计/定价)+ 资源市场(MCP/Skills/数字员工)。 含 22 个 PostgreSQL 迁移、管理端/门户端前端源码、OpenAPI 契约、部署 compose。 Co-Authored-By: Claude <noreply@anthropic.com>
31 lines
875 B
Go
31 lines
875 B
Go
package gateway
|
|
|
|
import (
|
|
"testing"
|
|
"time"
|
|
)
|
|
|
|
func TestRedisInteger(t *testing.T) {
|
|
for _, value := range []any{int64(7), "7", []byte("7")} {
|
|
got, err := redisInteger(value)
|
|
if err != nil || got != 7 {
|
|
t.Fatalf("redisInteger(%T) = %d, %v", value, got, err)
|
|
}
|
|
}
|
|
if _, err := redisInteger(7.0); err == nil {
|
|
t.Fatal("unexpected redis number type accepted")
|
|
}
|
|
}
|
|
|
|
func TestAdmissionResetBoundaries(t *testing.T) {
|
|
now := time.Date(2026, time.August, 10, 13, 25, 40, 0, time.UTC)
|
|
minuteReset := now.Truncate(time.Minute).Add(time.Minute)
|
|
monthReset := time.Date(now.Year(), now.Month()+1, 1, 0, 0, 0, 0, time.UTC)
|
|
if minuteReset != time.Date(2026, time.August, 10, 13, 26, 0, 0, time.UTC) {
|
|
t.Fatal("minute boundary is incorrect")
|
|
}
|
|
if monthReset != time.Date(2026, time.September, 1, 0, 0, 0, 0, time.UTC) {
|
|
t.Fatal("month boundary is incorrect")
|
|
}
|
|
}
|