示例#1
0
func (*AppDialer) Dial(appName string, instanceIndex int, config *config_package.Config) (Client, error) {
	diegoSSHUser := fmt.Sprintf("diego:%s/%d", appName, instanceIndex)
	address := fmt.Sprintf("%s:2222", config.Target())

	client, err := sshapi.New(diegoSSHUser, config.Username(), config.Password(), address)
	if err != nil {
		return nil, err
	}

	return client, nil
}
示例#2
0
		testConfig = config.New(testPersister)
	})

	Describe("Target", func() {
		It("sets the target", func() {
			testConfig.SetTarget("mynewapi.com")

			Expect(testConfig.Target()).To(Equal("mynewapi.com"))
		})
	})

	Describe("Username", func() {
		It("sets the target", func() {
			testConfig.SetLogin("ausername", "apassword")

			Expect(testConfig.Username()).To(Equal("ausername"))
		})
	})

	Describe("Receptor", func() {
		It("returns the Receptor with a username and password", func() {
			testConfig.SetTarget("mynewapi.com")
			testConfig.SetLogin("testusername", "testpassword")

			Expect(testConfig.Receptor()).To(Equal("http://*****:*****@receptor.mynewapi.com"))
		})

		It("returns a Receptor without a username and password", func() {
			testConfig.SetTarget("mynewapi.com")
			testConfig.SetLogin("", "")