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