引入动态流量门禁、隔离验收身份与协议级 Gemini/Volces 模拟器,覆盖双站点 API、Worker、PostgreSQL、River、账务、回调和媒体物化链路。 新增 P24/P28/P32 容量阶梯、Worker 强杀恢复、真实小流量 canary、CAS 放量和失败保持 validation 的生产编排;Worker 执行槽、连接池、媒体并发和双站点副本数改为环境配置。 验证:Go 全量测试、真实 PostgreSQL 迁移集成测试、迁移安全检查、OpenAPI 生成、ShellCheck、Kustomize、gofmt 和 git diff --check。
39 lines
1.0 KiB
Go
39 lines
1.0 KiB
Go
package runner
|
|
|
|
import "testing"
|
|
|
|
func TestNormalizedBillingEngineMode(t *testing.T) {
|
|
t.Parallel()
|
|
if got := normalizedBillingEngineMode(""); got != "observe" {
|
|
t.Fatalf("empty mode = %q", got)
|
|
}
|
|
if got := normalizedBillingEngineMode("ENFORCE"); got != "enforce" {
|
|
t.Fatalf("enforce mode = %q", got)
|
|
}
|
|
if got := normalizedBillingEngineMode("hold"); got != "hold" {
|
|
t.Fatalf("hold mode = %q", got)
|
|
}
|
|
}
|
|
|
|
func TestBillingItemsFixedTotalKeepsNineDecimalPlaces(t *testing.T) {
|
|
t.Parallel()
|
|
items := []any{
|
|
map[string]any{"amount": "0.000000001"},
|
|
map[string]any{"amount": float64(0.000000002)},
|
|
}
|
|
if got := billingItemsFixedTotal(items).String(); got != "0.000000003" {
|
|
t.Fatalf("total = %s", got)
|
|
}
|
|
}
|
|
|
|
func TestAcceptanceRunModesUseRealBilling(t *testing.T) {
|
|
for _, runMode := range []string{"production", "acceptance", "acceptance_canary"} {
|
|
if !isBillableRunMode(runMode) {
|
|
t.Fatalf("run mode %q must be billable", runMode)
|
|
}
|
|
}
|
|
if isBillableRunMode("simulation") {
|
|
t.Fatal("simulation must remain non-billable")
|
|
}
|
|
}
|