Ejemplo n.º 1
0
				It("notifies the user that the migration was successful", func() {
					serviceRepo.GetServiceInstanceCountForServicePlanReturns(2, nil)
					testcmd.RunCLICommand("migrate-service-instances", args, requirementsFactory, updateCommandDependency, false)

					Expect(ui.Outputs).To(ContainSubstrings(
						[]string{"Attempting to migrate", "2", "service instances"},
						[]string{"1", "service instance", "migrated"},
						[]string{"OK"},
					))
				})
			})

			Context("when finding the v1 plan fails", func() {
				Context("because the plan does not exist", func() {
					BeforeEach(func() {
						serviceRepo.FindServicePlanByDescriptionReturns("", errors.NewModelNotFoundError("Service Plan", ""))
					})

					It("notifies the user of the failure", func() {
						testcmd.RunCLICommand("migrate-service-instances", args, requirementsFactory, updateCommandDependency, false)

						Expect(ui.Outputs).To(ContainSubstrings(
							[]string{"FAILED"},
							[]string{"Plan", "v1-service-label", "v1-provider-name", "v1-plan-name", "cannot be found"},
						))
					})

					It("does not display the warning", func() {
						testcmd.RunCLICommand("migrate-service-instances", args, requirementsFactory, updateCommandDependency, false)

						Expect(ui.Outputs).ToNot(ContainSubstrings([]string{"WARNING:", "this operation is to replace a service broker"}))