コード例 #1
0
ファイル: secure_shell_test.go プロジェクト: Klaudit/lattice
				<-doneChan
				return nil
			}

			go func() {
				defer GinkgoRecover()
				err := secureShell.ConnectToShell("app-name", 2, "", config)
				Expect(err).NotTo(HaveOccurred())
			}()

			waitChan <- struct{}{}

			Expect(syscall.Kill(syscall.Getpid(), syscall.SIGWINCH)).To(Succeed())
			Eventually(fakeTerm.GetWinsizeCallCount, 5).Should(Equal(2))
			Expect(fakeSession.SendRequestCallCount()).To(Equal(1))
			name, wantReply, payload := fakeSession.SendRequestArgsForCall(0)
			Expect(name).To(Equal("window-change"))
			Expect(wantReply).To(BeFalse())
			Expect(payload).To(Equal([]byte{0, 0, 0, 30, 0, 0, 0, 40, 0, 0, 0, 0, 0, 0, 0, 0}))

			doneChan <- struct{}{}
		})

		It("does not resize the remote terminal if SIGWINCH is received but the window is the same size", func() {
			fakeDialer.DialReturns(fakeSession, nil)
			fakeSession.StdinPipeReturns(fakeStdin, nil)
			fakeSession.StdoutPipeReturns(fakeStdout, nil)
			fakeSession.StderrPipeReturns(fakeStderr, nil)

			fakeTerm.GetWinsizeReturns(10, 20)