- Register t.Cleanup to close the server-side *websocket.Conn from
serverChan, preventing resource leaks after the test finishes.
- Use bytes.Equal to assert the exact forwarded payload instead of
only checking consumer.Len() > 0.
Signed-off-by: Priyanshu Bharti <priyanshubharti.stm@gmail.com>
Signed-off-by: Priyanshubhartistm <bhartipriyanshustm@gmail.com>
wsTestPair wrote to the server variable inside the HTTP handler
goroutine and read it from the main goroutine without synchronization,
causing a data race detectable with go test -race.
Replace the shared variable + time.Sleep(50ms) with a buffered channel:
the handler sends the *websocket.Conn into serverChan, and the caller
receives it with a 2-second timeout. This eliminates both the race and
the arbitrary sleep, making the test faster and deterministic.
Signed-off-by: Priyanshubhartistm <bhartipriyanshustm@gmail.com>
handleRawData passed api.ProtocolTypeQuic to lane.NewLane instead of
api.ProtocolTypeWS. NewLane dispatches to NewQuicLane, which asserts
the van to quic.Stream — a type that *websocket.Conn never satisfies.
NewQuicLane logs "oops! bad type of van" and returns nil, causing the
subsequent io.Copy(conn.consumer, nil) to panic with a nil interface
dereference.
Every other call in ws.go correctly uses api.ProtocolTypeWS. This was
almost certainly a copy/paste from the QUIC implementation.
Fix: pass api.ProtocolTypeWS so NewLane builds a WSLane over conn.wsConn.
Add a regression test using an httptest WebSocket pair that verifies
handleRawData does not panic and forwards data to the consumer.
Signed-off-by: Priyanshubhartistm <bhartipriyanshustm@gmail.com>
klog v2 defaults -logtostderr to true, which silently masks the -stderrthreshold flag. klog v2.130.0 introduced the legacy_stderr_threshold_behavior flag (kubernetes/klog#432) so callers can opt into the corrected behavior.
One call site (keadm) already carried the fix; apply the same pattern to the remaining six klog.InitFlags call sites: edgesite-server, edgesite-agent, viaduct/chat, viaduct/mirror, edgecore Windows init, and the mapper-framework template.
After this change every binary that registers klog flags will honor -stderrthreshold regardless of the -logtostderr default.
Ref: kubernetes/klog#212, kubernetes/klog#432
Signed-off-by: Pierluigi Lenoci <pierluigilenoci@gmail.com>
1. Update metaserver to support anonymous authentication for discovery paths (e.g., /api, /apis, /version), aligning with K8s API Server behavior.
2. Implement `AlwaysAllowDiscoveryAuthorizer` to bypass RBAC for non-resource discovery requests.
3. Refactor `pkg/util/pass-through` to centralize discovery path logic and improve path matching.
4. Add comprehensive unit tests for discovery path identification.
Signed-off-by: Abirdcfly <fp544037857@gmail.com>