fix task duration recording
This commit is contained in:
@@ -110,6 +110,7 @@ func TestOpenAIClientChatContract(t *testing.T) {
|
||||
t.Fatalf("decode request: %v", err)
|
||||
}
|
||||
gotModel, _ = body["model"].(string)
|
||||
time.Sleep(25 * time.Millisecond)
|
||||
_ = json.NewEncoder(w).Encode(map[string]any{
|
||||
"id": "chatcmpl-test",
|
||||
"object": "chat.completion",
|
||||
@@ -145,6 +146,9 @@ func TestOpenAIClientChatContract(t *testing.T) {
|
||||
if response.RequestID != "req-chat-test" || response.ResponseStartedAt.IsZero() || response.ResponseFinishedAt.IsZero() {
|
||||
t.Fatalf("response metadata was not captured: %+v", response)
|
||||
}
|
||||
if response.ResponseDurationMS < 20 {
|
||||
t.Fatalf("response duration should include upstream latency, got %dms", response.ResponseDurationMS)
|
||||
}
|
||||
}
|
||||
|
||||
func TestOpenAIClientChatStreamContract(t *testing.T) {
|
||||
|
||||
Reference in New Issue
Block a user