Skip to content

Commit af75ba1

Browse files
authored
SSH: update port range for VS Code settings (#4635)
## Changes 4000-4005 ports aren't ready yet, and the deployments are slow ## Why <!-- Why are these changes needed? Provide the context that the reviewer might be missing. For example, were there any decisions behind the change that are not reflected in the code itself? --> ## Tests <!-- How have you tested the changes? --> <!-- If your PR needs to be included in the release notes for next release, add a separate entry in NEXT_CHANGELOG.md as part of your PR. -->
1 parent 06304ac commit af75ba1

File tree

2 files changed

+16
-14
lines changed

2 files changed

+16
-14
lines changed

experimental/ssh/internal/vscode/settings.go

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,9 @@ import (
1616
)
1717

1818
const (
19-
portRange = "4000-4005"
19+
// TODO: change to 4000-4005 when the relevant changes are fully deployed.
20+
// The ports below can also be used by PyTorch, but we have a bigger range available for it.
21+
portRange = "29500-29505"
2022
remotePlatform = "linux"
2123
pythonExtension = "ms-python.python"
2224
jupyterExtension = "ms-toolsai.jupyter"

experimental/ssh/internal/vscode/settings_test.go

Lines changed: 13 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -133,7 +133,7 @@ func TestLoadSettings_Valid(t *testing.T) {
133133
settingsData := `{
134134
"editor.fontSize": 14,
135135
"remote.SSH.serverPickPortsFromRange": {
136-
"test-conn": "4000-4005"
136+
"test-conn": "29500-29505"
137137
}
138138
}`
139139
err := os.WriteFile(settingsPath, []byte(settingsData), 0o600)
@@ -167,7 +167,7 @@ func TestLoadSettings_WithComments(t *testing.T) {
167167
"editor.fontSize": 14,
168168
/* Connection settings */
169169
"remote.SSH.serverPickPortsFromRange": {
170-
"test-conn": "4000-4005" // Port range for SSH
170+
"test-conn": "29500-29505" // Port range for SSH
171171
},
172172
"remote.SSH.remotePlatform": {
173173
"test-conn": "linux", // trailing comma
@@ -183,7 +183,7 @@ func TestLoadSettings_WithComments(t *testing.T) {
183183

184184
val, ok := findString(t, settings, jsonPtr(serverPickPortsKey, "test-conn"))
185185
assert.True(t, ok)
186-
assert.Equal(t, "4000-4005", val)
186+
assert.Equal(t, "29500-29505", val)
187187
}
188188

189189
func TestLoadSettings_NotExists(t *testing.T) {
@@ -197,7 +197,7 @@ func TestLoadSettings_NotExists(t *testing.T) {
197197

198198
func TestValidateSettings_Complete(t *testing.T) {
199199
v := parseTestValue(t, `{
200-
"remote.SSH.serverPickPortsFromRange": {"test-conn": "4000-4005"},
200+
"remote.SSH.serverPickPortsFromRange": {"test-conn": "29500-29505"},
201201
"remote.SSH.remotePlatform": {"test-conn": "linux"},
202202
"remote.SSH.remoteServerListenOnSocket": true,
203203
"remote.SSH.defaultExtensions": ["ms-python.python", "ms-toolsai.jupyter"]
@@ -233,7 +233,7 @@ func TestValidateSettings_IncorrectValues(t *testing.T) {
233233

234234
func TestValidateSettings_DuplicateExtensionsNotReported(t *testing.T) {
235235
v := parseTestValue(t, `{
236-
"remote.SSH.serverPickPortsFromRange": {"test-conn": "4000-4005"},
236+
"remote.SSH.serverPickPortsFromRange": {"test-conn": "29500-29505"},
237237
"remote.SSH.remotePlatform": {"test-conn": "linux"},
238238
"remote.SSH.remoteServerListenOnSocket": true,
239239
"remote.SSH.defaultExtensions": ["ms-python.python", "ms-python.python", "ms-toolsai.jupyter"]
@@ -245,7 +245,7 @@ func TestValidateSettings_DuplicateExtensionsNotReported(t *testing.T) {
245245

246246
func TestValidateSettings_MissingConnection(t *testing.T) {
247247
v := parseTestValue(t, `{
248-
"remote.SSH.serverPickPortsFromRange": {"other-conn": "4000-4005"},
248+
"remote.SSH.serverPickPortsFromRange": {"other-conn": "29500-29505"},
249249
"remote.SSH.remotePlatform": {"other-conn": "linux"},
250250
"remote.SSH.defaultExtensions": ["ms-python.python", "ms-toolsai.jupyter"]
251251
}`)
@@ -283,7 +283,7 @@ func TestUpdateSettings_PreserveExistingConnections(t *testing.T) {
283283
// Check that new connection was added
284284
val, ok := findString(t, v, jsonPtr(serverPickPortsKey, "conn-c"))
285285
assert.True(t, ok)
286-
assert.Equal(t, "4000-4005", val)
286+
assert.Equal(t, "29500-29505", val)
287287

288288
val, ok = findString(t, v, jsonPtr(remotePlatformKey, "conn-c"))
289289
assert.True(t, ok)
@@ -328,7 +328,7 @@ func TestUpdateSettings_NewConnection(t *testing.T) {
328328

329329
val, ok := findString(t, v, jsonPtr(serverPickPortsKey, "new-conn"))
330330
assert.True(t, ok)
331-
assert.Equal(t, "4000-4005", val)
331+
assert.Equal(t, "29500-29505", val)
332332

333333
val, ok = findString(t, v, jsonPtr(remotePlatformKey, "new-conn"))
334334
assert.True(t, ok)
@@ -394,7 +394,7 @@ func TestUpdateSettings_MergeExtensions(t *testing.T) {
394394

395395
func TestUpdateSettings_PartialUpdate(t *testing.T) {
396396
v := parseTestValue(t, `{
397-
"remote.SSH.serverPickPortsFromRange": {"test-conn": "4000-4005"},
397+
"remote.SSH.serverPickPortsFromRange": {"test-conn": "29500-29505"},
398398
"remote.SSH.remotePlatform": {"other-conn": "linux"},
399399
"remote.SSH.defaultExtensions": ["ms-python.python", "ms-toolsai.jupyter"]
400400
}`)
@@ -411,7 +411,7 @@ func TestUpdateSettings_PartialUpdate(t *testing.T) {
411411
// Port range should not be modified
412412
val, ok := findString(t, v, jsonPtr(serverPickPortsKey, "test-conn"))
413413
assert.True(t, ok)
414-
assert.Equal(t, "4000-4005", val)
414+
assert.Equal(t, "29500-29505", val)
415415

416416
// Platform should be added for test-conn
417417
val, ok = findString(t, v, jsonPtr(remotePlatformKey, "test-conn"))
@@ -473,7 +473,7 @@ func TestSaveSettings_Formatting(t *testing.T) {
473473
settingsPath := filepath.Join(tmpDir, "settings.json")
474474

475475
v := parseTestValue(t, `{
476-
"remote.SSH.serverPickPortsFromRange": {"test-conn": "4000-4005"},
476+
"remote.SSH.serverPickPortsFromRange": {"test-conn": "29500-29505"},
477477
"editor.fontSize": 14
478478
}`)
479479

@@ -541,7 +541,7 @@ func TestGetManualInstructions_VSCode(t *testing.T) {
541541

542542
assert.Contains(t, instructions, "VS Code")
543543
assert.Contains(t, instructions, "test-conn")
544-
assert.Contains(t, instructions, "4000-4005")
544+
assert.Contains(t, instructions, "29500-29505")
545545
assert.Contains(t, instructions, "linux")
546546
assert.Contains(t, instructions, "ms-python.python")
547547
assert.Contains(t, instructions, "ms-toolsai.jupyter")
@@ -555,7 +555,7 @@ func TestGetManualInstructions_Cursor(t *testing.T) {
555555

556556
assert.Contains(t, instructions, "Cursor")
557557
assert.Contains(t, instructions, "my-connection")
558-
assert.Contains(t, instructions, "4000-4005")
558+
assert.Contains(t, instructions, "29500-29505")
559559
assert.Contains(t, instructions, "linux")
560560
assert.Contains(t, instructions, "ms-python.python")
561561
assert.Contains(t, instructions, "ms-toolsai.jupyter")

0 commit comments

Comments
 (0)