We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see ourdocumentation.
There was an error while loading.Please reload this page.
1 parent7a015af commit24f8e6aCopy full SHA for 24f8e6a
agent/agent_test.go
@@ -232,6 +232,30 @@ func TestAgent(t *testing.T) {
232
require.Equal(t,expect,strings.TrimSpace(string(output)))
233
})
234
235
+t.Run("SSH connection env vars",func(t*testing.T) {
236
+t.Parallel()
237
+
238
+// Note: the SSH_TTY environment variable should only be set for TTYs.
239
+for_,key:=range []string{"SSH_CONNECTION","SSH_CLIENT","SSH_TTY"} {
240
+key:=key
241
+t.Run(key,func(t*testing.T) {
242
243
244
+command:="sh -c 'echo $"+key+"'"
245
+ifruntime.GOOS=="windows" {
246
+ifkey=="SSH_TTY" {
247
+t.Skip("The SSH_PTY environment variable is not set on Windows")
248
+}
249
+command="cmd.exe /c echo %"+key+"%"
250
251
+session:=setupSSHSession(t, agent.Metadata{})
252
+output,err:=session.Output(command)
253
+require.NoError(t,err)
254
+require.NotEmpty(t,strings.TrimSpace(string(output)))
255
+})
256
257
258
259
t.Run("StartupScript",func(t*testing.T) {
260
t.Parallel()
261
tempPath:=filepath.Join(t.TempDir(),"content.txt")