mirror of
https://github.com/kubernetes/client-go.git
synced 2025-09-12 13:25:29 +00:00
export a method to expose which ports were forwarded
Without this change, the only method to discover what local port was bound (if port 0 was requested) is to parse it out of the "out" stream, which isn't the most reliable method. Kubernetes-commit: a9084923f2bd499c287b675007cb7c6c093d60ad
This commit is contained in:
committed by
Kubernetes Publisher
parent
93821fae80
commit
e1ca545b2c
@@ -99,8 +99,17 @@ func TestParsePortsAndNew(t *testing.T) {
|
||||
if dialer.dialed {
|
||||
t.Fatalf("%d: expected not dialed", i)
|
||||
}
|
||||
if e, a := test.expected, pf.ports; !reflect.DeepEqual(e, a) {
|
||||
t.Fatalf("%d: ports: expected %#v, got %#v", i, e, a)
|
||||
if _, portErr := pf.GetPorts(); portErr == nil {
|
||||
t.Fatalf("%d: GetPorts: error expected but got nil", i)
|
||||
}
|
||||
|
||||
// mock-signal the Ready channel
|
||||
close(readyChan)
|
||||
|
||||
if ports, portErr := pf.GetPorts(); portErr != nil {
|
||||
t.Fatalf("%d: GetPorts: unable to retrieve ports: %s", i, portErr)
|
||||
} else if !reflect.DeepEqual(test.expected, ports) {
|
||||
t.Fatalf("%d: ports: expected %#v, got %#v", i, test.expected, ports)
|
||||
}
|
||||
if e, a := expectedStopChan, pf.stopChan; e != a {
|
||||
t.Fatalf("%d: stopChan: expected %#v, got %#v", i, e, a)
|
||||
|
Reference in New Issue
Block a user