const remotePort … func TestPortforward(t *testing.T) { … } // parsePort parses out the local port from the port-forward output string. // This should work for both IP4 and IP6 addresses. // // Example: "Forwarding from 127.0.0.1:8000 -> 4000", returns "8000". func parsePort(forwardAddr string) (string, error) { … } type dummyPortForwarder … func (d *dummyPortForwarder) PortForward(ctx context.Context, name string, uid types.UID, port int32, stream io.ReadWriteCloser) error { … } type mBuffer … func (s *mBuffer) Write(p []byte) (n int, err error) { … } func (s *mBuffer) String() string { … }