Ejemplo n.º 1
0
			})
		})

		It("returns errors if the app is already desired", func() {
			desiredLRPs := []receptor.DesiredLRPResponse{
				{ProcessGuid: "app-already-desired", Instances: 1},
			}
			fakeReceptorClient.DesiredLRPsReturns(desiredLRPs, nil)
			createAppParams = app_runner.CreateAppParams{
				Name: "app-already-desired",
			}

			err := appRunner.CreateApp(createAppParams)
			Expect(err).To(MatchError("app-already-desired is already running"))

			Expect(fakeReceptorClient.DesiredLRPsCallCount()).To(Equal(1))
		})

		It("returns errors if ssh host key generation fails", func() {
			fakeKeyGenerator.GenerateRSAPrivateKeyReturns("", errors.New("heat death of the universe"))

			err := appRunner.CreateApp(createAppParams)
			Expect(err).To(MatchError("heat death of the universe"))

			Expect(fakeReceptorClient.DesiredLRPsCallCount()).To(Equal(1))
		})

		It("returns errors if ssh key pair generation fails", func() {
			fakeKeyGenerator.GenerateRSAKeyPairReturns("", "", errors.New("heat death of the universe"))

			err := appRunner.CreateApp(createAppParams)