MCPcopy Index your code
hub / github.com/tailscale/tailscale / testSessionFor

Function testSessionFor

ssh/tailssh/tailssh_integration_test.go:822–845  ·  view source on GitHub ↗
(t *testing.T, cl *ssh.Client, sendEnv map[string]string)

Source from the content-addressed store, hash-verified

820}
821
822func testSessionFor(t *testing.T, cl *ssh.Client, sendEnv map[string]string) *session {
823 s, err := cl.NewSession()
824 if err != nil {
825 t.Fatal(err)
826 }
827 for k, v := range sendEnv {
828 s.Setenv(k, v)
829 }
830
831 t.Cleanup(func() { s.Close() })
832
833 stdinReader, stdinWriter := io.Pipe()
834 stdoutReader, stdoutWriter := io.Pipe()
835 stderrReader, stderrWriter := io.Pipe()
836 s.Stdin = stdinReader
837 s.Stdout = io.MultiWriter(stdoutWriter, os.Stdout)
838 s.Stderr = io.MultiWriter(stderrWriter, os.Stderr)
839 return &session{
840 Session: s,
841 stdin: stdinWriter,
842 stdout: stdoutReader,
843 stderr: stderrReader,
844 }
845}
846
847func generateClientKey(t *testing.T, privateKeyFile string) (ssh.Signer, *rsa.PrivateKey) {
848 t.Helper()

Callers 3

TestIntegrationSFTPFunction · 0.85
TestIntegrationSCPFunction · 0.85
testSessionFunction · 0.85

Calls 5

SetenvMethod · 0.95
CloseMethod · 0.95
NewSessionMethod · 0.80
FatalMethod · 0.65
CleanupMethod · 0.65

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…