Skip to content

Commit 08789a6

Browse files
paddybyersclaude
andcommitted
Delegate proxy port assignment to uts-proxy in all test specs
Remove client-side allocated_port/port_base patterns from all proxy test specs and helper docs. Port is now auto-assigned by the proxy when omitted from create_proxy_session(). Matches uts-proxy v0.2.0. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
1 parent 1f11dff commit 08789a6

11 files changed

Lines changed: 42 additions & 78 deletions

File tree

uts/docs/integration-testing.md

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -157,7 +157,6 @@ Proxy tests additionally set up a proxy session per test or group of tests. See
157157
BEFORE EACH TEST:
158158
session = create_proxy_session(
159159
endpoint: "nonprod:sandbox",
160-
port: allocated_port,
161160
rules: [ ...initial rules... ]
162161
)
163162

uts/docs/writing-test-specs.md

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -344,7 +344,6 @@ Tests that [behaviour] when the proxy injects [fault].
344344
```pseudo
345345
session = create_proxy_session(
346346
target: TargetConfig(realtimeHost: "sandbox.realtime.ably-nonprod.net", restHost: "sandbox.realtime.ably-nonprod.net"),
347-
port: allocated_port,
348347
rules: [{
349348
"match": { ... },
350349
"action": { ... },

uts/objects/integration/proxy/objects_faults.md

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -80,7 +80,7 @@ channel_name = "objects-sync-interrupt-" + random_id()
8080
// Disconnect after first OBJECT_SYNC frame
8181
session = create_proxy_session(
8282
endpoint: "nonprod:sandbox",
83-
port: allocated_port,
83+
8484
rules: [{
8585
"match": { "type": "ws_frame_to_client", "action": 20 },
8686
"action": { "type": "disconnect" },
@@ -163,7 +163,7 @@ AWAIT root_a.set("key1", "initial")
163163
// Client B: through proxy, will be disconnected
164164
session = create_proxy_session(
165165
endpoint: "nonprod:sandbox",
166-
port: allocated_port,
166+
167167
rules: []
168168
)
169169
@@ -242,7 +242,7 @@ channel_name = "objects-detach-resync-" + random_id()
242242
243243
session = create_proxy_session(
244244
endpoint: "nonprod:sandbox",
245-
port: allocated_port,
245+
246246
rules: []
247247
)
248248
@@ -318,7 +318,7 @@ channel_name = "objects-publish-failed-" + random_id()
318318
319319
session = create_proxy_session(
320320
endpoint: "nonprod:sandbox",
321-
port: allocated_port,
321+
322322
rules: []
323323
)
324324
@@ -403,7 +403,7 @@ AWAIT root_a.set("existing", "before")
403403
// Client B: through proxy with delayed OBJECT_SYNC
404404
session = create_proxy_session(
405405
endpoint: "nonprod:sandbox",
406-
port: allocated_port,
406+
407407
rules: [{
408408
"match": { "type": "ws_frame_to_client", "action": 20 },
409409
"action": { "type": "delay", "delayMs": 3000 },

uts/realtime/integration/helpers/proxy.md

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,6 @@ Proxy integration tests use this to verify fault-handling behaviour against the
2020
# 1. Create a proxy session with rules
2121
session = create_proxy_session(
2222
endpoint: "nonprod:sandbox",
23-
port: allocated_port,
2423
rules: [ ...rules... ]
2524
)
2625
@@ -58,7 +57,7 @@ session.close()
5857
interface ProxySession:
5958
session_id: String
6059
proxy_host: String # Always "localhost"
61-
proxy_port: Int # Assigned from port pool
60+
proxy_port: Int # Auto-assigned by proxy, or explicit if specified
6261
6362
add_rules(rules: List<Rule>, position?: "append"|"prepend")
6463
trigger_action(action: ActionRequest)
@@ -67,7 +66,7 @@ interface ProxySession:
6766
6867
function create_proxy_session(
6968
endpoint: String, # e.g. "nonprod:sandbox" → resolves to sandbox.realtime.ably-nonprod.net
70-
port: Int,
69+
port?: Int, # Optional; proxy auto-assigns a free port if omitted
7170
rules?: List<Rule>,
7271
timeoutMs?: Int # Session auto-cleanup timeout (default 30000)
7372
): ProxySession

uts/realtime/integration/proxy/auth_reauth.md

Lines changed: 1 addition & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -31,16 +31,6 @@ AFTER ALL TESTS:
3131
WITH Authorization: Basic {api_key}
3232
```
3333

34-
## Port Allocation
35-
36-
Each test allocates a unique proxy port to avoid conflicts:
37-
38-
```pseudo
39-
BEFORE ALL TESTS:
40-
port_base = allocate_port_range(count: 1)
41-
# Tests use port_base + 0
42-
```
43-
4434
---
4535

4636
## Test 26: RTN22/RTC8a -- Server-initiated re-authentication
@@ -63,7 +53,6 @@ Tests that when the proxy injects a server-initiated AUTH ProtocolMessage (actio
6353
```pseudo
6454
session = create_proxy_session(
6555
endpoint: "nonprod:sandbox",
66-
port: port_base + 0,
6756
rules: []
6857
)
6958
```
@@ -83,7 +72,7 @@ auth_callback = FUNCTION(params, callback):
8372
client = Realtime(options: ClientOptions(
8473
authCallback: auth_callback,
8574
endpoint: "localhost",
86-
port: port_base + 0,
75+
port: session.proxy_port,
8776
tls: false,
8877
useBinaryProtocol: false,
8978
autoConnect: false

uts/realtime/integration/proxy/channel_faults.md

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -71,7 +71,7 @@ channel_name = "test-RTL4f-${random_id()}"
7171
# Create proxy session that suppresses ATTACH messages for our channel
7272
session = create_proxy_session(
7373
endpoint: "nonprod:sandbox",
74-
port: allocated_port,
74+
7575
rules: [{
7676
"match": { "type": "ws_frame_to_server", "action": "ATTACH", "channel": channel_name },
7777
"action": { "type": "suppress" },
@@ -177,7 +177,7 @@ channel_name = "test-RTL14-error-on-attach-${random_id()}"
177177
# Create proxy session that replaces ATTACHED with channel ERROR
178178
session = create_proxy_session(
179179
endpoint: "nonprod:sandbox",
180-
port: allocated_port,
180+
181181
rules: [{
182182
"match": { "type": "ws_frame_to_client", "action": "ATTACHED", "channel": channel_name },
183183
"action": {
@@ -274,7 +274,7 @@ channel_name = "test-RTL5f-${random_id()}"
274274
# Phase 1: Create proxy session with NO fault rules (clean passthrough)
275275
session = create_proxy_session(
276276
endpoint: "nonprod:sandbox",
277-
port: allocated_port,
277+
278278
rules: []
279279
)
280280
@@ -374,7 +374,7 @@ channel_name = "test-RTL13a-${random_id()}"
374374
# Create proxy session with clean passthrough (no fault rules initially)
375375
session = create_proxy_session(
376376
endpoint: "nonprod:sandbox",
377-
port: allocated_port,
377+
378378
rules: []
379379
)
380380
@@ -471,7 +471,7 @@ channel_name = "test-RTL14-${random_id()}"
471471
# Create proxy session with clean passthrough
472472
session = create_proxy_session(
473473
endpoint: "nonprod:sandbox",
474-
port: allocated_port,
474+
475475
rules: []
476476
)
477477
@@ -563,7 +563,7 @@ channel_name = "test-RTL12-${random_id()}"
563563
# Create proxy session with clean passthrough
564564
session = create_proxy_session(
565565
endpoint: "nonprod:sandbox",
566-
port: allocated_port,
566+
567567
rules: []
568568
)
569569
@@ -666,7 +666,7 @@ channel_b_name = "test-RTL3d-b-${random_id()}"
666666
# Create proxy session with clean passthrough
667667
session = create_proxy_session(
668668
endpoint: "nonprod:sandbox",
669-
port: allocated_port,
669+
670670
rules: []
671671
)
672672

uts/realtime/integration/proxy/connection_open_failures.md

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -66,7 +66,7 @@ Tests that when the server responds with a fatal ERROR (non-token error code) du
6666
# Create proxy session that replaces the first CONNECTED with a fatal ERROR
6767
session = create_proxy_session(
6868
endpoint: "nonprod:sandbox",
69-
port: allocated_port,
69+
7070
rules: [{
7171
"match": { "type": "ws_frame_to_client", "action": "CONNECTED" },
7272
"action": {
@@ -151,7 +151,7 @@ auth_callback_count = 0
151151
# Create proxy session that injects token error on first CONNECTED only
152152
session = create_proxy_session(
153153
endpoint: "nonprod:sandbox",
154-
port: allocated_port,
154+
155155
rules: [{
156156
"match": { "type": "ws_frame_to_client", "action": "CONNECTED" },
157157
"action": {
@@ -246,7 +246,7 @@ Tests that when the first WebSocket connection is refused at the transport level
246246
# Create proxy session that refuses the first WebSocket connection
247247
session = create_proxy_session(
248248
endpoint: "nonprod:sandbox",
249-
port: allocated_port,
249+
250250
rules: [{
251251
"match": { "type": "ws_connect", "count": 1 },
252252
"action": { "type": "refuse_connection" },
@@ -325,7 +325,7 @@ Tests that when the server responds with a connection-level ERROR (no channel fi
325325
# Create proxy session that replaces the first CONNECTED with a server ERROR
326326
session = create_proxy_session(
327327
endpoint: "nonprod:sandbox",
328-
port: allocated_port,
328+
329329
rules: [{
330330
"match": { "type": "ws_frame_to_client", "action": "CONNECTED" },
331331
"action": {
@@ -408,7 +408,7 @@ Tests that when the server accepts the WebSocket but never sends a CONNECTED mes
408408
# Create proxy session that suppresses all CONNECTED messages
409409
session = create_proxy_session(
410410
endpoint: "nonprod:sandbox",
411-
port: allocated_port,
411+
412412
rules: [{
413413
"match": { "type": "ws_frame_to_client", "action": "CONNECTED" },
414414
"action": { "type": "suppress" },

0 commit comments

Comments
 (0)