BeforeEach(func() { logger = lagertest.NewTestLogger("test") serverSSHConfig = &ssh.ServerConfig{ NoClientAuth: true, } serverSSHConfig.AddHostKey(TestHostKey) runner = &fakes.FakeRunner{} realRunner := handlers.NewCommandRunner() runner.StartStub = realRunner.Start runner.WaitStub = realRunner.Wait runner.SignalStub = realRunner.Signal shellLocator = &fakes.FakeShellLocator{} shellLocator.ShellPathReturns("/bin/sh") defaultEnv = map[string]string{} defaultEnv["TEST"] = "FOO" sessionChannelHandler = handlers.NewSessionChannelHandler(runner, shellLocator, defaultEnv, time.Second) newChannelHandlers = map[string]handlers.NewChannelHandler{ "session": sessionChannelHandler, } serverNetConn, clientNetConn := test_helpers.Pipe() sshd = daemon.New(logger, serverSSHConfig, nil, newChannelHandlers) connectionFinished = make(chan struct{}) go func() {
BeforeEach(func() { logger = lagertest.NewTestLogger("test") serverSSHConfig = &ssh.ServerConfig{ NoClientAuth: true, } serverSSHConfig.AddHostKey(TestHostKey) runner = &fakes.FakeRunner{} realRunner := handlers.NewCommandRunner() runner.StartStub = realRunner.Start runner.WaitStub = realRunner.Wait runner.SignalStub = realRunner.Signal shellLocator = &fakes.FakeShellLocator{} if runtime.GOOS == "windows" { shellLocator.ShellPathReturns(`\windows\system32\cmd.exe`) } else { shellLocator.ShellPathReturns("/bin/sh") } defaultEnv = map[string]string{} defaultEnv["TEST"] = "FOO" sessionChannelHandler = handlers.NewSessionChannelHandler(runner, shellLocator, defaultEnv, time.Second) newChannelHandlers = map[string]handlers.NewChannelHandler{ "session": sessionChannelHandler, } serverNetConn, clientNetConn := test_helpers.Pipe()