Conversation
|
Gentle nudge on this @jasongin |
|
@williammartin Thanks for the PR, sorry I missed it before.
Please do update the tests. To get a token, login with the CLI with verbose option: Your
Yes this is necessary. Please bump the package version, similar to how it was done in #447 I would do it, but I can't push to your fork, so I'd have to make a new PR. |
jasongin
left a comment
There was a problem hiding this comment.
Please update the tests to verify the fixed port number, and bump the go package version.
|
Hey @williammartin have you had a chance to look at this? We are also hitting issues with some of our tooling that would be fixed with this change 🙏 |
In a for loop, a new address is created for the loopvar. Appending the pointer of the loopvar to a slice means that every element in the slice will point to the last element ranged over.
a7900a1 to
31517c0
Compare
|
@microsoft-github-policy-service agree company="GitHub" |
|
Sorry folks, y'all responded right after I went on vacation. I believe I have addressed the outstanding concerns. Failure➜ dev-tunnels git:(wm/fix-list-tunnel-ports-go) ✗ go test -v ./go/tunnels -run TestTunnelListPorts
=== RUN TestTunnelListPorts
2025/08/25 16:22:36 Created tunnel with id spiffy-river-clgktcs
Tunnel Properties
ClusterId euw
TunnelId spiffy-river-clgktcs
Name
Description
Labels []
Access Control {[]}
Ports
Host Connections <nil>
Client Connections <nil>
Available Scopes
2025/08/25 16:22:36 Created port: 3000
TunnelPort Properties
ClusterId euw
TunnelId spiffy-river-clgktcs
PortNumber 3000
Protocol auto
Access Control {[]}
Client Connections &{0 1000 {0 0 {}}}
Last Connection Time <nil>
2025/08/25 16:22:37 Created port: 3001
TunnelPort Properties
ClusterId euw
TunnelId spiffy-river-clgktcs
PortNumber 3001
Protocol auto
Access Control {[]}
Client Connections &{0 1000 {0 0 {}}}
Last Connection Time <nil>
manager_test.go:658: port 3000 not successfully listed
2025/08/25 16:22:37 Port: 3001
TunnelPort Properties
ClusterId euw
TunnelId spiffy-river-clgktcs
PortNumber 3001
Protocol auto
Access Control {[]}
Client Connections <nil>
Last Connection Time <nil>
2025/08/25 16:22:37 Port: 3001
TunnelPort Properties
ClusterId euw
TunnelId spiffy-river-clgktcs
PortNumber 3001
Protocol auto
Access Control {[]}
Client Connections <nil>
Last Connection Time <nil>
2025/08/25 16:22:38 Got tunnel with id spiffy-river-clgktcs
Tunnel Properties
ClusterId euw
TunnelId spiffy-river-clgktcs
Name
Description
Labels []
Access Control {[]}
Ports 3000 - auto, 3001 - auto
Host Connections <nil>
Client Connections &{0 20 {0 0 {}}}
Available Scopes
2025/08/25 16:22:38 Deleted tunnel with id spiffy-river-clgktcs
--- FAIL: TestTunnelListPorts (4.79s)
FAIL
FAIL github.com/microsoft/dev-tunnels/go/tunnels 8.319s
FAILSuccess➜ dev-tunnels git:(wm/fix-list-tunnel-ports-go) ✗ go test -v ./go/tunnels -run TestTunnelListPorts
=== RUN TestTunnelListPorts
2025/08/25 16:23:35 Created tunnel with id giant-pond-td1trtw
Tunnel Properties
ClusterId euw
TunnelId giant-pond-td1trtw
Name
Description
Labels []
Access Control {[]}
Ports
Host Connections <nil>
Client Connections <nil>
Available Scopes
2025/08/25 16:23:37 Created port: 3000
TunnelPort Properties
ClusterId euw
TunnelId giant-pond-td1trtw
PortNumber 3000
Protocol auto
Access Control {[]}
Client Connections &{0 1000 {0 0 {}}}
Last Connection Time <nil>
2025/08/25 16:23:37 Created port: 3001
TunnelPort Properties
ClusterId euw
TunnelId giant-pond-td1trtw
PortNumber 3001
Protocol auto
Access Control {[]}
Client Connections &{0 1000 {0 0 {}}}
Last Connection Time <nil>
2025/08/25 16:23:38 Port: 3000
TunnelPort Properties
ClusterId euw
TunnelId giant-pond-td1trtw
PortNumber 3000
Protocol auto
Access Control {[]}
Client Connections <nil>
Last Connection Time <nil>
2025/08/25 16:23:38 Port: 3001
TunnelPort Properties
ClusterId euw
TunnelId giant-pond-td1trtw
PortNumber 3001
Protocol auto
Access Control {[]}
Client Connections <nil>
Last Connection Time <nil>
2025/08/25 16:23:38 Got tunnel with id giant-pond-td1trtw
Tunnel Properties
ClusterId euw
TunnelId giant-pond-td1trtw
Name
Description
Labels []
Access Control {[]}
Ports 3000 - auto, 3001 - auto
Host Connections <nil>
Client Connections &{0 20 {0 0 {}}}
Available Scopes
2025/08/25 16:23:39 Deleted tunnel with id giant-pond-td1trtw
--- PASS: TestTunnelListPorts (6.80s)
PASS
ok github.com/microsoft/dev-tunnels/go/tunnels 12.425s |
Description
Hey folks, while debugging
gh cs sshI noticed thatListTunnelPortswas returning the same port in every element of the slice. In a for loop, a new address is created for the loopvar. Appending the pointer of the loopvar to a slice means that every element in the slice will point to the last element ranged over.TestTunnelListPortsinmanager_test.goonly checks that 2 ports were returning and doesn't interrogate the actual values, which is why this didn't fail. I would have updated the test but I didn't really want to figure out how to run them since they require a token.I have no idea whether the tasks below are required for this change.
Other Tasks:
npm view @microsoft/dev-tunnels-contracts). This will fix issues where yarn will pull the old version of packages and will cause mismatched dependencies. See example PR