- 引入 LogicalConn/TransportConn 分层,ClientConn 保留兼容适配层 - 新增 Stream、Bulk、RecordStream 三条数据面能力及对应控制路径 - 完成 transfer/file 传输内核与状态快照、诊断能力 - 补齐 reconnect、inbound dispatcher、modern psk 等基础模块 - 增加大规模回归、并发与基准测试覆盖 - 更新依赖库
41 lines
1.6 KiB
Go
41 lines
1.6 KiB
Go
package starnotify
|
|
|
|
import "testing"
|
|
|
|
func TestGetDiagnosticsSnapshotByKeyDefaults(t *testing.T) {
|
|
const clientKey = "diagnostics-client"
|
|
const serverKey = "diagnostics-server"
|
|
_ = DeleteClient(clientKey)
|
|
_ = DeleteServer(serverKey)
|
|
defer DeleteClient(clientKey)
|
|
defer DeleteServer(serverKey)
|
|
|
|
NewClient(clientKey)
|
|
NewServer(serverKey)
|
|
|
|
clientSnapshot, err := GetClientDiagnosticsSnapshot(clientKey)
|
|
if err != nil {
|
|
t.Fatalf("GetClientDiagnosticsSnapshot failed: %v", err)
|
|
}
|
|
if got, want := clientSnapshot.Runtime.OwnerState, "idle"; got != want {
|
|
t.Fatalf("client Runtime.OwnerState = %q, want %q", got, want)
|
|
}
|
|
if clientSnapshot.Summary.LogicalCount != 0 || clientSnapshot.Summary.StreamCount != 0 || clientSnapshot.Summary.BulkCount != 0 || clientSnapshot.Summary.TransferCount != 0 {
|
|
t.Fatalf("unexpected default client summary: %+v", clientSnapshot.Summary)
|
|
}
|
|
|
|
serverSnapshot, err := GetServerDiagnosticsSnapshot(serverKey)
|
|
if err != nil {
|
|
t.Fatalf("GetServerDiagnosticsSnapshot failed: %v", err)
|
|
}
|
|
if got, want := serverSnapshot.Runtime.OwnerState, "idle"; got != want {
|
|
t.Fatalf("server Runtime.OwnerState = %q, want %q", got, want)
|
|
}
|
|
if len(serverSnapshot.Logicals) != 0 || len(serverSnapshot.CurrentTransports) != 0 {
|
|
t.Fatalf("unexpected default server diagnostics: %+v", serverSnapshot)
|
|
}
|
|
if serverSnapshot.Summary.LogicalCount != 0 || serverSnapshot.Summary.StreamCount != 0 || serverSnapshot.Summary.BulkCount != 0 || serverSnapshot.Summary.TransferCount != 0 {
|
|
t.Fatalf("unexpected default server summary: %+v", serverSnapshot.Summary)
|
|
}
|
|
}
|