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 commit1f5afe3Copy full SHA for 1f5afe3
agent/agent_test.go
@@ -210,6 +210,30 @@ func TestAgent(t *testing.T) {
210
require.Equal(t,value,strings.TrimSpace(string(output)))
211
})
212
213
+t.Run("SSH connection env vars",func(t*testing.T) {
214
+t.Parallel()
215
+
216
+// Note: the SSH_TTY environment variable should only be set for TTYs.
217
+for_,key:=range []string{"SSH_CONNECTION","SSH_CLIENT","SSH_TTY"} {
218
+key:=key
219
+t.Run(key,func(t*testing.T) {
220
221
222
+command:="sh -c 'echo $"+key+"'"
223
+ifruntime.GOOS=="windows" {
224
+ifkey=="SSH_TTY" {
225
+t.Skip("The SSH_PTY environment variable is not set on Windows")
226
+}
227
+command="cmd.exe /c echo %"+key+"%"
228
229
+session:=setupSSHSession(t, agent.Metadata{})
230
+output,err:=session.Output(command)
231
+require.NoError(t,err)
232
+require.NotEmpty(t,strings.TrimSpace(string(output)))
233
+})
234
235
236
237
t.Run("EnvironmentVariableExpansion",func(t*testing.T) {
238
t.Parallel()
239
key:="EXAMPLE"