mirror of
https://github.com/Wei-Shaw/sub2api.git
synced 2026-12-06 00:05:30 +00:00
test(billing): 将 Ultrafast 门控与计费一致性用例移入 unit 标签文件
用例依赖仅在 unit 标签下定义的 newTestBillingService,放在无标签的 openai_fast_policy_test.go 中导致 lint 与 integration 构建失败。
This commit is contained in:
1 parent
ad9eeedebb
commit
926d3cd86d
2 files changed
+29
-29
No files matched your search
@@ -2225,6 +2225,35 @@ func TestAstraUltrafastPricingUsesSixTimesStandard(t *testing.T) {
|
||||
require.Equal(t, 2.0, configuredServiceTierMultiplier("ultrafast", p))
|
||||
}
|
||||
|
||||
// 门控与计费共用同一判定:凡是分组会强制写入 ultrafast 的模型,都必须按 6x 计费。
|
||||
func TestOpenAIUltrafastGateMatchesBilling(t *testing.T) {
|
||||
svc := newTestBillingService()
|
||||
for _, tt := range []struct {
|
||||
model string
|
||||
want float64
|
||||
}{
|
||||
{model: "gpt-6-astra", want: 6},
|
||||
{model: "gpt-6.1-sol", want: 6},
|
||||
{model: "gpt-6.1-sol-high", want: 6},
|
||||
{model: "gpt-6.1-terra", want: 2},
|
||||
{model: "gpt-6-sol", want: 2},
|
||||
{model: "gpt-5.6-sol", want: 2},
|
||||
} {
|
||||
pricing, err := svc.GetModelPricing(tt.model)
|
||||
require.NoError(t, err, tt.model)
|
||||
require.Equal(t, tt.want, configuredServiceTierMultiplier(OpenAIFastTierUltrafast, pricing), tt.model)
|
||||
require.Equal(t, tt.want == 6, openAIModelSupportsUltrafast(tt.model), tt.model)
|
||||
|
||||
// 渠道自定义价格与显式 Fast 倍率都不改变 Ultrafast 倍率。
|
||||
custom, fast := 1e-6, 3.0
|
||||
channelPricing, err := svc.GetModelPricingWithChannel(tt.model, &ChannelModelPricing{
|
||||
InputPrice: &custom, OutputPrice: &custom, FastMultiplier: &fast,
|
||||
})
|
||||
require.NoError(t, err, tt.model)
|
||||
require.Equal(t, tt.want, configuredServiceTierMultiplier(OpenAIFastTierUltrafast, channelPricing), tt.model)
|
||||
}
|
||||
}
|
||||
|
||||
func TestGPT61SolExplicitZeroCacheWriteAcrossTiers(t *testing.T) {
|
||||
pricing := &PricingService{}
|
||||
var err error
|
||||
|
||||
@@ -681,35 +681,6 @@ func TestOpenAIModelSupportsUltrafast(t *testing.T) {
|
||||
}
|
||||
}
|
||||
|
||||
// 门控与计费共用同一判定:凡是分组会强制写入 ultrafast 的模型,都必须按 6x 计费。
|
||||
func TestOpenAIUltrafastGateMatchesBilling(t *testing.T) {
|
||||
svc := newTestBillingService()
|
||||
for _, tt := range []struct {
|
||||
model string
|
||||
want float64
|
||||
}{
|
||||
{model: "gpt-6-astra", want: 6},
|
||||
{model: "gpt-6.1-sol", want: 6},
|
||||
{model: "gpt-6.1-sol-high", want: 6},
|
||||
{model: "gpt-6.1-terra", want: 2},
|
||||
{model: "gpt-6-sol", want: 2},
|
||||
{model: "gpt-5.6-sol", want: 2},
|
||||
} {
|
||||
pricing, err := svc.GetModelPricing(tt.model)
|
||||
require.NoError(t, err, tt.model)
|
||||
require.Equal(t, tt.want, configuredServiceTierMultiplier(OpenAIFastTierUltrafast, pricing), tt.model)
|
||||
require.Equal(t, tt.want == 6, openAIModelSupportsUltrafast(tt.model), tt.model)
|
||||
|
||||
// 渠道自定义价格与显式 Fast 倍率都不改变 Ultrafast 倍率。
|
||||
custom, fast := 1e-6, 3.0
|
||||
channelPricing, err := svc.GetModelPricingWithChannel(tt.model, &ChannelModelPricing{
|
||||
InputPrice: &custom, OutputPrice: &custom, FastMultiplier: &fast,
|
||||
})
|
||||
require.NoError(t, err, tt.model)
|
||||
require.Equal(t, tt.want, configuredServiceTierMultiplier(OpenAIFastTierUltrafast, channelPricing), tt.model)
|
||||
}
|
||||
}
|
||||
|
||||
func TestOpenAIGroupForcedServiceTier(t *testing.T) {
|
||||
openAIAccount := &Account{Platform: PlatformOpenAI, Type: AccountTypeOAuth}
|
||||
const sol, astra, unsupported = "gpt-6.1-sol", "gpt-6-astra", "gpt-5.6-sol"
|
||||
|
||||
Reference in new issue
Block a user