mirror of
https://github.com/Wei-Shaw/sub2api.git
synced 2026-10-20 00:18:55 +00:00
test(ops): satisfy errcheck and gofmt in proxy attribution tests
This commit is contained in:
@@ -168,7 +168,8 @@ func TestNewOpenAIFirstOutputTimeoutErrorRecordsCallerProxyAttribution(t *testin
|
||||
|
||||
raw, ok := c.Get(OpsUpstreamErrorsKey)
|
||||
require.True(t, ok)
|
||||
events := raw.([]*OpsUpstreamErrorEvent)
|
||||
events, ok := raw.([]*OpsUpstreamErrorEvent)
|
||||
require.True(t, ok)
|
||||
require.Len(t, events, 2)
|
||||
require.Equal(t, "first_output_timeout", events[0].Kind)
|
||||
require.Nil(t, events[0].ProxyID)
|
||||
|
||||
@@ -195,7 +195,8 @@ func TestWriteOpenAIWSFallbackErrorResponseKeepsManagedProxy(t *testing.T) {
|
||||
|
||||
raw, ok := c.Get(OpsUpstreamErrorsKey)
|
||||
require.True(t, ok)
|
||||
events := raw.([]*OpsUpstreamErrorEvent)
|
||||
events, ok := raw.([]*OpsUpstreamErrorEvent)
|
||||
require.True(t, ok)
|
||||
require.Len(t, events, 1)
|
||||
require.NotNil(t, events[0].ProxyID)
|
||||
require.Equal(t, proxyID, *events[0].ProxyID)
|
||||
|
||||
@@ -107,13 +107,13 @@ func TestSanitizeOpsUpstreamErrorsForQueueHardBoundsSerializedBytes(t *testing.T
|
||||
const total = opsUpstreamErrorsMaxEvents
|
||||
for i := 0; i < total; i++ {
|
||||
entry.UpstreamErrors = append(entry.UpstreamErrors, &OpsUpstreamErrorEvent{
|
||||
AtUnixMs: int64(i + 1),
|
||||
Platform: strings.Repeat("p", 40),
|
||||
AccountName: strings.Repeat("a", 200),
|
||||
ProxyName: strings.Repeat("n", 200),
|
||||
UpstreamRequestID: strings.Repeat("r", 200),
|
||||
UpstreamStatusCode: 502,
|
||||
UpstreamURL: "https://example.com/" + strings.Repeat("u", 3000),
|
||||
AtUnixMs: int64(i + 1),
|
||||
Platform: strings.Repeat("p", 40),
|
||||
AccountName: strings.Repeat("a", 200),
|
||||
ProxyName: strings.Repeat("n", 200),
|
||||
UpstreamRequestID: strings.Repeat("r", 200),
|
||||
UpstreamStatusCode: 502,
|
||||
UpstreamURL: "https://example.com/" + strings.Repeat("u", 3000),
|
||||
// Plain-text payloads are truncated, not JSON-trimmed, so they keep
|
||||
// their full queue-limit weight.
|
||||
UpstreamResponseBody: strings.Repeat("b", 10_000),
|
||||
|
||||
Reference in New Issue
Block a user