Example #1
0
		})

		It("resizes the remote terminal if the local terminal is resized", func() {
			fakeDialer.DialReturns(fakeSession, nil)
			fakeSession.StdinPipeReturns(fakeStdin, nil)
			fakeSession.StdoutPipeReturns(fakeStdout, nil)
			fakeSession.StderrPipeReturns(fakeStderr, nil)

			fakeTerm.GetWinsizeReturns(10, 20)

			waitChan := make(chan struct{})
			doneChan := make(chan struct{})
			fakeSession.ShellStub = func() error {
				Expect(fakeSession.SendRequestCallCount()).To(Equal(0))
				Expect(fakeTerm.GetWinsizeCallCount()).To(Equal(1))
				fakeTerm.GetWinsizeReturns(30, 40)
				<-waitChan
				<-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))
Example #2
0
			Expect(termType).To(Equal("xterm"))
		})

		It("resizes the remote terminal if the local terminal is resized", func() {
			fakeDialer.DialReturns(fakeSession, nil)
			fakeSession.StdinPipeReturns(fakeStdin, nil)
			fakeSession.StdoutPipeReturns(fakeStdout, nil)
			fakeSession.StderrPipeReturns(fakeStderr, nil)

			fakeTerm.GetWinsizeReturns(10, 20)

			waitChan := make(chan struct{})
			fakeSession.ShellStub = func() error {
				Expect(fakeSession.SendRequestCallCount()).To(Equal(0))
				Expect(fakeTerm.GetWinsizeCallCount()).To(Equal(1))
				fakeTerm.GetWinsizeReturns(30, 40)
				Eventually(waitChan).Should(Receive())
				return nil
			}

			go func() {
				defer GinkgoRecover()

				Eventually(waitChan).Should(Receive())
				err := secureShell.ConnectToShell("app-name", 2, "", config)
				Expect(err).NotTo(HaveOccurred())
			}()

			waitChan <- struct{}{}

			err := syscall.Kill(syscall.Getpid(), syscall.SIGWINCH)