diff --git a/pkg/cmd/refresh/refresh_test.go b/pkg/cmd/refresh/refresh_test.go index bf13a84ac..7c53b598c 100644 --- a/pkg/cmd/refresh/refresh_test.go +++ b/pkg/cmd/refresh/refresh_test.go @@ -19,8 +19,8 @@ func TestResolveNodeSSHEntry_HappyPath(t *testing.T) { Ports: []*nodev1.Port{ { Protocol: nodev1.PortProtocol_PORT_PROTOCOL_SSH, - PortNumber: 22, - ServerPort: 41920, + PortNumber: 41920, + ServerPort: 22, Hostname: strPtr("10.0.0.5"), }, }, @@ -53,8 +53,8 @@ func TestResolveNodeSSHEntry_UsesServerPortNotPortNumber(t *testing.T) { Ports: []*nodev1.Port{ { Protocol: nodev1.PortProtocol_PORT_PROTOCOL_SSH, - PortNumber: 22, // well-known port — NOT what we should connect to - ServerPort: 51234, // netbird-assigned port — correct + PortNumber: 51234, // netbird-assigned port — correct + ServerPort: 22, // well-known port — NOT what we should connect to Hostname: strPtr("gateway.example.com"), }, }, diff --git a/pkg/cmd/shell/shell_test.go b/pkg/cmd/shell/shell_test.go index 172e3b3c9..991ea9c49 100644 --- a/pkg/cmd/shell/shell_test.go +++ b/pkg/cmd/shell/shell_test.go @@ -22,8 +22,8 @@ func TestResolveExternalNodeSSH_BuildsCorrectInfo(t *testing.T) { Ports: []*nodev1.Port{ { Protocol: nodev1.PortProtocol_PORT_PROTOCOL_SSH, - PortNumber: 22, - ServerPort: 41920, + PortNumber: 41920, + ServerPort: 22, Hostname: strPtr("10.0.0.5"), }, }, diff --git a/pkg/cmd/util/externalnode_test.go b/pkg/cmd/util/externalnode_test.go index c8521b83d..667972d64 100644 --- a/pkg/cmd/util/externalnode_test.go +++ b/pkg/cmd/util/externalnode_test.go @@ -32,7 +32,7 @@ func (m *mockExternalNodeStore) GetCurrentUser() (*entity.User, error) { func strPtr(s string) *string { return &s } -func makeTestNode(name, userID, linuxUser, hostname string, serverPort int32) *nodev1.ExternalNode { +func makeTestNode(name, userID, linuxUser, hostname string, portNumber int32) *nodev1.ExternalNode { return &nodev1.ExternalNode{ ExternalNodeId: "unode_test", Name: name, @@ -42,8 +42,8 @@ func makeTestNode(name, userID, linuxUser, hostname string, serverPort int32) *n Ports: []*nodev1.Port{ { Protocol: nodev1.PortProtocol_PORT_PROTOCOL_SSH, - PortNumber: 22, - ServerPort: serverPort, + PortNumber: portNumber, + ServerPort: 22, Hostname: &hostname, }, }, @@ -83,8 +83,8 @@ func TestResolveExternalNodeSSH_UsesServerPortNotPortNumber(t *testing.T) { Ports: []*nodev1.Port{ { Protocol: nodev1.PortProtocol_PORT_PROTOCOL_SSH, - PortNumber: 22, // well-known port — NOT what we connect to - ServerPort: 41920, // netbird-assigned port — this is correct + PortNumber: 41920, // netbird-assigned port — this is correct + ServerPort: 22, // well-known port — NOT what we connect to Hostname: strPtr("gateway.example.com"), }, },