Add persistent fabric session client
This commit is contained in:
@@ -22,19 +22,20 @@ type smokeNode struct {
|
||||
}
|
||||
|
||||
type smokeReport struct {
|
||||
Stage string `json:"stage"`
|
||||
ProductionForwarding bool `json:"production_forwarding"`
|
||||
ScopedConfigLoaded bool `json:"scoped_config_loaded"`
|
||||
DirectProbeAccepted bool `json:"direct_probe_accepted"`
|
||||
DirectPath []string `json:"direct_path"`
|
||||
RelayProbeAccepted bool `json:"relay_probe_accepted"`
|
||||
RelayPath []string `json:"relay_path"`
|
||||
TestServiceAccepted bool `json:"test_service_accepted"`
|
||||
TestServiceEchoPayload string `json:"test_service_echo_payload"`
|
||||
FabricSessionAccepted bool `json:"fabric_session_accepted"`
|
||||
FabricSessionLatencyMS int64 `json:"fabric_session_latency_ms"`
|
||||
FabricSessionEndpoint string `json:"fabric_session_endpoint"`
|
||||
PeerEndpoints map[string]any `json:"peer_endpoints"`
|
||||
Stage string `json:"stage"`
|
||||
ProductionForwarding bool `json:"production_forwarding"`
|
||||
ScopedConfigLoaded bool `json:"scoped_config_loaded"`
|
||||
DirectProbeAccepted bool `json:"direct_probe_accepted"`
|
||||
DirectPath []string `json:"direct_path"`
|
||||
RelayProbeAccepted bool `json:"relay_probe_accepted"`
|
||||
RelayPath []string `json:"relay_path"`
|
||||
TestServiceAccepted bool `json:"test_service_accepted"`
|
||||
TestServiceEchoPayload string `json:"test_service_echo_payload"`
|
||||
FabricSessionAccepted bool `json:"fabric_session_accepted"`
|
||||
FabricSessionRoundTrips int `json:"fabric_session_round_trips"`
|
||||
FabricSessionLatencyMS int64 `json:"fabric_session_latency_ms"`
|
||||
FabricSessionEndpoint string `json:"fabric_session_endpoint"`
|
||||
PeerEndpoints map[string]any `json:"peer_endpoints"`
|
||||
}
|
||||
|
||||
func main() {
|
||||
@@ -99,32 +100,50 @@ func run(ctx context.Context) (smokeReport, error) {
|
||||
return smokeReport{}, fmt.Errorf("test service: %w", err)
|
||||
}
|
||||
fabricSessionStartedAt := time.Now()
|
||||
fabricSessionResponse, err := mesh.NewClient(nodeB.URL).SendFabricSessionFrame(ctx, mesh.FabricSessionDialOptions{
|
||||
fabricSession, _, err := mesh.NewClient(nodeB.URL).OpenFabricSession(ctx, mesh.FabricSessionDialOptions{
|
||||
Token: "rap_fsn_mesh_live_smoke",
|
||||
Timeout: 3 * time.Second,
|
||||
}, fabricproto.Frame{
|
||||
})
|
||||
if err != nil {
|
||||
return smokeReport{}, fmt.Errorf("fabric session open: %w", err)
|
||||
}
|
||||
defer fabricSession.Close()
|
||||
firstFabricSessionResponse, err := fabricSession.RoundTrip(ctx, fabricproto.Frame{
|
||||
Type: fabricproto.FramePing,
|
||||
Sequence: uint64(fabricSessionStartedAt.UnixNano()),
|
||||
Payload: []byte("mesh-live-smoke-fabric-session"),
|
||||
})
|
||||
if err != nil {
|
||||
return smokeReport{}, fmt.Errorf("fabric session smoke: %w", err)
|
||||
return smokeReport{}, fmt.Errorf("fabric session first round trip: %w", err)
|
||||
}
|
||||
secondFabricSessionResponse, err := fabricSession.RoundTrip(ctx, fabricproto.Frame{
|
||||
Type: fabricproto.FramePing,
|
||||
Sequence: uint64(fabricSessionStartedAt.UnixNano()) + 1,
|
||||
Payload: []byte("mesh-live-smoke-fabric-session-2"),
|
||||
})
|
||||
if err != nil {
|
||||
return smokeReport{}, fmt.Errorf("fabric session second round trip: %w", err)
|
||||
}
|
||||
fabricSessionLatency := time.Since(fabricSessionStartedAt)
|
||||
fabricSessionAccepted := firstFabricSessionResponse.Type == fabricproto.FramePong &&
|
||||
string(firstFabricSessionResponse.Payload) == "mesh-live-smoke-fabric-session" &&
|
||||
secondFabricSessionResponse.Type == fabricproto.FramePong &&
|
||||
string(secondFabricSessionResponse.Payload) == "mesh-live-smoke-fabric-session-2"
|
||||
|
||||
return smokeReport{
|
||||
Stage: "C17F scoped synthetic config plus live HTTP transport",
|
||||
ProductionForwarding: false,
|
||||
ScopedConfigLoaded: nodeAConfig.ConfigVersion == "smoke-config-v1",
|
||||
DirectProbeAccepted: directAck.MessageType == mesh.SyntheticMessageProbeAck,
|
||||
DirectPath: decodeProbePath(directAck),
|
||||
RelayProbeAccepted: relayAck.MessageType == mesh.SyntheticMessageProbeAck,
|
||||
RelayPath: decodeProbePath(relayAck),
|
||||
TestServiceAccepted: testService.Ack.MessageType == mesh.SyntheticMessageTestServiceAck,
|
||||
TestServiceEchoPayload: testService.Response.EchoPayload,
|
||||
FabricSessionAccepted: fabricSessionResponse.Type == fabricproto.FramePong && string(fabricSessionResponse.Payload) == "mesh-live-smoke-fabric-session",
|
||||
FabricSessionLatencyMS: fabricSessionLatency.Milliseconds(),
|
||||
FabricSessionEndpoint: nodeB.URL + "/mesh/v1/fabric/session/ws",
|
||||
Stage: "C17F scoped synthetic config plus live HTTP transport",
|
||||
ProductionForwarding: false,
|
||||
ScopedConfigLoaded: nodeAConfig.ConfigVersion == "smoke-config-v1",
|
||||
DirectProbeAccepted: directAck.MessageType == mesh.SyntheticMessageProbeAck,
|
||||
DirectPath: decodeProbePath(directAck),
|
||||
RelayProbeAccepted: relayAck.MessageType == mesh.SyntheticMessageProbeAck,
|
||||
RelayPath: decodeProbePath(relayAck),
|
||||
TestServiceAccepted: testService.Ack.MessageType == mesh.SyntheticMessageTestServiceAck,
|
||||
TestServiceEchoPayload: testService.Response.EchoPayload,
|
||||
FabricSessionAccepted: fabricSessionAccepted,
|
||||
FabricSessionRoundTrips: 2,
|
||||
FabricSessionLatencyMS: fabricSessionLatency.Milliseconds(),
|
||||
FabricSessionEndpoint: nodeB.URL + "/mesh/v1/fabric/session/ws",
|
||||
PeerEndpoints: map[string]any{
|
||||
"node-a": nodeA.URL,
|
||||
"node-r": nodeR.URL,
|
||||
|
||||
Reference in New Issue
Block a user