Report QUIC capacity in smoke
This commit is contained in:
@@ -45,6 +45,7 @@ type smokeReport struct {
|
||||
FabricVPNPacketFanout int `json:"fabric_vpn_packet_fanout"`
|
||||
FabricQUICAccepted bool `json:"fabric_quic_accepted"`
|
||||
FabricQUICEndpoint string `json:"fabric_quic_endpoint"`
|
||||
FabricQUICPressure int `json:"fabric_quic_capacity_pressure_percent"`
|
||||
FabricSessionLatencyMS int64 `json:"fabric_session_latency_ms"`
|
||||
FabricSessionEndpoint string `json:"fabric_session_endpoint"`
|
||||
PeerEndpoints map[string]any `json:"peer_endpoints"`
|
||||
@@ -145,7 +146,7 @@ func run(ctx context.Context) (smokeReport, error) {
|
||||
if err != nil {
|
||||
return smokeReport{}, fmt.Errorf("fabric vpn packet session smoke: %w", err)
|
||||
}
|
||||
fabricQUICAccepted, fabricQUICEndpoint, err := smokeQUICFabricSession(ctx)
|
||||
fabricQUICAccepted, fabricQUICEndpoint, fabricQUICPressure, err := smokeQUICFabricSession(ctx)
|
||||
if err != nil {
|
||||
return smokeReport{}, fmt.Errorf("fabric quic smoke: %w", err)
|
||||
}
|
||||
@@ -167,6 +168,7 @@ func run(ctx context.Context) (smokeReport, error) {
|
||||
FabricVPNPacketFanout: fabricVPNPacketFanout,
|
||||
FabricQUICAccepted: fabricQUICAccepted,
|
||||
FabricQUICEndpoint: fabricQUICEndpoint,
|
||||
FabricQUICPressure: fabricQUICPressure,
|
||||
FabricSessionLatencyMS: fabricSessionLatency.Milliseconds(),
|
||||
FabricSessionEndpoint: nodeB.URL + "/mesh/v1/fabric/session/ws",
|
||||
PeerEndpoints: map[string]any{
|
||||
@@ -177,17 +179,20 @@ func run(ctx context.Context) (smokeReport, error) {
|
||||
}, nil
|
||||
}
|
||||
|
||||
func smokeQUICFabricSession(ctx context.Context) (bool, string, error) {
|
||||
func smokeQUICFabricSession(ctx context.Context) (bool, string, int, error) {
|
||||
server, err := mesh.StartQUICFabricServer(ctx, mesh.QUICFabricServerConfig{
|
||||
ListenAddr: "127.0.0.1:0",
|
||||
TLSConfig: smokeQUICTLSConfig(),
|
||||
})
|
||||
if err != nil {
|
||||
return false, "", err
|
||||
return false, "", 0, err
|
||||
}
|
||||
defer server.Close()
|
||||
endpoint := server.Addr().String()
|
||||
session, err := mesh.NewQUICFabricTransport(nil).Connect(ctx, mesh.FabricTransportTarget{
|
||||
transport := mesh.NewQUICFabricTransport(nil)
|
||||
defer transport.Close()
|
||||
session, err := transport.Connect(ctx, mesh.FabricTransportTarget{
|
||||
PeerID: "node-b",
|
||||
Endpoint: endpoint,
|
||||
TLSConfig: &tls.Config{
|
||||
InsecureSkipVerify: true,
|
||||
@@ -198,7 +203,7 @@ func smokeQUICFabricSession(ctx context.Context) (bool, string, error) {
|
||||
ErrorBuffer: 4,
|
||||
})
|
||||
if err != nil {
|
||||
return false, endpoint, err
|
||||
return false, endpoint, 0, err
|
||||
}
|
||||
defer session.Close()
|
||||
if err := session.Send(ctx, fabricproto.Frame{
|
||||
@@ -206,20 +211,21 @@ func smokeQUICFabricSession(ctx context.Context) (bool, string, error) {
|
||||
Sequence: uint64(time.Now().UnixNano()),
|
||||
Payload: []byte("mesh-live-smoke-quic"),
|
||||
}); err != nil {
|
||||
return false, endpoint, err
|
||||
return false, endpoint, 0, err
|
||||
}
|
||||
timer := time.NewTimer(3 * time.Second)
|
||||
defer timer.Stop()
|
||||
for {
|
||||
select {
|
||||
case frame := <-session.Frames():
|
||||
return frame.Type == fabricproto.FramePong && string(frame.Payload) == "mesh-live-smoke-quic", endpoint, nil
|
||||
snapshot := transport.Snapshot()
|
||||
return frame.Type == fabricproto.FramePong && string(frame.Payload) == "mesh-live-smoke-quic", endpoint, snapshot.CapacityPressurePercent, nil
|
||||
case err := <-session.Errors():
|
||||
return false, endpoint, err
|
||||
return false, endpoint, 0, err
|
||||
case <-timer.C:
|
||||
return false, endpoint, fmt.Errorf("timed out waiting for quic pong")
|
||||
return false, endpoint, 0, fmt.Errorf("timed out waiting for quic pong")
|
||||
case <-ctx.Done():
|
||||
return false, endpoint, ctx.Err()
|
||||
return false, endpoint, 0, ctx.Err()
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user