示例#1
0
package options_test

import (
	"github.com/cloudfoundry-incubator/diego-ssh/cf-plugin/options"

	. "github.com/onsi/ginkgo"
	. "github.com/onsi/gomega"
)

var _ = Describe("SSHOptions", func() {
	var (
		opts       *options.SSHOptions
		args       []string
		parseError error
	)

	Describe("Parse", func() {
		BeforeEach(func() {
			opts = options.NewSSHOptions()
			args = []string{"ssh"}
			parseError = nil
		})

		JustBeforeEach(func() {
			parseError = opts.Parse(args)
		})

		Context("when the command name is missing", func() {
			BeforeEach(func() {
				args = []string{}
			})
示例#2
0
				var dialError = errors.New("woops")

				BeforeEach(func() {
					fakeSecureDialer.DialReturns(nil, dialError)
				})

				It("returns the dial error", func() {
					Expect(connectErr).To(Equal(dialError))
					Expect(fakeSecureDialer.DialCallCount()).To(Equal(1))
				})
			})
		})
	})

	Describe("InteractiveSession", func() {
		var opts *options.SSHOptions
		var sessionError error

		BeforeEach(func() {
			sshInfo := info.Info{
				SSHEndpoint:            "ssh.example.com:22",
				SSHEndpointFingerprint: TestHostKeyFingerprint,
			}

			app := app.App{
				Guid:      "app-guid",
				EnableSSH: true,
				Diego:     true,
				State:     "STARTED",
			}