Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commit1f5afe3

Browse files
committed
Add test for SSH env vars
1 parent7a015af commit1f5afe3

File tree

1 file changed

+24
-0
lines changed

1 file changed

+24
-0
lines changed

‎agent/agent_test.go

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -210,6 +210,30 @@ func TestAgent(t *testing.T) {
210210
require.Equal(t,value,strings.TrimSpace(string(output)))
211211
})
212212

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+
t.Parallel()
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+
213237
t.Run("EnvironmentVariableExpansion",func(t*testing.T) {
214238
t.Parallel()
215239
key:="EXAMPLE"

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp