feat: publish v1.0.0-rc.36-custom.1
This commit is contained in:
commit
3a7e8f3b54
2381 files changed
+551494
No files matched your search
@@ -0,0 +1,28 @@
|
||||
package service
|
||||
|
||||
import (
|
||||
"testing"
|
||||
|
||||
"github.com/QuantumNous/new-api/model"
|
||||
relaycommon "github.com/QuantumNous/new-api/relay/common"
|
||||
)
|
||||
|
||||
func TestAppendStreamStatusTreatsClientGoneAsDisplayNormal(t *testing.T) {
|
||||
status := relaycommon.NewStreamStatus()
|
||||
status.SetEndReason(relaycommon.StreamEndReasonClientGone, nil)
|
||||
info := &relaycommon.RelayInfo{IsStream: true, StreamStatus: status}
|
||||
other := model.NewLogOther()
|
||||
|
||||
appendStreamStatus(info, other)
|
||||
|
||||
streamInfo, ok := other.Snapshot()["stream_status"].(map[string]any)
|
||||
if !ok {
|
||||
t.Fatal("stream_status was not written")
|
||||
}
|
||||
if got := streamInfo["status"]; got != "ok" {
|
||||
t.Fatalf("expected client_gone display status ok, got %v", got)
|
||||
}
|
||||
if got := streamInfo["end_reason"]; got != string(relaycommon.StreamEndReasonClientGone) {
|
||||
t.Fatalf("expected client_gone end reason to be retained, got %v", got)
|
||||
}
|
||||
}
|
||||
Reference in new issue
Block a user