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 parent5fc1d41 commit460b762Copy full SHA for 460b762
agent/agent_test.go
@@ -252,6 +252,29 @@ func TestAgent(t *testing.T) {
252
}
253
})
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
265
266
+session:=setupSSHSession(t, agent.Metadata{})
267
+command:="sh -c 'echo $"+key+"'"
268
+ifruntime.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
278
t.Run("StartupScript",func(t*testing.T) {
279
t.Parallel()
280
tempPath:=filepath.Join(t.TempDir(),"content.txt")