File tree Expand file tree Collapse file tree 1 file changed +8
-1
lines changed Expand file tree Collapse file tree 1 file changed +8
-1
lines changed Original file line number Diff line number Diff line change @@ -162,10 +162,17 @@ func TestServer_X11_EvictionLRU(t *testing.T) {
162
162
163
163
c := sshClient (t , ln .Addr ().String ())
164
164
165
+ // block off one port to test x11Forwarder evicts at highest port, not number of listeners.
166
+ externalListener , err := inproc .Listen ("tcp" ,
167
+ fmt .Sprintf ("localhost:%d" , agentssh .X11StartPort + agentssh .X11DefaultDisplayOffset + 1 ))
168
+ require .NoError (t , err )
169
+ defer externalListener .Close ()
170
+
165
171
// Calculate how many simultaneous X11 sessions we can create given the
166
172
// configured port range.
173
+
167
174
startPort := agentssh .X11StartPort + agentssh .X11DefaultDisplayOffset
168
- maxSessions := agentssh .X11MaxPort - startPort + 1
175
+ maxSessions := agentssh .X11MaxPort - startPort + 1 - 1 // -1 for the blocked port
169
176
require .Greater (t , maxSessions , 0 , "expected a positive maxSessions value" )
170
177
171
178
// shellSession holds references to the session and its standard streams so
You can’t perform that action at this time.
0 commit comments