[]string{"OK"}, []string{"Binding service", "global-service", "app1", "my-org", "my-space", "my-user"}, []string{"OK"}, []string{"Creating", "app2"}, []string{"OK"}, []string{"Binding service", "app2-service", "app2", "my-org", "my-space", "my-user"}, []string{"OK"}, []string{"Binding service", "global-service", "app2", "my-org", "my-space", "my-user"}, []string{"OK"}, )) }) }) Context("when the app is already bound to the service", func() { BeforeEach(func() { appRepo.ReadReturns.App = maker.NewApp(maker.Overrides{}) serviceBinder.BindApplicationReturns.Error = errors.NewHttpError(500, "90003", "it don't work") }) It("gracefully continues", func() { callPush() Expect(len(serviceBinder.AppsToBind)).To(Equal(4)) Expect(ui.Outputs).ToNot(ContainSubstrings([]string{"FAILED"})) }) }) Context("when the service instance can't be found", func() { BeforeEach(func() { // routeRepo.FindByHostAndDomainReturns.Error = errors.new("can't find service instance") serviceRepo.FindInstanceByNameErr = true manifestRepo.ReadManifestReturns.Manifest = manifestWithServicesAndEnv()
Expect(ui.FailedWithUsage).To(BeTrue()) Expect(passed).To(BeFalse()) }) It("does not require any flags", func() { requirementsFactory.LoginSuccess = true requirementsFactory.TargetedSpaceSuccess = true Expect(testcmd.RunCommand(cmd, []string{"my-app"}, requirementsFactory)).To(BeTrue()) }) }) Describe("scaling an app", func() { BeforeEach(func() { app = maker.NewApp(maker.Overrides{"name": "my-app", "guid": "my-app-guid"}) app.InstanceCount = 42 app.DiskQuota = 1024 app.Memory = 256 requirementsFactory.Application = app appRepo.UpdateAppResult = app }) Context("when no flags are specified", func() { It("prints a description of the app's limits", func() { testcmd.RunCommand(cmd, []string{"my-app"}, requirementsFactory) Expect(ui.Outputs).To(ContainSubstrings( []string{"Showing", "my-app", "my-org", "my-space", "my-user"}, []string{"OK"},
[]string{"OK"}, []string{"Binding service", "global-service", "app1", "my-org", "my-space", "my-user"}, []string{"OK"}, []string{"Creating", "app2"}, []string{"OK"}, []string{"Binding service", "app2-service", "app2", "my-org", "my-space", "my-user"}, []string{"OK"}, []string{"Binding service", "global-service", "app2", "my-org", "my-space", "my-user"}, []string{"OK"}, )) }) }) Context("when the app is already bound to the service", func() { BeforeEach(func() { appRepo.ReadReturns(maker.NewApp(maker.Overrides{}), nil) serviceBinder.BindApplicationReturns.Error = errors.NewHttpError(500, "90003", "it don't work") }) It("gracefully continues", func() { callPush() Expect(len(serviceBinder.AppsToBind)).To(Equal(4)) Expect(ui.Outputs).ToNot(ContainSubstrings([]string{"FAILED"})) }) }) Context("when the service instance can't be found", func() { BeforeEach(func() { // routeRepo.FindByHostAndDomainReturns.Error = errors.new("can't find service instance") serviceRepo.FindInstanceByNameErr = true manifestRepo.ReadManifestReturns.Manifest = manifestWithServicesAndEnv()