File tree Expand file tree Collapse file tree 1 file changed +23
-0
lines changed Expand file tree Collapse file tree 1 file changed +23
-0
lines changed Original file line number Diff line number Diff line change @@ -252,6 +252,29 @@ func TestAgent(t *testing.T) {
252
252
}
253
253
})
254
254
255
+ t .Run ("SSH connection env vars" , func (t * testing.T ) {
256
+ t .Parallel ()
257
+
258
+ // Note: the SSH_TTY environment variable should only be set for TTYs.
259
+ // For some reason this test produces a TTY locally and a non-TTY in CI
260
+ // so we don't test for the absence of SSH_TTY.
261
+ for _ , key := range []string {"SSH_CONNECTION" , "SSH_CLIENT" } {
262
+ key := key
263
+ t .Run (key , func (t * testing.T ) {
264
+ t .Parallel ()
265
+
266
+ session := setupSSHSession (t , agent.Metadata {})
267
+ command := "sh -c 'echo $" + key + "'"
268
+ if runtime .GOOS == "windows" {
269
+ command = "cmd.exe /c echo %" + key + "%"
270
+ }
271
+ output , err := session .Output (command )
272
+ require .NoError (t , err )
273
+ require .NotEmpty (t , strings .TrimSpace (string (output )))
274
+ })
275
+ }
276
+ })
277
+
255
278
t .Run ("StartupScript" , func (t * testing.T ) {
256
279
t .Parallel ()
257
280
tempPath := filepath .Join (t .TempDir (), "content.txt" )
You can’t perform that action at this time.
0 commit comments