@@ -19,16 +19,16 @@ func TestGetPortForwardArgs(t *testing.T) {
19
19
args : struct { ports string }{ports : "3000" },
20
20
want : []string {"0.0.0.0:3000:localhost:3000" },
21
21
wantErr : false },
22
- {name : "<vm port>:<local port>" ,
23
- args : struct { ports string }{ports : "3000: 4000" },
22
+ {name : "<local port>:<vm port>" ,
23
+ args : struct { ports string }{ports : "4000:3000 " },
24
24
want : []string {"0.0.0.0:4000:localhost:3000" },
25
25
wantErr : false },
26
- {name : "<vm port>:<local port> <vmport>" ,
27
- args : struct { ports string }{ports : "3000: 4000 8080" },
26
+ {name : "<local port>:<vm port> <vmport>" ,
27
+ args : struct { ports string }{ports : "4000:3000 8080" },
28
28
want : []string {"0.0.0.0:4000:localhost:3000" , "0.0.0.0:8080:localhost:8080" },
29
29
wantErr : false },
30
- {name : "<vmport> <vm port>:<local port>" ,
31
- args : struct { ports string }{ports : "8080 3000: 4000" },
30
+ {name : "<vmport> <local port>:<vm port>" ,
31
+ args : struct { ports string }{ports : "8080 4000:3000 " },
32
32
want : []string {"0.0.0.0:8080:localhost:8080" , "0.0.0.0:4000:localhost:3000" },
33
33
wantErr : false },
34
34
{name : "<vmport> <vm port> <vm port>" ,
@@ -39,16 +39,16 @@ func TestGetPortForwardArgs(t *testing.T) {
39
39
args : struct { ports string }{ports : "3000 4000-4001" },
40
40
want : []string {"0.0.0.0:3000:localhost:3000" , "0.0.0.0:4000:localhost:4000" , "0.0.0.0:4001:localhost:4001" },
41
41
wantErr : false },
42
- {name : "<vm port1>-<vm port2>:<local port1>-<local port2>" ,
43
- args : struct { ports string }{ports : "4000-4001: 8080-8081" },
42
+ {name : "<local port1>-<local port2>:<vm port1>-<vm port2>" ,
43
+ args : struct { ports string }{ports : "8080-8081:4000-4001 " },
44
44
want : []string {"0.0.0.0:8080:localhost:4000" , "0.0.0.0:8081:localhost:4001" },
45
45
wantErr : false },
46
- {name : "<vm port1>-<vm port2>:<local port1>-<local port2> <vmport>" ,
47
- args : struct { ports string }{ports : "4000-4001: 8080-8081 9000" },
46
+ {name : "<local port1>-<local port2>:<vm port1>-<vm port2> <vmport>" ,
47
+ args : struct { ports string }{ports : "8080-8081:4000-4001 9000" },
48
48
want : []string {"0.0.0.0:8080:localhost:4000" , "0.0.0.0:8081:localhost:4001" , "0.0.0.0:9000:localhost:9000" },
49
49
wantErr : false },
50
- {name : "invalid <vm port1>-<vm port2>:<local port1>-<local port2>" ,
51
- args : struct { ports string }{ports : "4000-4001: 8080-8082" },
50
+ {name : "invalid <local port1>-<local port2>:<vm port1>-<vm port2>" ,
51
+ args : struct { ports string }{ports : "8080-8082:4000-4001 " },
52
52
want : nil ,
53
53
wantErr : true },
54
54
}
0 commit comments