@@ -120,6 +120,9 @@ func newFakeSession(sessionID, user string) *fakeSession {
120120 }
121121}
122122
123+ // Ensure gossh.Channel is satisfied (compile-time check via assignment).
124+ var _ gossh.Channel = (* fakeSession )(nil )
125+
123126// TestFakeSessionCompiles is a compile-time check that fakeSession fully
124127// implements gliderssh.Session. The test body is intentionally empty — a build
125128// failure means the interface is incomplete.
@@ -140,39 +143,6 @@ func TestFakeSessionCompiles(t *testing.T) {
140143 }
141144}
142145
143- // Ensure gossh.Channel is satisfied (compile-time check via assignment).
144- var _ gossh.Channel = (* fakeSession )(nil )
145-
146- // fakeGosshConn is a minimal implementation of gossh.Conn that can be embedded
147- // in a gossh.ServerConn so tests can inject a ServerConn into the session context
148- // without needing a real SSH network connection.
149- type fakeGosshConn struct {}
150-
151- func (f * fakeGosshConn ) User () string { return "root" }
152- func (f * fakeGosshConn ) SessionID () []byte { return nil }
153- func (f * fakeGosshConn ) ClientVersion () []byte { return nil }
154- func (f * fakeGosshConn ) ServerVersion () []byte { return nil }
155- func (f * fakeGosshConn ) RemoteAddr () net.Addr { return & net.TCPAddr {} }
156- func (f * fakeGosshConn ) LocalAddr () net.Addr { return & net.TCPAddr {} }
157- func (f * fakeGosshConn ) SendRequest (_ string , _ bool , _ []byte ) (bool , []byte , error ) {
158- return false , nil , nil
159- }
160-
161- func (f * fakeGosshConn ) OpenChannel (_ string , _ []byte ) (gossh.Channel , <- chan * gossh.Request , error ) {
162- return nil , nil , errors .New ("not implemented" )
163- }
164-
165- func (f * fakeGosshConn ) Close () error { return nil }
166-
167- // Wait blocks until the returned channel is closed — used by tests to
168- // control when the "kill on disconnect" goroutine unblocks.
169- func (f * fakeGosshConn ) Wait () error {
170- // Block until the test is done (goroutine is abandoned when the test
171- // function returns; the Go runtime cleans it up). This is acceptable
172- // because the caller only needs Wait to not panic.
173- select {}
174- }
175-
176146// TestShell_StartPtyError verifies that Shell() returns an error and does NOT
177147// panic when startPtyFn fails (e.g. "ptmx: inappropriate ioctl for device").
178148// Before the fix the nil *os.File returned by the stub was dereferenced, causing
0 commit comments