mirror of https://github.com/k3s-io/k3s
![]() TestPortForward was failing occasionally due to the way the test was written. It created a port forwarding session, then connected a client to the local port, attempted to send some data, attempted to receive some data, and then tore down the port forwarding session. Unfortunately, some times the attempt to send data from the client to the remote would be enqueued but not processed by the time the test tore down everything. As a result, the data stream could get closed before the client's data was transmitted to the server. If this happened, you'd see an error such as 'forward 2 ports with bidirectional data: server expected to receive "ghij", got "" for port 6000'. This fixes the test by serializing the data flow: the client writes to the remote, the remote waits to receive that data, the remote writes to the client, and the client waits to receive the data from the remote. This all takes place prior to the test tearing down port forwarding. |
||
---|---|---|
.. | ||
doc.go | ||
portforward.go | ||
portforward_test.go |