From 41966273dbd0ce345451d2c7f0771ec357a8ada1 Mon Sep 17 00:00:00 2001 From: Spike Curtis Date: Wed, 25 Jun 2025 07:04:27 +0000 Subject: [PATCH] chore: test eviction with used ports --- agent/agentssh/x11_test.go | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/agent/agentssh/x11_test.go b/agent/agentssh/x11_test.go index c8e3dd45c1db5..4946fa2ac03c7 100644 --- a/agent/agentssh/x11_test.go +++ b/agent/agentssh/x11_test.go @@ -162,10 +162,17 @@ func TestServer_X11_EvictionLRU(t *testing.T) { c := sshClient(t, ln.Addr().String()) + // block off one port to test x11Forwarder evicts at highest port, not number of listeners. + externalListener, err := inproc.Listen("tcp", + fmt.Sprintf("localhost:%d", agentssh.X11StartPort+agentssh.X11DefaultDisplayOffset+1)) + require.NoError(t, err) + defer externalListener.Close() + // Calculate how many simultaneous X11 sessions we can create given the // configured port range. + startPort := agentssh.X11StartPort + agentssh.X11DefaultDisplayOffset - maxSessions := agentssh.X11MaxPort - startPort + 1 + maxSessions := agentssh.X11MaxPort - startPort + 1 - 1 // -1 for the blocked port require.Greater(t, maxSessions, 0, "expected a positive maxSessions value") // shellSession holds references to the session and its standard streams so pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy