diff --git a/actor/v7action/application.go b/actor/v7action/application.go index 68470090834..7d1c1fb2dca 100644 --- a/actor/v7action/application.go +++ b/actor/v7action/application.go @@ -298,9 +298,9 @@ func (actor Actor) PollStart(app resources.Application, noWait bool, handleInsta } } -// PollStartForRolling polls a deploying application's processes until some are started. It does the same thing as PollStart, except it accounts for rolling deployments and whether +// PollStartForDeployment polls a deploying application's processes until some are started. It does the same thing as PollStart, except it accounts for rolling/canary deployments and whether // they have failed or been canceled during polling. -func (actor Actor) PollStartForRolling(app resources.Application, deploymentGUID string, noWait bool, handleInstanceDetails func(string)) (Warnings, error) { +func (actor Actor) PollStartForDeployment(app resources.Application, deploymentGUID string, noWait bool, handleInstanceDetails func(string)) (Warnings, error) { var ( deployment resources.Deployment processes []resources.Process @@ -321,7 +321,7 @@ func (actor Actor) PollStartForRolling(app resources.Application, deploymentGUID } return allWarnings, actionerror.StartupTimeoutError{Name: app.Name} case <-timer.C(): - if !isDeployed(deployment) { + if !isDeployProcessed(deployment) { ccDeployment, warnings, err := actor.getDeployment(deploymentGUID) allWarnings = append(allWarnings, warnings...) if err != nil { @@ -335,7 +335,7 @@ func (actor Actor) PollStartForRolling(app resources.Application, deploymentGUID } } - if noWait || isDeployed(deployment) { + if noWait || isDeployProcessed(deployment) { stopPolling, warnings, err := actor.PollProcesses(processes, handleInstanceDetails) allWarnings = append(allWarnings, warnings...) if stopPolling || err != nil { @@ -348,7 +348,12 @@ func (actor Actor) PollStartForRolling(app resources.Application, deploymentGUID } } -func isDeployed(d resources.Deployment) bool { +func isDeployProcessed(d resources.Deployment) bool { + if d.Strategy == constant.DeploymentStrategyCanary { + return d.StatusValue == constant.DeploymentStatusValueActive && d.StatusReason == constant.DeploymentStatusReasonPaused || + d.StatusValue == constant.DeploymentStatusValueFinalized && d.StatusReason == constant.DeploymentStatusReasonDeployed + } + return d.StatusValue == constant.DeploymentStatusValueFinalized && d.StatusReason == constant.DeploymentStatusReasonDeployed } @@ -439,7 +444,7 @@ func (actor Actor) getProcesses(deployment resources.Deployment, appGUID string, // if the deployment is deployed we know web are all running and PollProcesses will see those as stable // so just getting all processes is equivalent to just getting non-web ones and polling those - if isDeployed(deployment) { + if isDeployProcessed(deployment) { processes, warnings, err := actor.CloudControllerClient.GetApplicationProcesses(appGUID) if err != nil { return processes, Warnings(warnings), err diff --git a/actor/v7action/application_summary_test.go b/actor/v7action/application_summary_test.go index bf0a1e17259..940fec7f067 100644 --- a/actor/v7action/application_summary_test.go +++ b/actor/v7action/application_summary_test.go @@ -628,6 +628,33 @@ var _ = Describe("Application Summary Actions", func() { }) }) }) + + When("the deployment strategy is canary", func() { + When("the deployment is paused", func() { + BeforeEach(func() { + fakeCloudControllerClient.GetDeploymentsReturns( + []resources.Deployment{ + { + GUID: "some-deployment-guid", + Strategy: "canary", + StatusValue: "ACTIVE", + StatusReason: "PAUSED", + }, + }, + nil, + nil, + ) + }) + It("returns the deployment information", func() { + Expect(summary.Deployment).To(Equal(resources.Deployment{ + GUID: "some-deployment-guid", + Strategy: "canary", + StatusValue: "ACTIVE", + StatusReason: "PAUSED", + })) + }) + }) + }) }) When("the deployment is not active", func() { diff --git a/actor/v7action/application_test.go b/actor/v7action/application_test.go index b88ee4f35c6..06c79bb8f62 100644 --- a/actor/v7action/application_test.go +++ b/actor/v7action/application_test.go @@ -1033,7 +1033,7 @@ var _ = Describe("Application Actions", func() { }) }) - Describe("PollStartForRolling", func() { + Describe("PollStartForDeployment", func() { var ( app resources.Application deploymentGUID string @@ -1065,7 +1065,7 @@ var _ = Describe("Application Actions", func() { JustBeforeEach(func() { go func() { - warnings, executeErr = actor.PollStartForRolling(app, deploymentGUID, noWait, handleInstanceDetails) + warnings, executeErr = actor.PollStartForDeployment(app, deploymentGUID, noWait, handleInstanceDetails) done <- true }() }) @@ -1367,160 +1367,205 @@ var _ = Describe("Application Actions", func() { }) When("things eventually become healthy", func() { - When("the no wait flag is given", func() { - BeforeEach(func() { - // in total three loops 1: deployment still deploying 2: deployment deployed processes starting 3: processes started - noWait = true - - // Always return deploying as a way to check we respect no wait - fakeCloudControllerClient.GetDeploymentReturns( - resources.Deployment{ - StatusValue: constant.DeploymentStatusValueActive, - NewProcesses: []resources.Process{{GUID: "new-deployment-process"}}, - }, - ccv3.Warnings{"get-deployment-warning"}, - nil, - ) + When("it is a rolling deployment", func() { + When("the no wait flag is given", func() { + BeforeEach(func() { + // in total three loops 1: deployment still deploying 2: deployment deployed processes starting 3: processes started + noWait = true - // We only poll the processes. Two loops for fun - fakeCloudControllerClient.GetProcessInstancesReturnsOnCall(0, - []ccv3.ProcessInstance{{State: constant.ProcessInstanceStarting}}, - ccv3.Warnings{"poll-processes-warning-1"}, - nil, - ) + // Always return deploying as a way to check we respect no wait + fakeCloudControllerClient.GetDeploymentReturns( + resources.Deployment{ + Strategy: constant.DeploymentStrategyRolling, + StatusValue: constant.DeploymentStatusValueActive, + NewProcesses: []resources.Process{{GUID: "new-deployment-process"}}, + }, + ccv3.Warnings{"get-deployment-warning"}, + nil, + ) - fakeCloudControllerClient.GetProcessInstancesReturnsOnCall(1, - []ccv3.ProcessInstance{{State: constant.ProcessInstanceRunning}}, - ccv3.Warnings{"poll-processes-warning-2"}, - nil, - ) - }) + // We only poll the processes. Two loops for fun + fakeCloudControllerClient.GetProcessInstancesReturnsOnCall(0, + []ccv3.ProcessInstance{{State: constant.ProcessInstanceStarting}}, + ccv3.Warnings{"poll-processes-warning-1"}, + nil, + ) - It("polls the start of the application correctly and returns warnings and no error", func() { - // Initial tick - fakeClock.WaitForNWatchersAndIncrement(1*time.Millisecond, 2) + fakeCloudControllerClient.GetProcessInstancesReturnsOnCall(1, + []ccv3.ProcessInstance{{State: constant.ProcessInstanceRunning}}, + ccv3.Warnings{"poll-processes-warning-2"}, + nil, + ) + }) - // assert one of our watcher is the timeout - Expect(fakeConfig.StartupTimeoutCallCount()).To(Equal(1)) + It("polls the start of the application correctly and returns warnings and no error", func() { + // Initial tick + fakeClock.WaitForNWatchersAndIncrement(1*time.Millisecond, 2) - // the first time through we always get the deployment regardless of no-wait - Eventually(fakeCloudControllerClient.GetDeploymentCallCount).Should(Equal(1)) - Expect(fakeCloudControllerClient.GetDeploymentArgsForCall(0)).To(Equal(deploymentGUID)) - Eventually(fakeCloudControllerClient.GetProcessInstancesCallCount).Should(Equal(1)) - Expect(fakeCloudControllerClient.GetProcessInstancesArgsForCall(0)).To(Equal("new-deployment-process")) - Eventually(fakeConfig.PollingIntervalCallCount).Should(Equal(1)) + // assert one of our watcher is the timeout + Expect(fakeConfig.StartupTimeoutCallCount()).To(Equal(1)) - fakeClock.Increment(1 * time.Second) + // the first time through we always get the deployment regardless of no-wait + Eventually(fakeCloudControllerClient.GetDeploymentCallCount).Should(Equal(1)) + Expect(fakeCloudControllerClient.GetDeploymentArgsForCall(0)).To(Equal(deploymentGUID)) + Eventually(fakeCloudControllerClient.GetProcessInstancesCallCount).Should(Equal(1)) + Expect(fakeCloudControllerClient.GetProcessInstancesArgsForCall(0)).To(Equal("new-deployment-process")) + Eventually(fakeConfig.PollingIntervalCallCount).Should(Equal(1)) - Eventually(fakeCloudControllerClient.GetDeploymentCallCount).Should(Equal(2)) - Expect(fakeCloudControllerClient.GetDeploymentArgsForCall(0)).To(Equal(deploymentGUID)) - Eventually(fakeCloudControllerClient.GetProcessInstancesCallCount).Should(Equal(2)) - Expect(fakeCloudControllerClient.GetProcessInstancesArgsForCall(0)).To(Equal("new-deployment-process")) + fakeClock.Increment(1 * time.Second) - Eventually(done).Should(Receive(BeTrue())) + Eventually(fakeCloudControllerClient.GetDeploymentCallCount).Should(Equal(2)) + Expect(fakeCloudControllerClient.GetDeploymentArgsForCall(0)).To(Equal(deploymentGUID)) + Eventually(fakeCloudControllerClient.GetProcessInstancesCallCount).Should(Equal(2)) + Expect(fakeCloudControllerClient.GetProcessInstancesArgsForCall(0)).To(Equal("new-deployment-process")) - Expect(executeErr).NotTo(HaveOccurred()) - Expect(warnings).To(ConsistOf( - "get-deployment-warning", - "poll-processes-warning-1", - "get-deployment-warning", - "poll-processes-warning-2", - )) + Eventually(done).Should(Receive(BeTrue())) - Expect(fakeCloudControllerClient.GetDeploymentCallCount()).To(Equal(2)) - Expect(fakeCloudControllerClient.GetApplicationProcessesCallCount()).To(Equal(0)) - Expect(fakeCloudControllerClient.GetProcessInstancesCallCount()).To(Equal(2)) - Expect(fakeConfig.PollingIntervalCallCount()).To(Equal(1)) + Expect(executeErr).NotTo(HaveOccurred()) + Expect(warnings).To(ConsistOf( + "get-deployment-warning", + "poll-processes-warning-1", + "get-deployment-warning", + "poll-processes-warning-2", + )) + Expect(fakeCloudControllerClient.GetDeploymentCallCount()).To(Equal(2)) + Expect(fakeCloudControllerClient.GetApplicationProcessesCallCount()).To(Equal(0)) + Expect(fakeCloudControllerClient.GetProcessInstancesCallCount()).To(Equal(2)) + Expect(fakeConfig.PollingIntervalCallCount()).To(Equal(1)) + }) }) + When("the no wait flag is not given", func() { + BeforeEach(func() { + // in total three loops 1: deployment still deploying 2: deployment deployed processes starting 3: processes started + fakeCloudControllerClient.GetDeploymentReturnsOnCall(0, + resources.Deployment{StatusValue: constant.DeploymentStatusValueActive}, + ccv3.Warnings{"get-deployment-warning-1"}, + nil, + ) - }) + // Poll the deployment twice to make sure we are polling (one in the above before each) + fakeCloudControllerClient.GetDeploymentReturnsOnCall(1, + resources.Deployment{StatusValue: constant.DeploymentStatusValueFinalized, StatusReason: constant.DeploymentStatusReasonDeployed}, + ccv3.Warnings{"get-deployment-warning-2"}, + nil, + ) - When("the no wait flag is not given", func() { - BeforeEach(func() { - // in total three loops 1: deployment still deploying 2: deployment deployed processes starting 3: processes started - fakeCloudControllerClient.GetDeploymentReturnsOnCall(0, - resources.Deployment{StatusValue: constant.DeploymentStatusValueActive}, - ccv3.Warnings{"get-deployment-warning-1"}, - nil, - ) + // then we get the processes. This should only be called once + fakeCloudControllerClient.GetApplicationProcessesReturns( + []resources.Process{{GUID: "process-guid"}}, + ccv3.Warnings{"get-processes-warning"}, + nil, + ) - // Poll the deployment twice to make sure we are polling (one in the above before each) - fakeCloudControllerClient.GetDeploymentReturnsOnCall(1, - resources.Deployment{StatusValue: constant.DeploymentStatusValueFinalized, StatusReason: constant.DeploymentStatusReasonDeployed}, - ccv3.Warnings{"get-deployment-warning-2"}, - nil, - ) + // then we poll the processes. Two loops for fun + fakeCloudControllerClient.GetProcessInstancesReturnsOnCall(0, + []ccv3.ProcessInstance{{State: constant.ProcessInstanceStarting}}, + ccv3.Warnings{"poll-processes-warning-1"}, + nil, + ) - // then we get the processes. This should only be called once - fakeCloudControllerClient.GetApplicationProcessesReturns( - []resources.Process{{GUID: "process-guid"}}, - ccv3.Warnings{"get-processes-warning"}, - nil, - ) + fakeCloudControllerClient.GetProcessInstancesReturnsOnCall(1, + []ccv3.ProcessInstance{{State: constant.ProcessInstanceRunning}}, + ccv3.Warnings{"poll-processes-warning-2"}, + nil, + ) + }) - // then we poll the processes. Two loops for fun - fakeCloudControllerClient.GetProcessInstancesReturnsOnCall(0, - []ccv3.ProcessInstance{{State: constant.ProcessInstanceStarting}}, - ccv3.Warnings{"poll-processes-warning-1"}, - nil, - ) + It("polls the start of the application correctly and returns warnings and no error", func() { + // Initial tick + fakeClock.WaitForNWatchersAndIncrement(1*time.Millisecond, 2) - fakeCloudControllerClient.GetProcessInstancesReturnsOnCall(1, - []ccv3.ProcessInstance{{State: constant.ProcessInstanceRunning}}, - ccv3.Warnings{"poll-processes-warning-2"}, - nil, - ) - }) + // assert one of our watchers is for the timeout + Expect(fakeConfig.StartupTimeoutCallCount()).To(Equal(1)) - It("polls the start of the application correctly and returns warnings and no error", func() { - // Initial tick - fakeClock.WaitForNWatchersAndIncrement(1*time.Millisecond, 2) + Eventually(fakeCloudControllerClient.GetDeploymentCallCount).Should(Equal(1)) + Expect(fakeCloudControllerClient.GetDeploymentArgsForCall(0)).To(Equal(deploymentGUID)) + Eventually(fakeConfig.PollingIntervalCallCount).Should(Equal(1)) - // assert one of our watchers is for the timeout - Expect(fakeConfig.StartupTimeoutCallCount()).To(Equal(1)) + // start the second loop where the deployment is deployed so we poll processes + fakeClock.Increment(1 * time.Second) - Eventually(fakeCloudControllerClient.GetDeploymentCallCount).Should(Equal(1)) - Expect(fakeCloudControllerClient.GetDeploymentArgsForCall(0)).To(Equal(deploymentGUID)) - Eventually(fakeConfig.PollingIntervalCallCount).Should(Equal(1)) + Eventually(fakeCloudControllerClient.GetDeploymentCallCount).Should(Equal(2)) + Expect(fakeCloudControllerClient.GetDeploymentArgsForCall(1)).To(Equal(deploymentGUID)) + Eventually(fakeCloudControllerClient.GetApplicationProcessesCallCount).Should(Equal(1)) + Expect(fakeCloudControllerClient.GetApplicationProcessesArgsForCall(0)).To(Equal(app.GUID)) + Eventually(fakeCloudControllerClient.GetProcessInstancesCallCount).Should(Equal(1)) + Expect(fakeCloudControllerClient.GetProcessInstancesArgsForCall(0)).To(Equal("process-guid")) + Eventually(fakeConfig.PollingIntervalCallCount).Should(Equal(2)) - // start the second loop where the deployment is deployed so we poll processes - fakeClock.Increment(1 * time.Second) + fakeClock.Increment(1 * time.Second) - Eventually(fakeCloudControllerClient.GetDeploymentCallCount).Should(Equal(2)) - Expect(fakeCloudControllerClient.GetDeploymentArgsForCall(1)).To(Equal(deploymentGUID)) - Eventually(fakeCloudControllerClient.GetApplicationProcessesCallCount).Should(Equal(1)) - Expect(fakeCloudControllerClient.GetApplicationProcessesArgsForCall(0)).To(Equal(app.GUID)) - Eventually(fakeCloudControllerClient.GetProcessInstancesCallCount).Should(Equal(1)) - Expect(fakeCloudControllerClient.GetProcessInstancesArgsForCall(0)).To(Equal("process-guid")) - Eventually(fakeConfig.PollingIntervalCallCount).Should(Equal(2)) + // we should stop polling because it is deployed + Eventually(fakeCloudControllerClient.GetProcessInstancesCallCount).Should(Equal(2)) + Expect(fakeCloudControllerClient.GetProcessInstancesArgsForCall(0)).To(Equal("process-guid")) - fakeClock.Increment(1 * time.Second) + Eventually(done).Should(Receive(BeTrue())) - // we should stop polling because it is deployed - Eventually(fakeCloudControllerClient.GetProcessInstancesCallCount).Should(Equal(2)) - Expect(fakeCloudControllerClient.GetProcessInstancesArgsForCall(0)).To(Equal("process-guid")) + Expect(executeErr).NotTo(HaveOccurred()) + Expect(warnings).To(ConsistOf( + "get-deployment-warning-1", + "get-deployment-warning-2", + "get-processes-warning", + "poll-processes-warning-1", + "poll-processes-warning-2", + )) - Eventually(done).Should(Receive(BeTrue())) + Expect(fakeCloudControllerClient.GetDeploymentCallCount()).To(Equal(2)) + Expect(fakeCloudControllerClient.GetApplicationProcessesCallCount()).To(Equal(1)) + Expect(fakeCloudControllerClient.GetProcessInstancesCallCount()).To(Equal(2)) + Expect(fakeConfig.PollingIntervalCallCount()).To(Equal(2)) + }) + }) + }) - Expect(executeErr).NotTo(HaveOccurred()) - Expect(warnings).To(ConsistOf( - "get-deployment-warning-1", - "get-deployment-warning-2", - "get-processes-warning", - "poll-processes-warning-1", - "poll-processes-warning-2", - )) + When("it is a canary deployment", func() { + When("the no wait flag is not given", func() { + BeforeEach(func() { + fakeCloudControllerClient.GetDeploymentReturnsOnCall(0, + resources.Deployment{ + Strategy: constant.DeploymentStrategyCanary, + StatusValue: constant.DeploymentStatusValueActive, + StatusReason: constant.DeploymentStatusReasonDeploying, + }, + nil, + nil, + ) - Expect(fakeCloudControllerClient.GetDeploymentCallCount()).To(Equal(2)) - Expect(fakeCloudControllerClient.GetApplicationProcessesCallCount()).To(Equal(1)) - Expect(fakeCloudControllerClient.GetProcessInstancesCallCount()).To(Equal(2)) - Expect(fakeConfig.PollingIntervalCallCount()).To(Equal(2)) + fakeCloudControllerClient.GetDeploymentReturnsOnCall(1, + resources.Deployment{ + Strategy: constant.DeploymentStrategyCanary, + StatusValue: constant.DeploymentStatusValueActive, + StatusReason: constant.DeploymentStatusReasonPaused, + }, + nil, + nil, + ) + }) - }) + It("stops polling when the deployment status is paused", func() { + // Initial tick + fakeClock.WaitForNWatchersAndIncrement(1*time.Millisecond, 2) - }) + Eventually(fakeCloudControllerClient.GetDeploymentCallCount).Should(Equal(1)) + Expect(fakeCloudControllerClient.GetDeploymentArgsForCall(0)).To(Equal(deploymentGUID)) + // start the second loop where the deployment is deployed so we poll processes + fakeClock.Increment(1 * time.Second) + + Eventually(fakeCloudControllerClient.GetDeploymentCallCount).Should(Equal(2)) + Expect(fakeCloudControllerClient.GetDeploymentArgsForCall(1)).To(Equal(deploymentGUID)) + + fakeClock.Increment(1 * time.Second) + + // we should stop polling because it is deployed + Eventually(done).Should(Receive(BeTrue())) + Expect(executeErr).NotTo(HaveOccurred()) + Expect(fakeCloudControllerClient.GetDeploymentCallCount()).To(Equal(2)) + Expect(fakeConfig.PollingIntervalCallCount()).To(Equal(1)) + }) + }) + }) }) }) diff --git a/actor/v7action/cloud_controller_client.go b/actor/v7action/cloud_controller_client.go index 88849010c58..e8810085e4a 100644 --- a/actor/v7action/cloud_controller_client.go +++ b/actor/v7action/cloud_controller_client.go @@ -18,10 +18,10 @@ type CloudControllerClient interface { ApplySpaceQuota(quotaGUID string, spaceGUID string) (resources.RelationshipList, ccv3.Warnings, error) CheckRoute(domainGUID string, hostname string, path string, port int) (bool, ccv3.Warnings, error) CancelDeployment(deploymentGUID string) (ccv3.Warnings, error) + ContinueDeployment(deploymentGUID string) (ccv3.Warnings, error) CopyPackage(sourcePackageGUID string, targetAppGUID string) (resources.Package, ccv3.Warnings, error) CreateApplication(app resources.Application) (resources.Application, ccv3.Warnings, error) - CreateApplicationDeployment(appGUID string, dropletGUID string) (string, ccv3.Warnings, error) - CreateApplicationDeploymentByRevision(appGUID string, revisionGUID string) (string, ccv3.Warnings, error) + CreateApplicationDeployment(dep resources.Deployment) (string, ccv3.Warnings, error) CreateApplicationProcessScale(appGUID string, process resources.Process) (resources.Process, ccv3.Warnings, error) CreateApplicationTask(appGUID string, task resources.Task) (resources.Task, ccv3.Warnings, error) CreateBuild(build resources.Build) (resources.Build, ccv3.Warnings, error) diff --git a/actor/v7action/deployment.go b/actor/v7action/deployment.go index d707b577e33..e21873d8f40 100644 --- a/actor/v7action/deployment.go +++ b/actor/v7action/deployment.go @@ -7,15 +7,8 @@ import ( "code.cloudfoundry.org/cli/resources" ) -func (actor Actor) CreateDeploymentByApplicationAndDroplet(appGUID string, dropletGUID string) (string, Warnings, error) { - deploymentGUID, warnings, err := actor.CloudControllerClient.CreateApplicationDeployment(appGUID, dropletGUID) - - return deploymentGUID, Warnings(warnings), err -} - -func (actor Actor) CreateDeploymentByApplicationAndRevision(appGUID string, revisionGUID string) (string, Warnings, error) { - deploymentGUID, warnings, err := actor.CloudControllerClient.CreateApplicationDeploymentByRevision(appGUID, revisionGUID) - +func (actor Actor) CreateDeployment(dep resources.Deployment) (string, Warnings, error) { + deploymentGUID, warnings, err := actor.CloudControllerClient.CreateApplicationDeployment(dep) return deploymentGUID, Warnings(warnings), err } @@ -43,3 +36,8 @@ func (actor Actor) CancelDeployment(deploymentGUID string) (Warnings, error) { warnings, err := actor.CloudControllerClient.CancelDeployment(deploymentGUID) return Warnings(warnings), err } + +func (actor Actor) ContinueDeployment(deploymentGUID string) (Warnings, error) { + warnings, err := actor.CloudControllerClient.ContinueDeployment(deploymentGUID) + return Warnings(warnings), err +} diff --git a/actor/v7action/deployment_test.go b/actor/v7action/deployment_test.go index 2326b6c4f3e..33afe3c3312 100644 --- a/actor/v7action/deployment_test.go +++ b/actor/v7action/deployment_test.go @@ -25,21 +25,25 @@ var _ = Describe("Deployment Actions", func() { BeforeEach(func() { actor, fakeCloudControllerClient, _, _, _, _, _ = NewTestActor() - fakeCloudControllerClient.CreateApplicationDeploymentByRevisionReturns( + fakeCloudControllerClient.CreateApplicationDeploymentReturns( "some-deployment-guid", ccv3.Warnings{"create-warning-1", "create-warning-2"}, errors.New("create-error"), ) }) - Describe("CreateDeploymentByApplicationAndRevision", func() { + Describe("Create a deployment with app and revision guids", func() { JustBeforeEach(func() { - returnedDeploymentGUID, warnings, executeErr = actor.CreateDeploymentByApplicationAndRevision("some-app-guid", "some-revision-guid") + var dep resources.Deployment + dep.Strategy = constant.DeploymentStrategyRolling + dep.RevisionGUID = "some-revision-guid" + dep.Relationships = resources.Relationships{constant.RelationshipTypeApplication: resources.Relationship{GUID: "some-app-guid"}} + returnedDeploymentGUID, warnings, executeErr = actor.CreateDeployment(dep) }) When("the client fails", func() { BeforeEach(func() { - fakeCloudControllerClient.CreateApplicationDeploymentByRevisionReturns( + fakeCloudControllerClient.CreateApplicationDeploymentReturns( "some-deployment-guid", ccv3.Warnings{"create-warning-1", "create-warning-2"}, errors.New("create-deployment-error"), @@ -54,28 +58,32 @@ var _ = Describe("Deployment Actions", func() { It("delegates to the cloud controller client", func() { - Expect(fakeCloudControllerClient.CreateApplicationDeploymentByRevisionCallCount()).To(Equal(1), "CreateApplicationDeploymentByRevision call count") - givenAppGUID, givenRevisionGUID := fakeCloudControllerClient.CreateApplicationDeploymentByRevisionArgsForCall(0) + Expect(fakeCloudControllerClient.CreateApplicationDeploymentCallCount()).To(Equal(1), "CreateApplicationDeploymentByRevision call count") + dep := fakeCloudControllerClient.CreateApplicationDeploymentArgsForCall(0) - Expect(givenAppGUID).To(Equal("some-app-guid")) - Expect(givenRevisionGUID).To(Equal("some-revision-guid")) + Expect(dep.Relationships[constant.RelationshipTypeApplication].GUID).To(Equal("some-app-guid")) + Expect(dep.RevisionGUID).To(Equal("some-revision-guid")) Expect(returnedDeploymentGUID).To(Equal("some-deployment-guid")) Expect(warnings).To(Equal(Warnings{"create-warning-1", "create-warning-2"})) }) }) - Describe("CreateDeploymentByApplicationAndDroplet", func() { + Describe("Create a deployment with app and droplet guids", func() { It("delegates to the cloud controller client", func() { fakeCloudControllerClient.CreateApplicationDeploymentReturns("some-deployment-guid", ccv3.Warnings{"create-warning-1", "create-warning-2"}, errors.New("create-error")) - returnedDeploymentGUID, warnings, executeErr := actor.CreateDeploymentByApplicationAndDroplet("some-app-guid", "some-droplet-guid") + var dep resources.Deployment + dep.Strategy = constant.DeploymentStrategyCanary + dep.Relationships = resources.Relationships{constant.RelationshipTypeApplication: resources.Relationship{GUID: "some-app-guid"}} + dep.DropletGUID = "some-droplet-guid" + returnedDeploymentGUID, warnings, executeErr := actor.CreateDeployment(dep) Expect(fakeCloudControllerClient.CreateApplicationDeploymentCallCount()).To(Equal(1)) - givenAppGUID, givenDropletGUID := fakeCloudControllerClient.CreateApplicationDeploymentArgsForCall(0) + dep1 := fakeCloudControllerClient.CreateApplicationDeploymentArgsForCall(0) - Expect(givenAppGUID).To(Equal("some-app-guid")) - Expect(givenDropletGUID).To(Equal("some-droplet-guid")) + Expect(dep1.Relationships[constant.RelationshipTypeApplication].GUID).To(Equal("some-app-guid")) + Expect(dep1.DropletGUID).To(Equal("some-droplet-guid")) Expect(returnedDeploymentGUID).To(Equal("some-deployment-guid")) Expect(warnings).To(Equal(Warnings{"create-warning-1", "create-warning-2"})) @@ -206,4 +214,49 @@ var _ = Describe("Deployment Actions", func() { }) }) }) + + Describe("ContinueDeployment", func() { + var ( + deploymentGUID string + + warnings Warnings + executeErr error + ) + + BeforeEach(func() { + deploymentGUID = "dep-guid" + }) + + JustBeforeEach(func() { + warnings, executeErr = actor.ContinueDeployment(deploymentGUID) + }) + + It("delegates to the cc client", func() { + Expect(fakeCloudControllerClient.ContinueDeploymentCallCount()).To(Equal(1)) + Expect(fakeCloudControllerClient.ContinueDeploymentArgsForCall(0)).To(Equal(deploymentGUID)) + }) + + When("the client fails", func() { + BeforeEach(func() { + fakeCloudControllerClient.ContinueDeploymentReturns(ccv3.Warnings{"continue-deployment-warnings"}, errors.New("continue-deployment-error")) + }) + + It("returns the warnings and error", func() { + Expect(executeErr).To(MatchError("continue-deployment-error")) + Expect(warnings).To(ConsistOf("continue-deployment-warnings")) + }) + + }) + + When("the client succeeds", func() { + BeforeEach(func() { + fakeCloudControllerClient.ContinueDeploymentReturns(ccv3.Warnings{"continue-deployment-warnings"}, nil) + }) + + It("returns the warnings and error", func() { + Expect(executeErr).ToNot(HaveOccurred()) + Expect(warnings).To(ConsistOf("continue-deployment-warnings")) + }) + }) + }) }) diff --git a/actor/v7action/v7actionfakes/fake_cloud_controller_client.go b/actor/v7action/v7actionfakes/fake_cloud_controller_client.go index b7ff686364e..942728edbda 100644 --- a/actor/v7action/v7actionfakes/fake_cloud_controller_client.go +++ b/actor/v7action/v7actionfakes/fake_cloud_controller_client.go @@ -77,6 +77,19 @@ type FakeCloudControllerClient struct { result2 ccv3.Warnings result3 error } + ContinueDeploymentStub func(string) (ccv3.Warnings, error) + continueDeploymentMutex sync.RWMutex + continueDeploymentArgsForCall []struct { + arg1 string + } + continueDeploymentReturns struct { + result1 ccv3.Warnings + result2 error + } + continueDeploymentReturnsOnCall map[int]struct { + result1 ccv3.Warnings + result2 error + } CopyPackageStub func(string, string) (resources.Package, ccv3.Warnings, error) copyPackageMutex sync.RWMutex copyPackageArgsForCall []struct { @@ -108,11 +121,10 @@ type FakeCloudControllerClient struct { result2 ccv3.Warnings result3 error } - CreateApplicationDeploymentStub func(string, string) (string, ccv3.Warnings, error) + CreateApplicationDeploymentStub func(resources.Deployment) (string, ccv3.Warnings, error) createApplicationDeploymentMutex sync.RWMutex createApplicationDeploymentArgsForCall []struct { - arg1 string - arg2 string + arg1 resources.Deployment } createApplicationDeploymentReturns struct { result1 string @@ -124,22 +136,6 @@ type FakeCloudControllerClient struct { result2 ccv3.Warnings result3 error } - CreateApplicationDeploymentByRevisionStub func(string, string) (string, ccv3.Warnings, error) - createApplicationDeploymentByRevisionMutex sync.RWMutex - createApplicationDeploymentByRevisionArgsForCall []struct { - arg1 string - arg2 string - } - createApplicationDeploymentByRevisionReturns struct { - result1 string - result2 ccv3.Warnings - result3 error - } - createApplicationDeploymentByRevisionReturnsOnCall map[int]struct { - result1 string - result2 ccv3.Warnings - result3 error - } CreateApplicationProcessScaleStub func(string, resources.Process) (resources.Process, ccv3.Warnings, error) createApplicationProcessScaleMutex sync.RWMutex createApplicationProcessScaleArgsForCall []struct { @@ -2778,15 +2774,16 @@ func (fake *FakeCloudControllerClient) ApplyOrganizationQuota(arg1 string, arg2 arg1 string arg2 string }{arg1, arg2}) + stub := fake.ApplyOrganizationQuotaStub + fakeReturns := fake.applyOrganizationQuotaReturns fake.recordInvocation("ApplyOrganizationQuota", []interface{}{arg1, arg2}) fake.applyOrganizationQuotaMutex.Unlock() - if fake.ApplyOrganizationQuotaStub != nil { - return fake.ApplyOrganizationQuotaStub(arg1, arg2) + if stub != nil { + return stub(arg1, arg2) } if specificReturn { return ret.result1, ret.result2, ret.result3 } - fakeReturns := fake.applyOrganizationQuotaReturns return fakeReturns.result1, fakeReturns.result2, fakeReturns.result3 } @@ -2845,15 +2842,16 @@ func (fake *FakeCloudControllerClient) ApplySpaceQuota(arg1 string, arg2 string) arg1 string arg2 string }{arg1, arg2}) + stub := fake.ApplySpaceQuotaStub + fakeReturns := fake.applySpaceQuotaReturns fake.recordInvocation("ApplySpaceQuota", []interface{}{arg1, arg2}) fake.applySpaceQuotaMutex.Unlock() - if fake.ApplySpaceQuotaStub != nil { - return fake.ApplySpaceQuotaStub(arg1, arg2) + if stub != nil { + return stub(arg1, arg2) } if specificReturn { return ret.result1, ret.result2, ret.result3 } - fakeReturns := fake.applySpaceQuotaReturns return fakeReturns.result1, fakeReturns.result2, fakeReturns.result3 } @@ -2911,15 +2909,16 @@ func (fake *FakeCloudControllerClient) CancelDeployment(arg1 string) (ccv3.Warni fake.cancelDeploymentArgsForCall = append(fake.cancelDeploymentArgsForCall, struct { arg1 string }{arg1}) + stub := fake.CancelDeploymentStub + fakeReturns := fake.cancelDeploymentReturns fake.recordInvocation("CancelDeployment", []interface{}{arg1}) fake.cancelDeploymentMutex.Unlock() - if fake.CancelDeploymentStub != nil { - return fake.CancelDeploymentStub(arg1) + if stub != nil { + return stub(arg1) } if specificReturn { return ret.result1, ret.result2 } - fakeReturns := fake.cancelDeploymentReturns return fakeReturns.result1, fakeReturns.result2 } @@ -2977,15 +2976,16 @@ func (fake *FakeCloudControllerClient) CheckRoute(arg1 string, arg2 string, arg3 arg3 string arg4 int }{arg1, arg2, arg3, arg4}) + stub := fake.CheckRouteStub + fakeReturns := fake.checkRouteReturns fake.recordInvocation("CheckRoute", []interface{}{arg1, arg2, arg3, arg4}) fake.checkRouteMutex.Unlock() - if fake.CheckRouteStub != nil { - return fake.CheckRouteStub(arg1, arg2, arg3, arg4) + if stub != nil { + return stub(arg1, arg2, arg3, arg4) } if specificReturn { return ret.result1, ret.result2, ret.result3 } - fakeReturns := fake.checkRouteReturns return fakeReturns.result1, fakeReturns.result2, fakeReturns.result3 } @@ -3037,6 +3037,70 @@ func (fake *FakeCloudControllerClient) CheckRouteReturnsOnCall(i int, result1 bo }{result1, result2, result3} } +func (fake *FakeCloudControllerClient) ContinueDeployment(arg1 string) (ccv3.Warnings, error) { + fake.continueDeploymentMutex.Lock() + ret, specificReturn := fake.continueDeploymentReturnsOnCall[len(fake.continueDeploymentArgsForCall)] + fake.continueDeploymentArgsForCall = append(fake.continueDeploymentArgsForCall, struct { + arg1 string + }{arg1}) + stub := fake.ContinueDeploymentStub + fakeReturns := fake.continueDeploymentReturns + fake.recordInvocation("ContinueDeployment", []interface{}{arg1}) + fake.continueDeploymentMutex.Unlock() + if stub != nil { + return stub(arg1) + } + if specificReturn { + return ret.result1, ret.result2 + } + return fakeReturns.result1, fakeReturns.result2 +} + +func (fake *FakeCloudControllerClient) ContinueDeploymentCallCount() int { + fake.continueDeploymentMutex.RLock() + defer fake.continueDeploymentMutex.RUnlock() + return len(fake.continueDeploymentArgsForCall) +} + +func (fake *FakeCloudControllerClient) ContinueDeploymentCalls(stub func(string) (ccv3.Warnings, error)) { + fake.continueDeploymentMutex.Lock() + defer fake.continueDeploymentMutex.Unlock() + fake.ContinueDeploymentStub = stub +} + +func (fake *FakeCloudControllerClient) ContinueDeploymentArgsForCall(i int) string { + fake.continueDeploymentMutex.RLock() + defer fake.continueDeploymentMutex.RUnlock() + argsForCall := fake.continueDeploymentArgsForCall[i] + return argsForCall.arg1 +} + +func (fake *FakeCloudControllerClient) ContinueDeploymentReturns(result1 ccv3.Warnings, result2 error) { + fake.continueDeploymentMutex.Lock() + defer fake.continueDeploymentMutex.Unlock() + fake.ContinueDeploymentStub = nil + fake.continueDeploymentReturns = struct { + result1 ccv3.Warnings + result2 error + }{result1, result2} +} + +func (fake *FakeCloudControllerClient) ContinueDeploymentReturnsOnCall(i int, result1 ccv3.Warnings, result2 error) { + fake.continueDeploymentMutex.Lock() + defer fake.continueDeploymentMutex.Unlock() + fake.ContinueDeploymentStub = nil + if fake.continueDeploymentReturnsOnCall == nil { + fake.continueDeploymentReturnsOnCall = make(map[int]struct { + result1 ccv3.Warnings + result2 error + }) + } + fake.continueDeploymentReturnsOnCall[i] = struct { + result1 ccv3.Warnings + result2 error + }{result1, result2} +} + func (fake *FakeCloudControllerClient) CopyPackage(arg1 string, arg2 string) (resources.Package, ccv3.Warnings, error) { fake.copyPackageMutex.Lock() ret, specificReturn := fake.copyPackageReturnsOnCall[len(fake.copyPackageArgsForCall)] @@ -3044,15 +3108,16 @@ func (fake *FakeCloudControllerClient) CopyPackage(arg1 string, arg2 string) (re arg1 string arg2 string }{arg1, arg2}) + stub := fake.CopyPackageStub + fakeReturns := fake.copyPackageReturns fake.recordInvocation("CopyPackage", []interface{}{arg1, arg2}) fake.copyPackageMutex.Unlock() - if fake.CopyPackageStub != nil { - return fake.CopyPackageStub(arg1, arg2) + if stub != nil { + return stub(arg1, arg2) } if specificReturn { return ret.result1, ret.result2, ret.result3 } - fakeReturns := fake.copyPackageReturns return fakeReturns.result1, fakeReturns.result2, fakeReturns.result3 } @@ -3110,15 +3175,16 @@ func (fake *FakeCloudControllerClient) CreateApplication(arg1 resources.Applicat fake.createApplicationArgsForCall = append(fake.createApplicationArgsForCall, struct { arg1 resources.Application }{arg1}) + stub := fake.CreateApplicationStub + fakeReturns := fake.createApplicationReturns fake.recordInvocation("CreateApplication", []interface{}{arg1}) fake.createApplicationMutex.Unlock() - if fake.CreateApplicationStub != nil { - return fake.CreateApplicationStub(arg1) + if stub != nil { + return stub(arg1) } if specificReturn { return ret.result1, ret.result2, ret.result3 } - fakeReturns := fake.createApplicationReturns return fakeReturns.result1, fakeReturns.result2, fakeReturns.result3 } @@ -3170,22 +3236,22 @@ func (fake *FakeCloudControllerClient) CreateApplicationReturnsOnCall(i int, res }{result1, result2, result3} } -func (fake *FakeCloudControllerClient) CreateApplicationDeployment(arg1 string, arg2 string) (string, ccv3.Warnings, error) { +func (fake *FakeCloudControllerClient) CreateApplicationDeployment(arg1 resources.Deployment) (string, ccv3.Warnings, error) { fake.createApplicationDeploymentMutex.Lock() ret, specificReturn := fake.createApplicationDeploymentReturnsOnCall[len(fake.createApplicationDeploymentArgsForCall)] fake.createApplicationDeploymentArgsForCall = append(fake.createApplicationDeploymentArgsForCall, struct { - arg1 string - arg2 string - }{arg1, arg2}) - fake.recordInvocation("CreateApplicationDeployment", []interface{}{arg1, arg2}) + arg1 resources.Deployment + }{arg1}) + stub := fake.CreateApplicationDeploymentStub + fakeReturns := fake.createApplicationDeploymentReturns + fake.recordInvocation("CreateApplicationDeployment", []interface{}{arg1}) fake.createApplicationDeploymentMutex.Unlock() - if fake.CreateApplicationDeploymentStub != nil { - return fake.CreateApplicationDeploymentStub(arg1, arg2) + if stub != nil { + return stub(arg1) } if specificReturn { return ret.result1, ret.result2, ret.result3 } - fakeReturns := fake.createApplicationDeploymentReturns return fakeReturns.result1, fakeReturns.result2, fakeReturns.result3 } @@ -3195,17 +3261,17 @@ func (fake *FakeCloudControllerClient) CreateApplicationDeploymentCallCount() in return len(fake.createApplicationDeploymentArgsForCall) } -func (fake *FakeCloudControllerClient) CreateApplicationDeploymentCalls(stub func(string, string) (string, ccv3.Warnings, error)) { +func (fake *FakeCloudControllerClient) CreateApplicationDeploymentCalls(stub func(resources.Deployment) (string, ccv3.Warnings, error)) { fake.createApplicationDeploymentMutex.Lock() defer fake.createApplicationDeploymentMutex.Unlock() fake.CreateApplicationDeploymentStub = stub } -func (fake *FakeCloudControllerClient) CreateApplicationDeploymentArgsForCall(i int) (string, string) { +func (fake *FakeCloudControllerClient) CreateApplicationDeploymentArgsForCall(i int) resources.Deployment { fake.createApplicationDeploymentMutex.RLock() defer fake.createApplicationDeploymentMutex.RUnlock() argsForCall := fake.createApplicationDeploymentArgsForCall[i] - return argsForCall.arg1, argsForCall.arg2 + return argsForCall.arg1 } func (fake *FakeCloudControllerClient) CreateApplicationDeploymentReturns(result1 string, result2 ccv3.Warnings, result3 error) { @@ -3237,73 +3303,6 @@ func (fake *FakeCloudControllerClient) CreateApplicationDeploymentReturnsOnCall( }{result1, result2, result3} } -func (fake *FakeCloudControllerClient) CreateApplicationDeploymentByRevision(arg1 string, arg2 string) (string, ccv3.Warnings, error) { - fake.createApplicationDeploymentByRevisionMutex.Lock() - ret, specificReturn := fake.createApplicationDeploymentByRevisionReturnsOnCall[len(fake.createApplicationDeploymentByRevisionArgsForCall)] - fake.createApplicationDeploymentByRevisionArgsForCall = append(fake.createApplicationDeploymentByRevisionArgsForCall, struct { - arg1 string - arg2 string - }{arg1, arg2}) - fake.recordInvocation("CreateApplicationDeploymentByRevision", []interface{}{arg1, arg2}) - fake.createApplicationDeploymentByRevisionMutex.Unlock() - if fake.CreateApplicationDeploymentByRevisionStub != nil { - return fake.CreateApplicationDeploymentByRevisionStub(arg1, arg2) - } - if specificReturn { - return ret.result1, ret.result2, ret.result3 - } - fakeReturns := fake.createApplicationDeploymentByRevisionReturns - return fakeReturns.result1, fakeReturns.result2, fakeReturns.result3 -} - -func (fake *FakeCloudControllerClient) CreateApplicationDeploymentByRevisionCallCount() int { - fake.createApplicationDeploymentByRevisionMutex.RLock() - defer fake.createApplicationDeploymentByRevisionMutex.RUnlock() - return len(fake.createApplicationDeploymentByRevisionArgsForCall) -} - -func (fake *FakeCloudControllerClient) CreateApplicationDeploymentByRevisionCalls(stub func(string, string) (string, ccv3.Warnings, error)) { - fake.createApplicationDeploymentByRevisionMutex.Lock() - defer fake.createApplicationDeploymentByRevisionMutex.Unlock() - fake.CreateApplicationDeploymentByRevisionStub = stub -} - -func (fake *FakeCloudControllerClient) CreateApplicationDeploymentByRevisionArgsForCall(i int) (string, string) { - fake.createApplicationDeploymentByRevisionMutex.RLock() - defer fake.createApplicationDeploymentByRevisionMutex.RUnlock() - argsForCall := fake.createApplicationDeploymentByRevisionArgsForCall[i] - return argsForCall.arg1, argsForCall.arg2 -} - -func (fake *FakeCloudControllerClient) CreateApplicationDeploymentByRevisionReturns(result1 string, result2 ccv3.Warnings, result3 error) { - fake.createApplicationDeploymentByRevisionMutex.Lock() - defer fake.createApplicationDeploymentByRevisionMutex.Unlock() - fake.CreateApplicationDeploymentByRevisionStub = nil - fake.createApplicationDeploymentByRevisionReturns = struct { - result1 string - result2 ccv3.Warnings - result3 error - }{result1, result2, result3} -} - -func (fake *FakeCloudControllerClient) CreateApplicationDeploymentByRevisionReturnsOnCall(i int, result1 string, result2 ccv3.Warnings, result3 error) { - fake.createApplicationDeploymentByRevisionMutex.Lock() - defer fake.createApplicationDeploymentByRevisionMutex.Unlock() - fake.CreateApplicationDeploymentByRevisionStub = nil - if fake.createApplicationDeploymentByRevisionReturnsOnCall == nil { - fake.createApplicationDeploymentByRevisionReturnsOnCall = make(map[int]struct { - result1 string - result2 ccv3.Warnings - result3 error - }) - } - fake.createApplicationDeploymentByRevisionReturnsOnCall[i] = struct { - result1 string - result2 ccv3.Warnings - result3 error - }{result1, result2, result3} -} - func (fake *FakeCloudControllerClient) CreateApplicationProcessScale(arg1 string, arg2 resources.Process) (resources.Process, ccv3.Warnings, error) { fake.createApplicationProcessScaleMutex.Lock() ret, specificReturn := fake.createApplicationProcessScaleReturnsOnCall[len(fake.createApplicationProcessScaleArgsForCall)] @@ -3311,15 +3310,16 @@ func (fake *FakeCloudControllerClient) CreateApplicationProcessScale(arg1 string arg1 string arg2 resources.Process }{arg1, arg2}) + stub := fake.CreateApplicationProcessScaleStub + fakeReturns := fake.createApplicationProcessScaleReturns fake.recordInvocation("CreateApplicationProcessScale", []interface{}{arg1, arg2}) fake.createApplicationProcessScaleMutex.Unlock() - if fake.CreateApplicationProcessScaleStub != nil { - return fake.CreateApplicationProcessScaleStub(arg1, arg2) + if stub != nil { + return stub(arg1, arg2) } if specificReturn { return ret.result1, ret.result2, ret.result3 } - fakeReturns := fake.createApplicationProcessScaleReturns return fakeReturns.result1, fakeReturns.result2, fakeReturns.result3 } @@ -3378,15 +3378,16 @@ func (fake *FakeCloudControllerClient) CreateApplicationTask(arg1 string, arg2 r arg1 string arg2 resources.Task }{arg1, arg2}) + stub := fake.CreateApplicationTaskStub + fakeReturns := fake.createApplicationTaskReturns fake.recordInvocation("CreateApplicationTask", []interface{}{arg1, arg2}) fake.createApplicationTaskMutex.Unlock() - if fake.CreateApplicationTaskStub != nil { - return fake.CreateApplicationTaskStub(arg1, arg2) + if stub != nil { + return stub(arg1, arg2) } if specificReturn { return ret.result1, ret.result2, ret.result3 } - fakeReturns := fake.createApplicationTaskReturns return fakeReturns.result1, fakeReturns.result2, fakeReturns.result3 } @@ -3444,15 +3445,16 @@ func (fake *FakeCloudControllerClient) CreateBuild(arg1 resources.Build) (resour fake.createBuildArgsForCall = append(fake.createBuildArgsForCall, struct { arg1 resources.Build }{arg1}) + stub := fake.CreateBuildStub + fakeReturns := fake.createBuildReturns fake.recordInvocation("CreateBuild", []interface{}{arg1}) fake.createBuildMutex.Unlock() - if fake.CreateBuildStub != nil { - return fake.CreateBuildStub(arg1) + if stub != nil { + return stub(arg1) } if specificReturn { return ret.result1, ret.result2, ret.result3 } - fakeReturns := fake.createBuildReturns return fakeReturns.result1, fakeReturns.result2, fakeReturns.result3 } @@ -3510,15 +3512,16 @@ func (fake *FakeCloudControllerClient) CreateBuildpack(arg1 resources.Buildpack) fake.createBuildpackArgsForCall = append(fake.createBuildpackArgsForCall, struct { arg1 resources.Buildpack }{arg1}) + stub := fake.CreateBuildpackStub + fakeReturns := fake.createBuildpackReturns fake.recordInvocation("CreateBuildpack", []interface{}{arg1}) fake.createBuildpackMutex.Unlock() - if fake.CreateBuildpackStub != nil { - return fake.CreateBuildpackStub(arg1) + if stub != nil { + return stub(arg1) } if specificReturn { return ret.result1, ret.result2, ret.result3 } - fakeReturns := fake.createBuildpackReturns return fakeReturns.result1, fakeReturns.result2, fakeReturns.result3 } @@ -3576,15 +3579,16 @@ func (fake *FakeCloudControllerClient) CreateDomain(arg1 resources.Domain) (reso fake.createDomainArgsForCall = append(fake.createDomainArgsForCall, struct { arg1 resources.Domain }{arg1}) + stub := fake.CreateDomainStub + fakeReturns := fake.createDomainReturns fake.recordInvocation("CreateDomain", []interface{}{arg1}) fake.createDomainMutex.Unlock() - if fake.CreateDomainStub != nil { - return fake.CreateDomainStub(arg1) + if stub != nil { + return stub(arg1) } if specificReturn { return ret.result1, ret.result2, ret.result3 } - fakeReturns := fake.createDomainReturns return fakeReturns.result1, fakeReturns.result2, fakeReturns.result3 } @@ -3642,15 +3646,16 @@ func (fake *FakeCloudControllerClient) CreateDroplet(arg1 string) (resources.Dro fake.createDropletArgsForCall = append(fake.createDropletArgsForCall, struct { arg1 string }{arg1}) + stub := fake.CreateDropletStub + fakeReturns := fake.createDropletReturns fake.recordInvocation("CreateDroplet", []interface{}{arg1}) fake.createDropletMutex.Unlock() - if fake.CreateDropletStub != nil { - return fake.CreateDropletStub(arg1) + if stub != nil { + return stub(arg1) } if specificReturn { return ret.result1, ret.result2, ret.result3 } - fakeReturns := fake.createDropletReturns return fakeReturns.result1, fakeReturns.result2, fakeReturns.result3 } @@ -3708,15 +3713,16 @@ func (fake *FakeCloudControllerClient) CreateIsolationSegment(arg1 resources.Iso fake.createIsolationSegmentArgsForCall = append(fake.createIsolationSegmentArgsForCall, struct { arg1 resources.IsolationSegment }{arg1}) + stub := fake.CreateIsolationSegmentStub + fakeReturns := fake.createIsolationSegmentReturns fake.recordInvocation("CreateIsolationSegment", []interface{}{arg1}) fake.createIsolationSegmentMutex.Unlock() - if fake.CreateIsolationSegmentStub != nil { - return fake.CreateIsolationSegmentStub(arg1) + if stub != nil { + return stub(arg1) } if specificReturn { return ret.result1, ret.result2, ret.result3 } - fakeReturns := fake.createIsolationSegmentReturns return fakeReturns.result1, fakeReturns.result2, fakeReturns.result3 } @@ -3774,15 +3780,16 @@ func (fake *FakeCloudControllerClient) CreateOrganization(arg1 string) (resource fake.createOrganizationArgsForCall = append(fake.createOrganizationArgsForCall, struct { arg1 string }{arg1}) + stub := fake.CreateOrganizationStub + fakeReturns := fake.createOrganizationReturns fake.recordInvocation("CreateOrganization", []interface{}{arg1}) fake.createOrganizationMutex.Unlock() - if fake.CreateOrganizationStub != nil { - return fake.CreateOrganizationStub(arg1) + if stub != nil { + return stub(arg1) } if specificReturn { return ret.result1, ret.result2, ret.result3 } - fakeReturns := fake.createOrganizationReturns return fakeReturns.result1, fakeReturns.result2, fakeReturns.result3 } @@ -3840,15 +3847,16 @@ func (fake *FakeCloudControllerClient) CreateOrganizationQuota(arg1 resources.Or fake.createOrganizationQuotaArgsForCall = append(fake.createOrganizationQuotaArgsForCall, struct { arg1 resources.OrganizationQuota }{arg1}) + stub := fake.CreateOrganizationQuotaStub + fakeReturns := fake.createOrganizationQuotaReturns fake.recordInvocation("CreateOrganizationQuota", []interface{}{arg1}) fake.createOrganizationQuotaMutex.Unlock() - if fake.CreateOrganizationQuotaStub != nil { - return fake.CreateOrganizationQuotaStub(arg1) + if stub != nil { + return stub(arg1) } if specificReturn { return ret.result1, ret.result2, ret.result3 } - fakeReturns := fake.createOrganizationQuotaReturns return fakeReturns.result1, fakeReturns.result2, fakeReturns.result3 } @@ -3906,15 +3914,16 @@ func (fake *FakeCloudControllerClient) CreatePackage(arg1 resources.Package) (re fake.createPackageArgsForCall = append(fake.createPackageArgsForCall, struct { arg1 resources.Package }{arg1}) + stub := fake.CreatePackageStub + fakeReturns := fake.createPackageReturns fake.recordInvocation("CreatePackage", []interface{}{arg1}) fake.createPackageMutex.Unlock() - if fake.CreatePackageStub != nil { - return fake.CreatePackageStub(arg1) + if stub != nil { + return stub(arg1) } if specificReturn { return ret.result1, ret.result2, ret.result3 } - fakeReturns := fake.createPackageReturns return fakeReturns.result1, fakeReturns.result2, fakeReturns.result3 } @@ -3972,15 +3981,16 @@ func (fake *FakeCloudControllerClient) CreateRole(arg1 resources.Role) (resource fake.createRoleArgsForCall = append(fake.createRoleArgsForCall, struct { arg1 resources.Role }{arg1}) + stub := fake.CreateRoleStub + fakeReturns := fake.createRoleReturns fake.recordInvocation("CreateRole", []interface{}{arg1}) fake.createRoleMutex.Unlock() - if fake.CreateRoleStub != nil { - return fake.CreateRoleStub(arg1) + if stub != nil { + return stub(arg1) } if specificReturn { return ret.result1, ret.result2, ret.result3 } - fakeReturns := fake.createRoleReturns return fakeReturns.result1, fakeReturns.result2, fakeReturns.result3 } @@ -4038,15 +4048,16 @@ func (fake *FakeCloudControllerClient) CreateRoute(arg1 resources.Route) (resour fake.createRouteArgsForCall = append(fake.createRouteArgsForCall, struct { arg1 resources.Route }{arg1}) + stub := fake.CreateRouteStub + fakeReturns := fake.createRouteReturns fake.recordInvocation("CreateRoute", []interface{}{arg1}) fake.createRouteMutex.Unlock() - if fake.CreateRouteStub != nil { - return fake.CreateRouteStub(arg1) + if stub != nil { + return stub(arg1) } if specificReturn { return ret.result1, ret.result2, ret.result3 } - fakeReturns := fake.createRouteReturns return fakeReturns.result1, fakeReturns.result2, fakeReturns.result3 } @@ -4104,15 +4115,16 @@ func (fake *FakeCloudControllerClient) CreateRouteBinding(arg1 resources.RouteBi fake.createRouteBindingArgsForCall = append(fake.createRouteBindingArgsForCall, struct { arg1 resources.RouteBinding }{arg1}) + stub := fake.CreateRouteBindingStub + fakeReturns := fake.createRouteBindingReturns fake.recordInvocation("CreateRouteBinding", []interface{}{arg1}) fake.createRouteBindingMutex.Unlock() - if fake.CreateRouteBindingStub != nil { - return fake.CreateRouteBindingStub(arg1) + if stub != nil { + return stub(arg1) } if specificReturn { return ret.result1, ret.result2, ret.result3 } - fakeReturns := fake.createRouteBindingReturns return fakeReturns.result1, fakeReturns.result2, fakeReturns.result3 } @@ -4170,15 +4182,16 @@ func (fake *FakeCloudControllerClient) CreateSecurityGroup(arg1 resources.Securi fake.createSecurityGroupArgsForCall = append(fake.createSecurityGroupArgsForCall, struct { arg1 resources.SecurityGroup }{arg1}) + stub := fake.CreateSecurityGroupStub + fakeReturns := fake.createSecurityGroupReturns fake.recordInvocation("CreateSecurityGroup", []interface{}{arg1}) fake.createSecurityGroupMutex.Unlock() - if fake.CreateSecurityGroupStub != nil { - return fake.CreateSecurityGroupStub(arg1) + if stub != nil { + return stub(arg1) } if specificReturn { return ret.result1, ret.result2, ret.result3 } - fakeReturns := fake.createSecurityGroupReturns return fakeReturns.result1, fakeReturns.result2, fakeReturns.result3 } @@ -4236,15 +4249,16 @@ func (fake *FakeCloudControllerClient) CreateServiceBroker(arg1 resources.Servic fake.createServiceBrokerArgsForCall = append(fake.createServiceBrokerArgsForCall, struct { arg1 resources.ServiceBroker }{arg1}) + stub := fake.CreateServiceBrokerStub + fakeReturns := fake.createServiceBrokerReturns fake.recordInvocation("CreateServiceBroker", []interface{}{arg1}) fake.createServiceBrokerMutex.Unlock() - if fake.CreateServiceBrokerStub != nil { - return fake.CreateServiceBrokerStub(arg1) + if stub != nil { + return stub(arg1) } if specificReturn { return ret.result1, ret.result2, ret.result3 } - fakeReturns := fake.createServiceBrokerReturns return fakeReturns.result1, fakeReturns.result2, fakeReturns.result3 } @@ -4302,15 +4316,16 @@ func (fake *FakeCloudControllerClient) CreateServiceCredentialBinding(arg1 resou fake.createServiceCredentialBindingArgsForCall = append(fake.createServiceCredentialBindingArgsForCall, struct { arg1 resources.ServiceCredentialBinding }{arg1}) + stub := fake.CreateServiceCredentialBindingStub + fakeReturns := fake.createServiceCredentialBindingReturns fake.recordInvocation("CreateServiceCredentialBinding", []interface{}{arg1}) fake.createServiceCredentialBindingMutex.Unlock() - if fake.CreateServiceCredentialBindingStub != nil { - return fake.CreateServiceCredentialBindingStub(arg1) + if stub != nil { + return stub(arg1) } if specificReturn { return ret.result1, ret.result2, ret.result3 } - fakeReturns := fake.createServiceCredentialBindingReturns return fakeReturns.result1, fakeReturns.result2, fakeReturns.result3 } @@ -4368,15 +4383,16 @@ func (fake *FakeCloudControllerClient) CreateServiceInstance(arg1 resources.Serv fake.createServiceInstanceArgsForCall = append(fake.createServiceInstanceArgsForCall, struct { arg1 resources.ServiceInstance }{arg1}) + stub := fake.CreateServiceInstanceStub + fakeReturns := fake.createServiceInstanceReturns fake.recordInvocation("CreateServiceInstance", []interface{}{arg1}) fake.createServiceInstanceMutex.Unlock() - if fake.CreateServiceInstanceStub != nil { - return fake.CreateServiceInstanceStub(arg1) + if stub != nil { + return stub(arg1) } if specificReturn { return ret.result1, ret.result2, ret.result3 } - fakeReturns := fake.createServiceInstanceReturns return fakeReturns.result1, fakeReturns.result2, fakeReturns.result3 } @@ -4434,15 +4450,16 @@ func (fake *FakeCloudControllerClient) CreateSpace(arg1 resources.Space) (resour fake.createSpaceArgsForCall = append(fake.createSpaceArgsForCall, struct { arg1 resources.Space }{arg1}) + stub := fake.CreateSpaceStub + fakeReturns := fake.createSpaceReturns fake.recordInvocation("CreateSpace", []interface{}{arg1}) fake.createSpaceMutex.Unlock() - if fake.CreateSpaceStub != nil { - return fake.CreateSpaceStub(arg1) + if stub != nil { + return stub(arg1) } if specificReturn { return ret.result1, ret.result2, ret.result3 } - fakeReturns := fake.createSpaceReturns return fakeReturns.result1, fakeReturns.result2, fakeReturns.result3 } @@ -4500,15 +4517,16 @@ func (fake *FakeCloudControllerClient) CreateSpaceQuota(arg1 resources.SpaceQuot fake.createSpaceQuotaArgsForCall = append(fake.createSpaceQuotaArgsForCall, struct { arg1 resources.SpaceQuota }{arg1}) + stub := fake.CreateSpaceQuotaStub + fakeReturns := fake.createSpaceQuotaReturns fake.recordInvocation("CreateSpaceQuota", []interface{}{arg1}) fake.createSpaceQuotaMutex.Unlock() - if fake.CreateSpaceQuotaStub != nil { - return fake.CreateSpaceQuotaStub(arg1) + if stub != nil { + return stub(arg1) } if specificReturn { return ret.result1, ret.result2, ret.result3 } - fakeReturns := fake.createSpaceQuotaReturns return fakeReturns.result1, fakeReturns.result2, fakeReturns.result3 } @@ -4566,15 +4584,16 @@ func (fake *FakeCloudControllerClient) CreateUser(arg1 string) (resources.User, fake.createUserArgsForCall = append(fake.createUserArgsForCall, struct { arg1 string }{arg1}) + stub := fake.CreateUserStub + fakeReturns := fake.createUserReturns fake.recordInvocation("CreateUser", []interface{}{arg1}) fake.createUserMutex.Unlock() - if fake.CreateUserStub != nil { - return fake.CreateUserStub(arg1) + if stub != nil { + return stub(arg1) } if specificReturn { return ret.result1, ret.result2, ret.result3 } - fakeReturns := fake.createUserReturns return fakeReturns.result1, fakeReturns.result2, fakeReturns.result3 } @@ -4632,15 +4651,16 @@ func (fake *FakeCloudControllerClient) DeleteApplication(arg1 string) (ccv3.JobU fake.deleteApplicationArgsForCall = append(fake.deleteApplicationArgsForCall, struct { arg1 string }{arg1}) + stub := fake.DeleteApplicationStub + fakeReturns := fake.deleteApplicationReturns fake.recordInvocation("DeleteApplication", []interface{}{arg1}) fake.deleteApplicationMutex.Unlock() - if fake.DeleteApplicationStub != nil { - return fake.DeleteApplicationStub(arg1) + if stub != nil { + return stub(arg1) } if specificReturn { return ret.result1, ret.result2, ret.result3 } - fakeReturns := fake.deleteApplicationReturns return fakeReturns.result1, fakeReturns.result2, fakeReturns.result3 } @@ -4700,15 +4720,16 @@ func (fake *FakeCloudControllerClient) DeleteApplicationProcessInstance(arg1 str arg2 string arg3 int }{arg1, arg2, arg3}) + stub := fake.DeleteApplicationProcessInstanceStub + fakeReturns := fake.deleteApplicationProcessInstanceReturns fake.recordInvocation("DeleteApplicationProcessInstance", []interface{}{arg1, arg2, arg3}) fake.deleteApplicationProcessInstanceMutex.Unlock() - if fake.DeleteApplicationProcessInstanceStub != nil { - return fake.DeleteApplicationProcessInstanceStub(arg1, arg2, arg3) + if stub != nil { + return stub(arg1, arg2, arg3) } if specificReturn { return ret.result1, ret.result2 } - fakeReturns := fake.deleteApplicationProcessInstanceReturns return fakeReturns.result1, fakeReturns.result2 } @@ -4763,15 +4784,16 @@ func (fake *FakeCloudControllerClient) DeleteBuildpack(arg1 string) (ccv3.JobURL fake.deleteBuildpackArgsForCall = append(fake.deleteBuildpackArgsForCall, struct { arg1 string }{arg1}) + stub := fake.DeleteBuildpackStub + fakeReturns := fake.deleteBuildpackReturns fake.recordInvocation("DeleteBuildpack", []interface{}{arg1}) fake.deleteBuildpackMutex.Unlock() - if fake.DeleteBuildpackStub != nil { - return fake.DeleteBuildpackStub(arg1) + if stub != nil { + return stub(arg1) } if specificReturn { return ret.result1, ret.result2, ret.result3 } - fakeReturns := fake.deleteBuildpackReturns return fakeReturns.result1, fakeReturns.result2, fakeReturns.result3 } @@ -4829,15 +4851,16 @@ func (fake *FakeCloudControllerClient) DeleteDomain(arg1 string) (ccv3.JobURL, c fake.deleteDomainArgsForCall = append(fake.deleteDomainArgsForCall, struct { arg1 string }{arg1}) + stub := fake.DeleteDomainStub + fakeReturns := fake.deleteDomainReturns fake.recordInvocation("DeleteDomain", []interface{}{arg1}) fake.deleteDomainMutex.Unlock() - if fake.DeleteDomainStub != nil { - return fake.DeleteDomainStub(arg1) + if stub != nil { + return stub(arg1) } if specificReturn { return ret.result1, ret.result2, ret.result3 } - fakeReturns := fake.deleteDomainReturns return fakeReturns.result1, fakeReturns.result2, fakeReturns.result3 } @@ -4895,15 +4918,16 @@ func (fake *FakeCloudControllerClient) DeleteIsolationSegment(arg1 string) (ccv3 fake.deleteIsolationSegmentArgsForCall = append(fake.deleteIsolationSegmentArgsForCall, struct { arg1 string }{arg1}) + stub := fake.DeleteIsolationSegmentStub + fakeReturns := fake.deleteIsolationSegmentReturns fake.recordInvocation("DeleteIsolationSegment", []interface{}{arg1}) fake.deleteIsolationSegmentMutex.Unlock() - if fake.DeleteIsolationSegmentStub != nil { - return fake.DeleteIsolationSegmentStub(arg1) + if stub != nil { + return stub(arg1) } if specificReturn { return ret.result1, ret.result2 } - fakeReturns := fake.deleteIsolationSegmentReturns return fakeReturns.result1, fakeReturns.result2 } @@ -4959,15 +4983,16 @@ func (fake *FakeCloudControllerClient) DeleteIsolationSegmentOrganization(arg1 s arg1 string arg2 string }{arg1, arg2}) + stub := fake.DeleteIsolationSegmentOrganizationStub + fakeReturns := fake.deleteIsolationSegmentOrganizationReturns fake.recordInvocation("DeleteIsolationSegmentOrganization", []interface{}{arg1, arg2}) fake.deleteIsolationSegmentOrganizationMutex.Unlock() - if fake.DeleteIsolationSegmentOrganizationStub != nil { - return fake.DeleteIsolationSegmentOrganizationStub(arg1, arg2) + if stub != nil { + return stub(arg1, arg2) } if specificReturn { return ret.result1, ret.result2 } - fakeReturns := fake.deleteIsolationSegmentOrganizationReturns return fakeReturns.result1, fakeReturns.result2 } @@ -5022,15 +5047,16 @@ func (fake *FakeCloudControllerClient) DeleteOrganization(arg1 string) (ccv3.Job fake.deleteOrganizationArgsForCall = append(fake.deleteOrganizationArgsForCall, struct { arg1 string }{arg1}) + stub := fake.DeleteOrganizationStub + fakeReturns := fake.deleteOrganizationReturns fake.recordInvocation("DeleteOrganization", []interface{}{arg1}) fake.deleteOrganizationMutex.Unlock() - if fake.DeleteOrganizationStub != nil { - return fake.DeleteOrganizationStub(arg1) + if stub != nil { + return stub(arg1) } if specificReturn { return ret.result1, ret.result2, ret.result3 } - fakeReturns := fake.deleteOrganizationReturns return fakeReturns.result1, fakeReturns.result2, fakeReturns.result3 } @@ -5088,15 +5114,16 @@ func (fake *FakeCloudControllerClient) DeleteOrganizationQuota(arg1 string) (ccv fake.deleteOrganizationQuotaArgsForCall = append(fake.deleteOrganizationQuotaArgsForCall, struct { arg1 string }{arg1}) + stub := fake.DeleteOrganizationQuotaStub + fakeReturns := fake.deleteOrganizationQuotaReturns fake.recordInvocation("DeleteOrganizationQuota", []interface{}{arg1}) fake.deleteOrganizationQuotaMutex.Unlock() - if fake.DeleteOrganizationQuotaStub != nil { - return fake.DeleteOrganizationQuotaStub(arg1) + if stub != nil { + return stub(arg1) } if specificReturn { return ret.result1, ret.result2, ret.result3 } - fakeReturns := fake.deleteOrganizationQuotaReturns return fakeReturns.result1, fakeReturns.result2, fakeReturns.result3 } @@ -5154,15 +5181,16 @@ func (fake *FakeCloudControllerClient) DeleteOrphanedRoutes(arg1 string) (ccv3.J fake.deleteOrphanedRoutesArgsForCall = append(fake.deleteOrphanedRoutesArgsForCall, struct { arg1 string }{arg1}) + stub := fake.DeleteOrphanedRoutesStub + fakeReturns := fake.deleteOrphanedRoutesReturns fake.recordInvocation("DeleteOrphanedRoutes", []interface{}{arg1}) fake.deleteOrphanedRoutesMutex.Unlock() - if fake.DeleteOrphanedRoutesStub != nil { - return fake.DeleteOrphanedRoutesStub(arg1) + if stub != nil { + return stub(arg1) } if specificReturn { return ret.result1, ret.result2, ret.result3 } - fakeReturns := fake.deleteOrphanedRoutesReturns return fakeReturns.result1, fakeReturns.result2, fakeReturns.result3 } @@ -5220,15 +5248,16 @@ func (fake *FakeCloudControllerClient) DeleteRole(arg1 string) (ccv3.JobURL, ccv fake.deleteRoleArgsForCall = append(fake.deleteRoleArgsForCall, struct { arg1 string }{arg1}) + stub := fake.DeleteRoleStub + fakeReturns := fake.deleteRoleReturns fake.recordInvocation("DeleteRole", []interface{}{arg1}) fake.deleteRoleMutex.Unlock() - if fake.DeleteRoleStub != nil { - return fake.DeleteRoleStub(arg1) + if stub != nil { + return stub(arg1) } if specificReturn { return ret.result1, ret.result2, ret.result3 } - fakeReturns := fake.deleteRoleReturns return fakeReturns.result1, fakeReturns.result2, fakeReturns.result3 } @@ -5286,15 +5315,16 @@ func (fake *FakeCloudControllerClient) DeleteRoute(arg1 string) (ccv3.JobURL, cc fake.deleteRouteArgsForCall = append(fake.deleteRouteArgsForCall, struct { arg1 string }{arg1}) + stub := fake.DeleteRouteStub + fakeReturns := fake.deleteRouteReturns fake.recordInvocation("DeleteRoute", []interface{}{arg1}) fake.deleteRouteMutex.Unlock() - if fake.DeleteRouteStub != nil { - return fake.DeleteRouteStub(arg1) + if stub != nil { + return stub(arg1) } if specificReturn { return ret.result1, ret.result2, ret.result3 } - fakeReturns := fake.deleteRouteReturns return fakeReturns.result1, fakeReturns.result2, fakeReturns.result3 } @@ -5352,15 +5382,16 @@ func (fake *FakeCloudControllerClient) DeleteRouteBinding(arg1 string) (ccv3.Job fake.deleteRouteBindingArgsForCall = append(fake.deleteRouteBindingArgsForCall, struct { arg1 string }{arg1}) + stub := fake.DeleteRouteBindingStub + fakeReturns := fake.deleteRouteBindingReturns fake.recordInvocation("DeleteRouteBinding", []interface{}{arg1}) fake.deleteRouteBindingMutex.Unlock() - if fake.DeleteRouteBindingStub != nil { - return fake.DeleteRouteBindingStub(arg1) + if stub != nil { + return stub(arg1) } if specificReturn { return ret.result1, ret.result2, ret.result3 } - fakeReturns := fake.deleteRouteBindingReturns return fakeReturns.result1, fakeReturns.result2, fakeReturns.result3 } @@ -5418,15 +5449,16 @@ func (fake *FakeCloudControllerClient) DeleteSecurityGroup(arg1 string) (ccv3.Jo fake.deleteSecurityGroupArgsForCall = append(fake.deleteSecurityGroupArgsForCall, struct { arg1 string }{arg1}) + stub := fake.DeleteSecurityGroupStub + fakeReturns := fake.deleteSecurityGroupReturns fake.recordInvocation("DeleteSecurityGroup", []interface{}{arg1}) fake.deleteSecurityGroupMutex.Unlock() - if fake.DeleteSecurityGroupStub != nil { - return fake.DeleteSecurityGroupStub(arg1) + if stub != nil { + return stub(arg1) } if specificReturn { return ret.result1, ret.result2, ret.result3 } - fakeReturns := fake.deleteSecurityGroupReturns return fakeReturns.result1, fakeReturns.result2, fakeReturns.result3 } @@ -5484,15 +5516,16 @@ func (fake *FakeCloudControllerClient) DeleteServiceBroker(arg1 string) (ccv3.Jo fake.deleteServiceBrokerArgsForCall = append(fake.deleteServiceBrokerArgsForCall, struct { arg1 string }{arg1}) + stub := fake.DeleteServiceBrokerStub + fakeReturns := fake.deleteServiceBrokerReturns fake.recordInvocation("DeleteServiceBroker", []interface{}{arg1}) fake.deleteServiceBrokerMutex.Unlock() - if fake.DeleteServiceBrokerStub != nil { - return fake.DeleteServiceBrokerStub(arg1) + if stub != nil { + return stub(arg1) } if specificReturn { return ret.result1, ret.result2, ret.result3 } - fakeReturns := fake.deleteServiceBrokerReturns return fakeReturns.result1, fakeReturns.result2, fakeReturns.result3 } @@ -5550,15 +5583,16 @@ func (fake *FakeCloudControllerClient) DeleteServiceCredentialBinding(arg1 strin fake.deleteServiceCredentialBindingArgsForCall = append(fake.deleteServiceCredentialBindingArgsForCall, struct { arg1 string }{arg1}) + stub := fake.DeleteServiceCredentialBindingStub + fakeReturns := fake.deleteServiceCredentialBindingReturns fake.recordInvocation("DeleteServiceCredentialBinding", []interface{}{arg1}) fake.deleteServiceCredentialBindingMutex.Unlock() - if fake.DeleteServiceCredentialBindingStub != nil { - return fake.DeleteServiceCredentialBindingStub(arg1) + if stub != nil { + return stub(arg1) } if specificReturn { return ret.result1, ret.result2, ret.result3 } - fakeReturns := fake.deleteServiceCredentialBindingReturns return fakeReturns.result1, fakeReturns.result2, fakeReturns.result3 } @@ -5617,15 +5651,16 @@ func (fake *FakeCloudControllerClient) DeleteServiceInstance(arg1 string, arg2 . arg1 string arg2 []ccv3.Query }{arg1, arg2}) + stub := fake.DeleteServiceInstanceStub + fakeReturns := fake.deleteServiceInstanceReturns fake.recordInvocation("DeleteServiceInstance", []interface{}{arg1, arg2}) fake.deleteServiceInstanceMutex.Unlock() - if fake.DeleteServiceInstanceStub != nil { - return fake.DeleteServiceInstanceStub(arg1, arg2...) + if stub != nil { + return stub(arg1, arg2...) } if specificReturn { return ret.result1, ret.result2, ret.result3 } - fakeReturns := fake.deleteServiceInstanceReturns return fakeReturns.result1, fakeReturns.result2, fakeReturns.result3 } @@ -5684,15 +5719,16 @@ func (fake *FakeCloudControllerClient) DeleteServicePlanVisibility(arg1 string, arg1 string arg2 string }{arg1, arg2}) + stub := fake.DeleteServicePlanVisibilityStub + fakeReturns := fake.deleteServicePlanVisibilityReturns fake.recordInvocation("DeleteServicePlanVisibility", []interface{}{arg1, arg2}) fake.deleteServicePlanVisibilityMutex.Unlock() - if fake.DeleteServicePlanVisibilityStub != nil { - return fake.DeleteServicePlanVisibilityStub(arg1, arg2) + if stub != nil { + return stub(arg1, arg2) } if specificReturn { return ret.result1, ret.result2 } - fakeReturns := fake.deleteServicePlanVisibilityReturns return fakeReturns.result1, fakeReturns.result2 } @@ -5747,15 +5783,16 @@ func (fake *FakeCloudControllerClient) DeleteSpace(arg1 string) (ccv3.JobURL, cc fake.deleteSpaceArgsForCall = append(fake.deleteSpaceArgsForCall, struct { arg1 string }{arg1}) + stub := fake.DeleteSpaceStub + fakeReturns := fake.deleteSpaceReturns fake.recordInvocation("DeleteSpace", []interface{}{arg1}) fake.deleteSpaceMutex.Unlock() - if fake.DeleteSpaceStub != nil { - return fake.DeleteSpaceStub(arg1) + if stub != nil { + return stub(arg1) } if specificReturn { return ret.result1, ret.result2, ret.result3 } - fakeReturns := fake.deleteSpaceReturns return fakeReturns.result1, fakeReturns.result2, fakeReturns.result3 } @@ -5813,15 +5850,16 @@ func (fake *FakeCloudControllerClient) DeleteSpaceQuota(arg1 string) (ccv3.JobUR fake.deleteSpaceQuotaArgsForCall = append(fake.deleteSpaceQuotaArgsForCall, struct { arg1 string }{arg1}) + stub := fake.DeleteSpaceQuotaStub + fakeReturns := fake.deleteSpaceQuotaReturns fake.recordInvocation("DeleteSpaceQuota", []interface{}{arg1}) fake.deleteSpaceQuotaMutex.Unlock() - if fake.DeleteSpaceQuotaStub != nil { - return fake.DeleteSpaceQuotaStub(arg1) + if stub != nil { + return stub(arg1) } if specificReturn { return ret.result1, ret.result2, ret.result3 } - fakeReturns := fake.deleteSpaceQuotaReturns return fakeReturns.result1, fakeReturns.result2, fakeReturns.result3 } @@ -5879,15 +5917,16 @@ func (fake *FakeCloudControllerClient) DeleteUser(arg1 string) (ccv3.JobURL, ccv fake.deleteUserArgsForCall = append(fake.deleteUserArgsForCall, struct { arg1 string }{arg1}) + stub := fake.DeleteUserStub + fakeReturns := fake.deleteUserReturns fake.recordInvocation("DeleteUser", []interface{}{arg1}) fake.deleteUserMutex.Unlock() - if fake.DeleteUserStub != nil { - return fake.DeleteUserStub(arg1) + if stub != nil { + return stub(arg1) } if specificReturn { return ret.result1, ret.result2, ret.result3 } - fakeReturns := fake.deleteUserReturns return fakeReturns.result1, fakeReturns.result2, fakeReturns.result3 } @@ -5945,15 +5984,16 @@ func (fake *FakeCloudControllerClient) DownloadDroplet(arg1 string) ([]byte, ccv fake.downloadDropletArgsForCall = append(fake.downloadDropletArgsForCall, struct { arg1 string }{arg1}) + stub := fake.DownloadDropletStub + fakeReturns := fake.downloadDropletReturns fake.recordInvocation("DownloadDroplet", []interface{}{arg1}) fake.downloadDropletMutex.Unlock() - if fake.DownloadDropletStub != nil { - return fake.DownloadDropletStub(arg1) + if stub != nil { + return stub(arg1) } if specificReturn { return ret.result1, ret.result2, ret.result3 } - fakeReturns := fake.downloadDropletReturns return fakeReturns.result1, fakeReturns.result2, fakeReturns.result3 } @@ -6017,15 +6057,16 @@ func (fake *FakeCloudControllerClient) EntitleIsolationSegmentToOrganizations(ar arg1 string arg2 []string }{arg1, arg2Copy}) + stub := fake.EntitleIsolationSegmentToOrganizationsStub + fakeReturns := fake.entitleIsolationSegmentToOrganizationsReturns fake.recordInvocation("EntitleIsolationSegmentToOrganizations", []interface{}{arg1, arg2Copy}) fake.entitleIsolationSegmentToOrganizationsMutex.Unlock() - if fake.EntitleIsolationSegmentToOrganizationsStub != nil { - return fake.EntitleIsolationSegmentToOrganizationsStub(arg1, arg2) + if stub != nil { + return stub(arg1, arg2) } if specificReturn { return ret.result1, ret.result2, ret.result3 } - fakeReturns := fake.entitleIsolationSegmentToOrganizationsReturns return fakeReturns.result1, fakeReturns.result2, fakeReturns.result3 } @@ -6084,15 +6125,16 @@ func (fake *FakeCloudControllerClient) GetAppFeature(arg1 string, arg2 string) ( arg1 string arg2 string }{arg1, arg2}) + stub := fake.GetAppFeatureStub + fakeReturns := fake.getAppFeatureReturns fake.recordInvocation("GetAppFeature", []interface{}{arg1, arg2}) fake.getAppFeatureMutex.Unlock() - if fake.GetAppFeatureStub != nil { - return fake.GetAppFeatureStub(arg1, arg2) + if stub != nil { + return stub(arg1, arg2) } if specificReturn { return ret.result1, ret.result2, ret.result3 } - fakeReturns := fake.getAppFeatureReturns return fakeReturns.result1, fakeReturns.result2, fakeReturns.result3 } @@ -6151,15 +6193,16 @@ func (fake *FakeCloudControllerClient) GetApplicationByNameAndSpace(arg1 string, arg1 string arg2 string }{arg1, arg2}) + stub := fake.GetApplicationByNameAndSpaceStub + fakeReturns := fake.getApplicationByNameAndSpaceReturns fake.recordInvocation("GetApplicationByNameAndSpace", []interface{}{arg1, arg2}) fake.getApplicationByNameAndSpaceMutex.Unlock() - if fake.GetApplicationByNameAndSpaceStub != nil { - return fake.GetApplicationByNameAndSpaceStub(arg1, arg2) + if stub != nil { + return stub(arg1, arg2) } if specificReturn { return ret.result1, ret.result2, ret.result3 } - fakeReturns := fake.getApplicationByNameAndSpaceReturns return fakeReturns.result1, fakeReturns.result2, fakeReturns.result3 } @@ -6217,15 +6260,16 @@ func (fake *FakeCloudControllerClient) GetApplicationDropletCurrent(arg1 string) fake.getApplicationDropletCurrentArgsForCall = append(fake.getApplicationDropletCurrentArgsForCall, struct { arg1 string }{arg1}) + stub := fake.GetApplicationDropletCurrentStub + fakeReturns := fake.getApplicationDropletCurrentReturns fake.recordInvocation("GetApplicationDropletCurrent", []interface{}{arg1}) fake.getApplicationDropletCurrentMutex.Unlock() - if fake.GetApplicationDropletCurrentStub != nil { - return fake.GetApplicationDropletCurrentStub(arg1) + if stub != nil { + return stub(arg1) } if specificReturn { return ret.result1, ret.result2, ret.result3 } - fakeReturns := fake.getApplicationDropletCurrentReturns return fakeReturns.result1, fakeReturns.result2, fakeReturns.result3 } @@ -6283,15 +6327,16 @@ func (fake *FakeCloudControllerClient) GetApplicationEnvironment(arg1 string) (c fake.getApplicationEnvironmentArgsForCall = append(fake.getApplicationEnvironmentArgsForCall, struct { arg1 string }{arg1}) + stub := fake.GetApplicationEnvironmentStub + fakeReturns := fake.getApplicationEnvironmentReturns fake.recordInvocation("GetApplicationEnvironment", []interface{}{arg1}) fake.getApplicationEnvironmentMutex.Unlock() - if fake.GetApplicationEnvironmentStub != nil { - return fake.GetApplicationEnvironmentStub(arg1) + if stub != nil { + return stub(arg1) } if specificReturn { return ret.result1, ret.result2, ret.result3 } - fakeReturns := fake.getApplicationEnvironmentReturns return fakeReturns.result1, fakeReturns.result2, fakeReturns.result3 } @@ -6349,15 +6394,16 @@ func (fake *FakeCloudControllerClient) GetApplicationManifest(arg1 string) ([]by fake.getApplicationManifestArgsForCall = append(fake.getApplicationManifestArgsForCall, struct { arg1 string }{arg1}) + stub := fake.GetApplicationManifestStub + fakeReturns := fake.getApplicationManifestReturns fake.recordInvocation("GetApplicationManifest", []interface{}{arg1}) fake.getApplicationManifestMutex.Unlock() - if fake.GetApplicationManifestStub != nil { - return fake.GetApplicationManifestStub(arg1) + if stub != nil { + return stub(arg1) } if specificReturn { return ret.result1, ret.result2, ret.result3 } - fakeReturns := fake.getApplicationManifestReturns return fakeReturns.result1, fakeReturns.result2, fakeReturns.result3 } @@ -6416,15 +6462,16 @@ func (fake *FakeCloudControllerClient) GetApplicationProcessByType(arg1 string, arg1 string arg2 string }{arg1, arg2}) + stub := fake.GetApplicationProcessByTypeStub + fakeReturns := fake.getApplicationProcessByTypeReturns fake.recordInvocation("GetApplicationProcessByType", []interface{}{arg1, arg2}) fake.getApplicationProcessByTypeMutex.Unlock() - if fake.GetApplicationProcessByTypeStub != nil { - return fake.GetApplicationProcessByTypeStub(arg1, arg2) + if stub != nil { + return stub(arg1, arg2) } if specificReturn { return ret.result1, ret.result2, ret.result3 } - fakeReturns := fake.getApplicationProcessByTypeReturns return fakeReturns.result1, fakeReturns.result2, fakeReturns.result3 } @@ -6482,15 +6529,16 @@ func (fake *FakeCloudControllerClient) GetApplicationProcesses(arg1 string) ([]r fake.getApplicationProcessesArgsForCall = append(fake.getApplicationProcessesArgsForCall, struct { arg1 string }{arg1}) + stub := fake.GetApplicationProcessesStub + fakeReturns := fake.getApplicationProcessesReturns fake.recordInvocation("GetApplicationProcesses", []interface{}{arg1}) fake.getApplicationProcessesMutex.Unlock() - if fake.GetApplicationProcessesStub != nil { - return fake.GetApplicationProcessesStub(arg1) + if stub != nil { + return stub(arg1) } if specificReturn { return ret.result1, ret.result2, ret.result3 } - fakeReturns := fake.getApplicationProcessesReturns return fakeReturns.result1, fakeReturns.result2, fakeReturns.result3 } @@ -6549,15 +6597,16 @@ func (fake *FakeCloudControllerClient) GetApplicationRevisions(arg1 string, arg2 arg1 string arg2 []ccv3.Query }{arg1, arg2}) + stub := fake.GetApplicationRevisionsStub + fakeReturns := fake.getApplicationRevisionsReturns fake.recordInvocation("GetApplicationRevisions", []interface{}{arg1, arg2}) fake.getApplicationRevisionsMutex.Unlock() - if fake.GetApplicationRevisionsStub != nil { - return fake.GetApplicationRevisionsStub(arg1, arg2...) + if stub != nil { + return stub(arg1, arg2...) } if specificReturn { return ret.result1, ret.result2, ret.result3 } - fakeReturns := fake.getApplicationRevisionsReturns return fakeReturns.result1, fakeReturns.result2, fakeReturns.result3 } @@ -6615,15 +6664,16 @@ func (fake *FakeCloudControllerClient) GetApplicationRevisionsDeployed(arg1 stri fake.getApplicationRevisionsDeployedArgsForCall = append(fake.getApplicationRevisionsDeployedArgsForCall, struct { arg1 string }{arg1}) + stub := fake.GetApplicationRevisionsDeployedStub + fakeReturns := fake.getApplicationRevisionsDeployedReturns fake.recordInvocation("GetApplicationRevisionsDeployed", []interface{}{arg1}) fake.getApplicationRevisionsDeployedMutex.Unlock() - if fake.GetApplicationRevisionsDeployedStub != nil { - return fake.GetApplicationRevisionsDeployedStub(arg1) + if stub != nil { + return stub(arg1) } if specificReturn { return ret.result1, ret.result2, ret.result3 } - fakeReturns := fake.getApplicationRevisionsDeployedReturns return fakeReturns.result1, fakeReturns.result2, fakeReturns.result3 } @@ -6681,15 +6731,16 @@ func (fake *FakeCloudControllerClient) GetApplicationRoutes(arg1 string) ([]reso fake.getApplicationRoutesArgsForCall = append(fake.getApplicationRoutesArgsForCall, struct { arg1 string }{arg1}) + stub := fake.GetApplicationRoutesStub + fakeReturns := fake.getApplicationRoutesReturns fake.recordInvocation("GetApplicationRoutes", []interface{}{arg1}) fake.getApplicationRoutesMutex.Unlock() - if fake.GetApplicationRoutesStub != nil { - return fake.GetApplicationRoutesStub(arg1) + if stub != nil { + return stub(arg1) } if specificReturn { return ret.result1, ret.result2, ret.result3 } - fakeReturns := fake.getApplicationRoutesReturns return fakeReturns.result1, fakeReturns.result2, fakeReturns.result3 } @@ -6748,15 +6799,16 @@ func (fake *FakeCloudControllerClient) GetApplicationTasks(arg1 string, arg2 ... arg1 string arg2 []ccv3.Query }{arg1, arg2}) + stub := fake.GetApplicationTasksStub + fakeReturns := fake.getApplicationTasksReturns fake.recordInvocation("GetApplicationTasks", []interface{}{arg1, arg2}) fake.getApplicationTasksMutex.Unlock() - if fake.GetApplicationTasksStub != nil { - return fake.GetApplicationTasksStub(arg1, arg2...) + if stub != nil { + return stub(arg1, arg2...) } if specificReturn { return ret.result1, ret.result2, ret.result3 } - fakeReturns := fake.getApplicationTasksReturns return fakeReturns.result1, fakeReturns.result2, fakeReturns.result3 } @@ -6814,15 +6866,16 @@ func (fake *FakeCloudControllerClient) GetApplications(arg1 ...ccv3.Query) ([]re fake.getApplicationsArgsForCall = append(fake.getApplicationsArgsForCall, struct { arg1 []ccv3.Query }{arg1}) + stub := fake.GetApplicationsStub + fakeReturns := fake.getApplicationsReturns fake.recordInvocation("GetApplications", []interface{}{arg1}) fake.getApplicationsMutex.Unlock() - if fake.GetApplicationsStub != nil { - return fake.GetApplicationsStub(arg1...) + if stub != nil { + return stub(arg1...) } if specificReturn { return ret.result1, ret.result2, ret.result3 } - fakeReturns := fake.getApplicationsReturns return fakeReturns.result1, fakeReturns.result2, fakeReturns.result3 } @@ -6880,15 +6933,16 @@ func (fake *FakeCloudControllerClient) GetBuild(arg1 string) (resources.Build, c fake.getBuildArgsForCall = append(fake.getBuildArgsForCall, struct { arg1 string }{arg1}) + stub := fake.GetBuildStub + fakeReturns := fake.getBuildReturns fake.recordInvocation("GetBuild", []interface{}{arg1}) fake.getBuildMutex.Unlock() - if fake.GetBuildStub != nil { - return fake.GetBuildStub(arg1) + if stub != nil { + return stub(arg1) } if specificReturn { return ret.result1, ret.result2, ret.result3 } - fakeReturns := fake.getBuildReturns return fakeReturns.result1, fakeReturns.result2, fakeReturns.result3 } @@ -6946,15 +7000,16 @@ func (fake *FakeCloudControllerClient) GetBuildpacks(arg1 ...ccv3.Query) ([]reso fake.getBuildpacksArgsForCall = append(fake.getBuildpacksArgsForCall, struct { arg1 []ccv3.Query }{arg1}) + stub := fake.GetBuildpacksStub + fakeReturns := fake.getBuildpacksReturns fake.recordInvocation("GetBuildpacks", []interface{}{arg1}) fake.getBuildpacksMutex.Unlock() - if fake.GetBuildpacksStub != nil { - return fake.GetBuildpacksStub(arg1...) + if stub != nil { + return stub(arg1...) } if specificReturn { return ret.result1, ret.result2, ret.result3 } - fakeReturns := fake.getBuildpacksReturns return fakeReturns.result1, fakeReturns.result2, fakeReturns.result3 } @@ -7012,15 +7067,16 @@ func (fake *FakeCloudControllerClient) GetDefaultDomain(arg1 string) (resources. fake.getDefaultDomainArgsForCall = append(fake.getDefaultDomainArgsForCall, struct { arg1 string }{arg1}) + stub := fake.GetDefaultDomainStub + fakeReturns := fake.getDefaultDomainReturns fake.recordInvocation("GetDefaultDomain", []interface{}{arg1}) fake.getDefaultDomainMutex.Unlock() - if fake.GetDefaultDomainStub != nil { - return fake.GetDefaultDomainStub(arg1) + if stub != nil { + return stub(arg1) } if specificReturn { return ret.result1, ret.result2, ret.result3 } - fakeReturns := fake.getDefaultDomainReturns return fakeReturns.result1, fakeReturns.result2, fakeReturns.result3 } @@ -7078,15 +7134,16 @@ func (fake *FakeCloudControllerClient) GetDeployment(arg1 string) (resources.Dep fake.getDeploymentArgsForCall = append(fake.getDeploymentArgsForCall, struct { arg1 string }{arg1}) + stub := fake.GetDeploymentStub + fakeReturns := fake.getDeploymentReturns fake.recordInvocation("GetDeployment", []interface{}{arg1}) fake.getDeploymentMutex.Unlock() - if fake.GetDeploymentStub != nil { - return fake.GetDeploymentStub(arg1) + if stub != nil { + return stub(arg1) } if specificReturn { return ret.result1, ret.result2, ret.result3 } - fakeReturns := fake.getDeploymentReturns return fakeReturns.result1, fakeReturns.result2, fakeReturns.result3 } @@ -7144,15 +7201,16 @@ func (fake *FakeCloudControllerClient) GetDeployments(arg1 ...ccv3.Query) ([]res fake.getDeploymentsArgsForCall = append(fake.getDeploymentsArgsForCall, struct { arg1 []ccv3.Query }{arg1}) + stub := fake.GetDeploymentsStub + fakeReturns := fake.getDeploymentsReturns fake.recordInvocation("GetDeployments", []interface{}{arg1}) fake.getDeploymentsMutex.Unlock() - if fake.GetDeploymentsStub != nil { - return fake.GetDeploymentsStub(arg1...) + if stub != nil { + return stub(arg1...) } if specificReturn { return ret.result1, ret.result2, ret.result3 } - fakeReturns := fake.getDeploymentsReturns return fakeReturns.result1, fakeReturns.result2, fakeReturns.result3 } @@ -7210,15 +7268,16 @@ func (fake *FakeCloudControllerClient) GetDomain(arg1 string) (resources.Domain, fake.getDomainArgsForCall = append(fake.getDomainArgsForCall, struct { arg1 string }{arg1}) + stub := fake.GetDomainStub + fakeReturns := fake.getDomainReturns fake.recordInvocation("GetDomain", []interface{}{arg1}) fake.getDomainMutex.Unlock() - if fake.GetDomainStub != nil { - return fake.GetDomainStub(arg1) + if stub != nil { + return stub(arg1) } if specificReturn { return ret.result1, ret.result2, ret.result3 } - fakeReturns := fake.getDomainReturns return fakeReturns.result1, fakeReturns.result2, fakeReturns.result3 } @@ -7276,15 +7335,16 @@ func (fake *FakeCloudControllerClient) GetDomains(arg1 ...ccv3.Query) ([]resourc fake.getDomainsArgsForCall = append(fake.getDomainsArgsForCall, struct { arg1 []ccv3.Query }{arg1}) + stub := fake.GetDomainsStub + fakeReturns := fake.getDomainsReturns fake.recordInvocation("GetDomains", []interface{}{arg1}) fake.getDomainsMutex.Unlock() - if fake.GetDomainsStub != nil { - return fake.GetDomainsStub(arg1...) + if stub != nil { + return stub(arg1...) } if specificReturn { return ret.result1, ret.result2, ret.result3 } - fakeReturns := fake.getDomainsReturns return fakeReturns.result1, fakeReturns.result2, fakeReturns.result3 } @@ -7342,15 +7402,16 @@ func (fake *FakeCloudControllerClient) GetDroplet(arg1 string) (resources.Drople fake.getDropletArgsForCall = append(fake.getDropletArgsForCall, struct { arg1 string }{arg1}) + stub := fake.GetDropletStub + fakeReturns := fake.getDropletReturns fake.recordInvocation("GetDroplet", []interface{}{arg1}) fake.getDropletMutex.Unlock() - if fake.GetDropletStub != nil { - return fake.GetDropletStub(arg1) + if stub != nil { + return stub(arg1) } if specificReturn { return ret.result1, ret.result2, ret.result3 } - fakeReturns := fake.getDropletReturns return fakeReturns.result1, fakeReturns.result2, fakeReturns.result3 } @@ -7408,15 +7469,16 @@ func (fake *FakeCloudControllerClient) GetDroplets(arg1 ...ccv3.Query) ([]resour fake.getDropletsArgsForCall = append(fake.getDropletsArgsForCall, struct { arg1 []ccv3.Query }{arg1}) + stub := fake.GetDropletsStub + fakeReturns := fake.getDropletsReturns fake.recordInvocation("GetDroplets", []interface{}{arg1}) fake.getDropletsMutex.Unlock() - if fake.GetDropletsStub != nil { - return fake.GetDropletsStub(arg1...) + if stub != nil { + return stub(arg1...) } if specificReturn { return ret.result1, ret.result2, ret.result3 } - fakeReturns := fake.getDropletsReturns return fakeReturns.result1, fakeReturns.result2, fakeReturns.result3 } @@ -7474,15 +7536,16 @@ func (fake *FakeCloudControllerClient) GetEnvironmentVariableGroup(arg1 constant fake.getEnvironmentVariableGroupArgsForCall = append(fake.getEnvironmentVariableGroupArgsForCall, struct { arg1 constant.EnvironmentVariableGroupName }{arg1}) + stub := fake.GetEnvironmentVariableGroupStub + fakeReturns := fake.getEnvironmentVariableGroupReturns fake.recordInvocation("GetEnvironmentVariableGroup", []interface{}{arg1}) fake.getEnvironmentVariableGroupMutex.Unlock() - if fake.GetEnvironmentVariableGroupStub != nil { - return fake.GetEnvironmentVariableGroupStub(arg1) + if stub != nil { + return stub(arg1) } if specificReturn { return ret.result1, ret.result2, ret.result3 } - fakeReturns := fake.getEnvironmentVariableGroupReturns return fakeReturns.result1, fakeReturns.result2, fakeReturns.result3 } @@ -7540,15 +7603,16 @@ func (fake *FakeCloudControllerClient) GetEvents(arg1 ...ccv3.Query) ([]ccv3.Eve fake.getEventsArgsForCall = append(fake.getEventsArgsForCall, struct { arg1 []ccv3.Query }{arg1}) + stub := fake.GetEventsStub + fakeReturns := fake.getEventsReturns fake.recordInvocation("GetEvents", []interface{}{arg1}) fake.getEventsMutex.Unlock() - if fake.GetEventsStub != nil { - return fake.GetEventsStub(arg1...) + if stub != nil { + return stub(arg1...) } if specificReturn { return ret.result1, ret.result2, ret.result3 } - fakeReturns := fake.getEventsReturns return fakeReturns.result1, fakeReturns.result2, fakeReturns.result3 } @@ -7606,15 +7670,16 @@ func (fake *FakeCloudControllerClient) GetFeatureFlag(arg1 string) (resources.Fe fake.getFeatureFlagArgsForCall = append(fake.getFeatureFlagArgsForCall, struct { arg1 string }{arg1}) + stub := fake.GetFeatureFlagStub + fakeReturns := fake.getFeatureFlagReturns fake.recordInvocation("GetFeatureFlag", []interface{}{arg1}) fake.getFeatureFlagMutex.Unlock() - if fake.GetFeatureFlagStub != nil { - return fake.GetFeatureFlagStub(arg1) + if stub != nil { + return stub(arg1) } if specificReturn { return ret.result1, ret.result2, ret.result3 } - fakeReturns := fake.getFeatureFlagReturns return fakeReturns.result1, fakeReturns.result2, fakeReturns.result3 } @@ -7671,15 +7736,16 @@ func (fake *FakeCloudControllerClient) GetFeatureFlags() ([]resources.FeatureFla ret, specificReturn := fake.getFeatureFlagsReturnsOnCall[len(fake.getFeatureFlagsArgsForCall)] fake.getFeatureFlagsArgsForCall = append(fake.getFeatureFlagsArgsForCall, struct { }{}) + stub := fake.GetFeatureFlagsStub + fakeReturns := fake.getFeatureFlagsReturns fake.recordInvocation("GetFeatureFlags", []interface{}{}) fake.getFeatureFlagsMutex.Unlock() - if fake.GetFeatureFlagsStub != nil { - return fake.GetFeatureFlagsStub() + if stub != nil { + return stub() } if specificReturn { return ret.result1, ret.result2, ret.result3 } - fakeReturns := fake.getFeatureFlagsReturns return fakeReturns.result1, fakeReturns.result2, fakeReturns.result3 } @@ -7729,15 +7795,16 @@ func (fake *FakeCloudControllerClient) GetInfo() (ccv3.Info, ccv3.Warnings, erro ret, specificReturn := fake.getInfoReturnsOnCall[len(fake.getInfoArgsForCall)] fake.getInfoArgsForCall = append(fake.getInfoArgsForCall, struct { }{}) + stub := fake.GetInfoStub + fakeReturns := fake.getInfoReturns fake.recordInvocation("GetInfo", []interface{}{}) fake.getInfoMutex.Unlock() - if fake.GetInfoStub != nil { - return fake.GetInfoStub() + if stub != nil { + return stub() } if specificReturn { return ret.result1, ret.result2, ret.result3 } - fakeReturns := fake.getInfoReturns return fakeReturns.result1, fakeReturns.result2, fakeReturns.result3 } @@ -7788,15 +7855,16 @@ func (fake *FakeCloudControllerClient) GetIsolationSegment(arg1 string) (resourc fake.getIsolationSegmentArgsForCall = append(fake.getIsolationSegmentArgsForCall, struct { arg1 string }{arg1}) + stub := fake.GetIsolationSegmentStub + fakeReturns := fake.getIsolationSegmentReturns fake.recordInvocation("GetIsolationSegment", []interface{}{arg1}) fake.getIsolationSegmentMutex.Unlock() - if fake.GetIsolationSegmentStub != nil { - return fake.GetIsolationSegmentStub(arg1) + if stub != nil { + return stub(arg1) } if specificReturn { return ret.result1, ret.result2, ret.result3 } - fakeReturns := fake.getIsolationSegmentReturns return fakeReturns.result1, fakeReturns.result2, fakeReturns.result3 } @@ -7854,15 +7922,16 @@ func (fake *FakeCloudControllerClient) GetIsolationSegmentOrganizations(arg1 str fake.getIsolationSegmentOrganizationsArgsForCall = append(fake.getIsolationSegmentOrganizationsArgsForCall, struct { arg1 string }{arg1}) + stub := fake.GetIsolationSegmentOrganizationsStub + fakeReturns := fake.getIsolationSegmentOrganizationsReturns fake.recordInvocation("GetIsolationSegmentOrganizations", []interface{}{arg1}) fake.getIsolationSegmentOrganizationsMutex.Unlock() - if fake.GetIsolationSegmentOrganizationsStub != nil { - return fake.GetIsolationSegmentOrganizationsStub(arg1) + if stub != nil { + return stub(arg1) } if specificReturn { return ret.result1, ret.result2, ret.result3 } - fakeReturns := fake.getIsolationSegmentOrganizationsReturns return fakeReturns.result1, fakeReturns.result2, fakeReturns.result3 } @@ -7920,15 +7989,16 @@ func (fake *FakeCloudControllerClient) GetIsolationSegments(arg1 ...ccv3.Query) fake.getIsolationSegmentsArgsForCall = append(fake.getIsolationSegmentsArgsForCall, struct { arg1 []ccv3.Query }{arg1}) + stub := fake.GetIsolationSegmentsStub + fakeReturns := fake.getIsolationSegmentsReturns fake.recordInvocation("GetIsolationSegments", []interface{}{arg1}) fake.getIsolationSegmentsMutex.Unlock() - if fake.GetIsolationSegmentsStub != nil { - return fake.GetIsolationSegmentsStub(arg1...) + if stub != nil { + return stub(arg1...) } if specificReturn { return ret.result1, ret.result2, ret.result3 } - fakeReturns := fake.getIsolationSegmentsReturns return fakeReturns.result1, fakeReturns.result2, fakeReturns.result3 } @@ -7987,15 +8057,16 @@ func (fake *FakeCloudControllerClient) GetNewApplicationProcesses(arg1 string, a arg1 string arg2 string }{arg1, arg2}) + stub := fake.GetNewApplicationProcessesStub + fakeReturns := fake.getNewApplicationProcessesReturns fake.recordInvocation("GetNewApplicationProcesses", []interface{}{arg1, arg2}) fake.getNewApplicationProcessesMutex.Unlock() - if fake.GetNewApplicationProcessesStub != nil { - return fake.GetNewApplicationProcessesStub(arg1, arg2) + if stub != nil { + return stub(arg1, arg2) } if specificReturn { return ret.result1, ret.result2, ret.result3 } - fakeReturns := fake.getNewApplicationProcessesReturns return fakeReturns.result1, fakeReturns.result2, fakeReturns.result3 } @@ -8053,15 +8124,16 @@ func (fake *FakeCloudControllerClient) GetOrganization(arg1 string) (resources.O fake.getOrganizationArgsForCall = append(fake.getOrganizationArgsForCall, struct { arg1 string }{arg1}) + stub := fake.GetOrganizationStub + fakeReturns := fake.getOrganizationReturns fake.recordInvocation("GetOrganization", []interface{}{arg1}) fake.getOrganizationMutex.Unlock() - if fake.GetOrganizationStub != nil { - return fake.GetOrganizationStub(arg1) + if stub != nil { + return stub(arg1) } if specificReturn { return ret.result1, ret.result2, ret.result3 } - fakeReturns := fake.getOrganizationReturns return fakeReturns.result1, fakeReturns.result2, fakeReturns.result3 } @@ -8119,15 +8191,16 @@ func (fake *FakeCloudControllerClient) GetOrganizationDefaultIsolationSegment(ar fake.getOrganizationDefaultIsolationSegmentArgsForCall = append(fake.getOrganizationDefaultIsolationSegmentArgsForCall, struct { arg1 string }{arg1}) + stub := fake.GetOrganizationDefaultIsolationSegmentStub + fakeReturns := fake.getOrganizationDefaultIsolationSegmentReturns fake.recordInvocation("GetOrganizationDefaultIsolationSegment", []interface{}{arg1}) fake.getOrganizationDefaultIsolationSegmentMutex.Unlock() - if fake.GetOrganizationDefaultIsolationSegmentStub != nil { - return fake.GetOrganizationDefaultIsolationSegmentStub(arg1) + if stub != nil { + return stub(arg1) } if specificReturn { return ret.result1, ret.result2, ret.result3 } - fakeReturns := fake.getOrganizationDefaultIsolationSegmentReturns return fakeReturns.result1, fakeReturns.result2, fakeReturns.result3 } @@ -8186,15 +8259,16 @@ func (fake *FakeCloudControllerClient) GetOrganizationDomains(arg1 string, arg2 arg1 string arg2 []ccv3.Query }{arg1, arg2}) + stub := fake.GetOrganizationDomainsStub + fakeReturns := fake.getOrganizationDomainsReturns fake.recordInvocation("GetOrganizationDomains", []interface{}{arg1, arg2}) fake.getOrganizationDomainsMutex.Unlock() - if fake.GetOrganizationDomainsStub != nil { - return fake.GetOrganizationDomainsStub(arg1, arg2...) + if stub != nil { + return stub(arg1, arg2...) } if specificReturn { return ret.result1, ret.result2, ret.result3 } - fakeReturns := fake.getOrganizationDomainsReturns return fakeReturns.result1, fakeReturns.result2, fakeReturns.result3 } @@ -8252,15 +8326,16 @@ func (fake *FakeCloudControllerClient) GetOrganizationQuota(arg1 string) (resour fake.getOrganizationQuotaArgsForCall = append(fake.getOrganizationQuotaArgsForCall, struct { arg1 string }{arg1}) + stub := fake.GetOrganizationQuotaStub + fakeReturns := fake.getOrganizationQuotaReturns fake.recordInvocation("GetOrganizationQuota", []interface{}{arg1}) fake.getOrganizationQuotaMutex.Unlock() - if fake.GetOrganizationQuotaStub != nil { - return fake.GetOrganizationQuotaStub(arg1) + if stub != nil { + return stub(arg1) } if specificReturn { return ret.result1, ret.result2, ret.result3 } - fakeReturns := fake.getOrganizationQuotaReturns return fakeReturns.result1, fakeReturns.result2, fakeReturns.result3 } @@ -8318,15 +8393,16 @@ func (fake *FakeCloudControllerClient) GetOrganizationQuotas(arg1 ...ccv3.Query) fake.getOrganizationQuotasArgsForCall = append(fake.getOrganizationQuotasArgsForCall, struct { arg1 []ccv3.Query }{arg1}) + stub := fake.GetOrganizationQuotasStub + fakeReturns := fake.getOrganizationQuotasReturns fake.recordInvocation("GetOrganizationQuotas", []interface{}{arg1}) fake.getOrganizationQuotasMutex.Unlock() - if fake.GetOrganizationQuotasStub != nil { - return fake.GetOrganizationQuotasStub(arg1...) + if stub != nil { + return stub(arg1...) } if specificReturn { return ret.result1, ret.result2, ret.result3 } - fakeReturns := fake.getOrganizationQuotasReturns return fakeReturns.result1, fakeReturns.result2, fakeReturns.result3 } @@ -8384,15 +8460,16 @@ func (fake *FakeCloudControllerClient) GetOrganizations(arg1 ...ccv3.Query) ([]r fake.getOrganizationsArgsForCall = append(fake.getOrganizationsArgsForCall, struct { arg1 []ccv3.Query }{arg1}) + stub := fake.GetOrganizationsStub + fakeReturns := fake.getOrganizationsReturns fake.recordInvocation("GetOrganizations", []interface{}{arg1}) fake.getOrganizationsMutex.Unlock() - if fake.GetOrganizationsStub != nil { - return fake.GetOrganizationsStub(arg1...) + if stub != nil { + return stub(arg1...) } if specificReturn { return ret.result1, ret.result2, ret.result3 } - fakeReturns := fake.getOrganizationsReturns return fakeReturns.result1, fakeReturns.result2, fakeReturns.result3 } @@ -8450,15 +8527,16 @@ func (fake *FakeCloudControllerClient) GetPackage(arg1 string) (resources.Packag fake.getPackageArgsForCall = append(fake.getPackageArgsForCall, struct { arg1 string }{arg1}) + stub := fake.GetPackageStub + fakeReturns := fake.getPackageReturns fake.recordInvocation("GetPackage", []interface{}{arg1}) fake.getPackageMutex.Unlock() - if fake.GetPackageStub != nil { - return fake.GetPackageStub(arg1) + if stub != nil { + return stub(arg1) } if specificReturn { return ret.result1, ret.result2, ret.result3 } - fakeReturns := fake.getPackageReturns return fakeReturns.result1, fakeReturns.result2, fakeReturns.result3 } @@ -8517,15 +8595,16 @@ func (fake *FakeCloudControllerClient) GetPackageDroplets(arg1 string, arg2 ...c arg1 string arg2 []ccv3.Query }{arg1, arg2}) + stub := fake.GetPackageDropletsStub + fakeReturns := fake.getPackageDropletsReturns fake.recordInvocation("GetPackageDroplets", []interface{}{arg1, arg2}) fake.getPackageDropletsMutex.Unlock() - if fake.GetPackageDropletsStub != nil { - return fake.GetPackageDropletsStub(arg1, arg2...) + if stub != nil { + return stub(arg1, arg2...) } if specificReturn { return ret.result1, ret.result2, ret.result3 } - fakeReturns := fake.getPackageDropletsReturns return fakeReturns.result1, fakeReturns.result2, fakeReturns.result3 } @@ -8583,15 +8662,16 @@ func (fake *FakeCloudControllerClient) GetPackages(arg1 ...ccv3.Query) ([]resour fake.getPackagesArgsForCall = append(fake.getPackagesArgsForCall, struct { arg1 []ccv3.Query }{arg1}) + stub := fake.GetPackagesStub + fakeReturns := fake.getPackagesReturns fake.recordInvocation("GetPackages", []interface{}{arg1}) fake.getPackagesMutex.Unlock() - if fake.GetPackagesStub != nil { - return fake.GetPackagesStub(arg1...) + if stub != nil { + return stub(arg1...) } if specificReturn { return ret.result1, ret.result2, ret.result3 } - fakeReturns := fake.getPackagesReturns return fakeReturns.result1, fakeReturns.result2, fakeReturns.result3 } @@ -8649,15 +8729,16 @@ func (fake *FakeCloudControllerClient) GetProcess(arg1 string) (resources.Proces fake.getProcessArgsForCall = append(fake.getProcessArgsForCall, struct { arg1 string }{arg1}) + stub := fake.GetProcessStub + fakeReturns := fake.getProcessReturns fake.recordInvocation("GetProcess", []interface{}{arg1}) fake.getProcessMutex.Unlock() - if fake.GetProcessStub != nil { - return fake.GetProcessStub(arg1) + if stub != nil { + return stub(arg1) } if specificReturn { return ret.result1, ret.result2, ret.result3 } - fakeReturns := fake.getProcessReturns return fakeReturns.result1, fakeReturns.result2, fakeReturns.result3 } @@ -8715,15 +8796,16 @@ func (fake *FakeCloudControllerClient) GetProcessInstances(arg1 string) ([]ccv3. fake.getProcessInstancesArgsForCall = append(fake.getProcessInstancesArgsForCall, struct { arg1 string }{arg1}) + stub := fake.GetProcessInstancesStub + fakeReturns := fake.getProcessInstancesReturns fake.recordInvocation("GetProcessInstances", []interface{}{arg1}) fake.getProcessInstancesMutex.Unlock() - if fake.GetProcessInstancesStub != nil { - return fake.GetProcessInstancesStub(arg1) + if stub != nil { + return stub(arg1) } if specificReturn { return ret.result1, ret.result2, ret.result3 } - fakeReturns := fake.getProcessInstancesReturns return fakeReturns.result1, fakeReturns.result2, fakeReturns.result3 } @@ -8781,15 +8863,16 @@ func (fake *FakeCloudControllerClient) GetProcessSidecars(arg1 string) ([]resour fake.getProcessSidecarsArgsForCall = append(fake.getProcessSidecarsArgsForCall, struct { arg1 string }{arg1}) + stub := fake.GetProcessSidecarsStub + fakeReturns := fake.getProcessSidecarsReturns fake.recordInvocation("GetProcessSidecars", []interface{}{arg1}) fake.getProcessSidecarsMutex.Unlock() - if fake.GetProcessSidecarsStub != nil { - return fake.GetProcessSidecarsStub(arg1) + if stub != nil { + return stub(arg1) } if specificReturn { return ret.result1, ret.result2, ret.result3 } - fakeReturns := fake.getProcessSidecarsReturns return fakeReturns.result1, fakeReturns.result2, fakeReturns.result3 } @@ -8847,15 +8930,16 @@ func (fake *FakeCloudControllerClient) GetProcesses(arg1 ...ccv3.Query) ([]resou fake.getProcessesArgsForCall = append(fake.getProcessesArgsForCall, struct { arg1 []ccv3.Query }{arg1}) + stub := fake.GetProcessesStub + fakeReturns := fake.getProcessesReturns fake.recordInvocation("GetProcesses", []interface{}{arg1}) fake.getProcessesMutex.Unlock() - if fake.GetProcessesStub != nil { - return fake.GetProcessesStub(arg1...) + if stub != nil { + return stub(arg1...) } if specificReturn { return ret.result1, ret.result2, ret.result3 } - fakeReturns := fake.getProcessesReturns return fakeReturns.result1, fakeReturns.result2, fakeReturns.result3 } @@ -8913,15 +8997,16 @@ func (fake *FakeCloudControllerClient) GetRoles(arg1 ...ccv3.Query) ([]resources fake.getRolesArgsForCall = append(fake.getRolesArgsForCall, struct { arg1 []ccv3.Query }{arg1}) + stub := fake.GetRolesStub + fakeReturns := fake.getRolesReturns fake.recordInvocation("GetRoles", []interface{}{arg1}) fake.getRolesMutex.Unlock() - if fake.GetRolesStub != nil { - return fake.GetRolesStub(arg1...) + if stub != nil { + return stub(arg1...) } if specificReturn { return ret.result1, ret.result2, ret.result3, ret.result4 } - fakeReturns := fake.getRolesReturns return fakeReturns.result1, fakeReturns.result2, fakeReturns.result3, fakeReturns.result4 } @@ -8982,15 +9067,16 @@ func (fake *FakeCloudControllerClient) GetRouteBindings(arg1 ...ccv3.Query) ([]r fake.getRouteBindingsArgsForCall = append(fake.getRouteBindingsArgsForCall, struct { arg1 []ccv3.Query }{arg1}) + stub := fake.GetRouteBindingsStub + fakeReturns := fake.getRouteBindingsReturns fake.recordInvocation("GetRouteBindings", []interface{}{arg1}) fake.getRouteBindingsMutex.Unlock() - if fake.GetRouteBindingsStub != nil { - return fake.GetRouteBindingsStub(arg1...) + if stub != nil { + return stub(arg1...) } if specificReturn { return ret.result1, ret.result2, ret.result3, ret.result4 } - fakeReturns := fake.getRouteBindingsReturns return fakeReturns.result1, fakeReturns.result2, fakeReturns.result3, fakeReturns.result4 } @@ -9051,15 +9137,16 @@ func (fake *FakeCloudControllerClient) GetRouteDestinations(arg1 string) ([]reso fake.getRouteDestinationsArgsForCall = append(fake.getRouteDestinationsArgsForCall, struct { arg1 string }{arg1}) + stub := fake.GetRouteDestinationsStub + fakeReturns := fake.getRouteDestinationsReturns fake.recordInvocation("GetRouteDestinations", []interface{}{arg1}) fake.getRouteDestinationsMutex.Unlock() - if fake.GetRouteDestinationsStub != nil { - return fake.GetRouteDestinationsStub(arg1) + if stub != nil { + return stub(arg1) } if specificReturn { return ret.result1, ret.result2, ret.result3 } - fakeReturns := fake.getRouteDestinationsReturns return fakeReturns.result1, fakeReturns.result2, fakeReturns.result3 } @@ -9117,15 +9204,16 @@ func (fake *FakeCloudControllerClient) GetRoutes(arg1 ...ccv3.Query) ([]resource fake.getRoutesArgsForCall = append(fake.getRoutesArgsForCall, struct { arg1 []ccv3.Query }{arg1}) + stub := fake.GetRoutesStub + fakeReturns := fake.getRoutesReturns fake.recordInvocation("GetRoutes", []interface{}{arg1}) fake.getRoutesMutex.Unlock() - if fake.GetRoutesStub != nil { - return fake.GetRoutesStub(arg1...) + if stub != nil { + return stub(arg1...) } if specificReturn { return ret.result1, ret.result2, ret.result3 } - fakeReturns := fake.getRoutesReturns return fakeReturns.result1, fakeReturns.result2, fakeReturns.result3 } @@ -9184,15 +9272,16 @@ func (fake *FakeCloudControllerClient) GetRunningSecurityGroups(arg1 string, arg arg1 string arg2 []ccv3.Query }{arg1, arg2}) + stub := fake.GetRunningSecurityGroupsStub + fakeReturns := fake.getRunningSecurityGroupsReturns fake.recordInvocation("GetRunningSecurityGroups", []interface{}{arg1, arg2}) fake.getRunningSecurityGroupsMutex.Unlock() - if fake.GetRunningSecurityGroupsStub != nil { - return fake.GetRunningSecurityGroupsStub(arg1, arg2...) + if stub != nil { + return stub(arg1, arg2...) } if specificReturn { return ret.result1, ret.result2, ret.result3 } - fakeReturns := fake.getRunningSecurityGroupsReturns return fakeReturns.result1, fakeReturns.result2, fakeReturns.result3 } @@ -9250,15 +9339,16 @@ func (fake *FakeCloudControllerClient) GetSSHEnabled(arg1 string) (ccv3.SSHEnabl fake.getSSHEnabledArgsForCall = append(fake.getSSHEnabledArgsForCall, struct { arg1 string }{arg1}) + stub := fake.GetSSHEnabledStub + fakeReturns := fake.getSSHEnabledReturns fake.recordInvocation("GetSSHEnabled", []interface{}{arg1}) fake.getSSHEnabledMutex.Unlock() - if fake.GetSSHEnabledStub != nil { - return fake.GetSSHEnabledStub(arg1) + if stub != nil { + return stub(arg1) } if specificReturn { return ret.result1, ret.result2, ret.result3 } - fakeReturns := fake.getSSHEnabledReturns return fakeReturns.result1, fakeReturns.result2, fakeReturns.result3 } @@ -9316,15 +9406,16 @@ func (fake *FakeCloudControllerClient) GetSecurityGroups(arg1 ...ccv3.Query) ([] fake.getSecurityGroupsArgsForCall = append(fake.getSecurityGroupsArgsForCall, struct { arg1 []ccv3.Query }{arg1}) + stub := fake.GetSecurityGroupsStub + fakeReturns := fake.getSecurityGroupsReturns fake.recordInvocation("GetSecurityGroups", []interface{}{arg1}) fake.getSecurityGroupsMutex.Unlock() - if fake.GetSecurityGroupsStub != nil { - return fake.GetSecurityGroupsStub(arg1...) + if stub != nil { + return stub(arg1...) } if specificReturn { return ret.result1, ret.result2, ret.result3 } - fakeReturns := fake.getSecurityGroupsReturns return fakeReturns.result1, fakeReturns.result2, fakeReturns.result3 } @@ -9382,15 +9473,16 @@ func (fake *FakeCloudControllerClient) GetServiceBrokers(arg1 ...ccv3.Query) ([] fake.getServiceBrokersArgsForCall = append(fake.getServiceBrokersArgsForCall, struct { arg1 []ccv3.Query }{arg1}) + stub := fake.GetServiceBrokersStub + fakeReturns := fake.getServiceBrokersReturns fake.recordInvocation("GetServiceBrokers", []interface{}{arg1}) fake.getServiceBrokersMutex.Unlock() - if fake.GetServiceBrokersStub != nil { - return fake.GetServiceBrokersStub(arg1...) + if stub != nil { + return stub(arg1...) } if specificReturn { return ret.result1, ret.result2, ret.result3 } - fakeReturns := fake.getServiceBrokersReturns return fakeReturns.result1, fakeReturns.result2, fakeReturns.result3 } @@ -9448,15 +9540,16 @@ func (fake *FakeCloudControllerClient) GetServiceCredentialBindingDetails(arg1 s fake.getServiceCredentialBindingDetailsArgsForCall = append(fake.getServiceCredentialBindingDetailsArgsForCall, struct { arg1 string }{arg1}) + stub := fake.GetServiceCredentialBindingDetailsStub + fakeReturns := fake.getServiceCredentialBindingDetailsReturns fake.recordInvocation("GetServiceCredentialBindingDetails", []interface{}{arg1}) fake.getServiceCredentialBindingDetailsMutex.Unlock() - if fake.GetServiceCredentialBindingDetailsStub != nil { - return fake.GetServiceCredentialBindingDetailsStub(arg1) + if stub != nil { + return stub(arg1) } if specificReturn { return ret.result1, ret.result2, ret.result3 } - fakeReturns := fake.getServiceCredentialBindingDetailsReturns return fakeReturns.result1, fakeReturns.result2, fakeReturns.result3 } @@ -9514,15 +9607,16 @@ func (fake *FakeCloudControllerClient) GetServiceCredentialBindings(arg1 ...ccv3 fake.getServiceCredentialBindingsArgsForCall = append(fake.getServiceCredentialBindingsArgsForCall, struct { arg1 []ccv3.Query }{arg1}) + stub := fake.GetServiceCredentialBindingsStub + fakeReturns := fake.getServiceCredentialBindingsReturns fake.recordInvocation("GetServiceCredentialBindings", []interface{}{arg1}) fake.getServiceCredentialBindingsMutex.Unlock() - if fake.GetServiceCredentialBindingsStub != nil { - return fake.GetServiceCredentialBindingsStub(arg1...) + if stub != nil { + return stub(arg1...) } if specificReturn { return ret.result1, ret.result2, ret.result3 } - fakeReturns := fake.getServiceCredentialBindingsReturns return fakeReturns.result1, fakeReturns.result2, fakeReturns.result3 } @@ -9582,15 +9676,16 @@ func (fake *FakeCloudControllerClient) GetServiceInstanceByNameAndSpace(arg1 str arg2 string arg3 []ccv3.Query }{arg1, arg2, arg3}) + stub := fake.GetServiceInstanceByNameAndSpaceStub + fakeReturns := fake.getServiceInstanceByNameAndSpaceReturns fake.recordInvocation("GetServiceInstanceByNameAndSpace", []interface{}{arg1, arg2, arg3}) fake.getServiceInstanceByNameAndSpaceMutex.Unlock() - if fake.GetServiceInstanceByNameAndSpaceStub != nil { - return fake.GetServiceInstanceByNameAndSpaceStub(arg1, arg2, arg3...) + if stub != nil { + return stub(arg1, arg2, arg3...) } if specificReturn { return ret.result1, ret.result2, ret.result3, ret.result4 } - fakeReturns := fake.getServiceInstanceByNameAndSpaceReturns return fakeReturns.result1, fakeReturns.result2, fakeReturns.result3, fakeReturns.result4 } @@ -9651,15 +9746,16 @@ func (fake *FakeCloudControllerClient) GetServiceInstanceParameters(arg1 string) fake.getServiceInstanceParametersArgsForCall = append(fake.getServiceInstanceParametersArgsForCall, struct { arg1 string }{arg1}) + stub := fake.GetServiceInstanceParametersStub + fakeReturns := fake.getServiceInstanceParametersReturns fake.recordInvocation("GetServiceInstanceParameters", []interface{}{arg1}) fake.getServiceInstanceParametersMutex.Unlock() - if fake.GetServiceInstanceParametersStub != nil { - return fake.GetServiceInstanceParametersStub(arg1) + if stub != nil { + return stub(arg1) } if specificReturn { return ret.result1, ret.result2, ret.result3 } - fakeReturns := fake.getServiceInstanceParametersReturns return fakeReturns.result1, fakeReturns.result2, fakeReturns.result3 } @@ -9717,15 +9813,16 @@ func (fake *FakeCloudControllerClient) GetServiceInstanceSharedSpaces(arg1 strin fake.getServiceInstanceSharedSpacesArgsForCall = append(fake.getServiceInstanceSharedSpacesArgsForCall, struct { arg1 string }{arg1}) + stub := fake.GetServiceInstanceSharedSpacesStub + fakeReturns := fake.getServiceInstanceSharedSpacesReturns fake.recordInvocation("GetServiceInstanceSharedSpaces", []interface{}{arg1}) fake.getServiceInstanceSharedSpacesMutex.Unlock() - if fake.GetServiceInstanceSharedSpacesStub != nil { - return fake.GetServiceInstanceSharedSpacesStub(arg1) + if stub != nil { + return stub(arg1) } if specificReturn { return ret.result1, ret.result2, ret.result3 } - fakeReturns := fake.getServiceInstanceSharedSpacesReturns return fakeReturns.result1, fakeReturns.result2, fakeReturns.result3 } @@ -9783,15 +9880,16 @@ func (fake *FakeCloudControllerClient) GetServiceInstanceUsageSummary(arg1 strin fake.getServiceInstanceUsageSummaryArgsForCall = append(fake.getServiceInstanceUsageSummaryArgsForCall, struct { arg1 string }{arg1}) + stub := fake.GetServiceInstanceUsageSummaryStub + fakeReturns := fake.getServiceInstanceUsageSummaryReturns fake.recordInvocation("GetServiceInstanceUsageSummary", []interface{}{arg1}) fake.getServiceInstanceUsageSummaryMutex.Unlock() - if fake.GetServiceInstanceUsageSummaryStub != nil { - return fake.GetServiceInstanceUsageSummaryStub(arg1) + if stub != nil { + return stub(arg1) } if specificReturn { return ret.result1, ret.result2, ret.result3 } - fakeReturns := fake.getServiceInstanceUsageSummaryReturns return fakeReturns.result1, fakeReturns.result2, fakeReturns.result3 } @@ -9849,15 +9947,16 @@ func (fake *FakeCloudControllerClient) GetServiceInstances(arg1 ...ccv3.Query) ( fake.getServiceInstancesArgsForCall = append(fake.getServiceInstancesArgsForCall, struct { arg1 []ccv3.Query }{arg1}) + stub := fake.GetServiceInstancesStub + fakeReturns := fake.getServiceInstancesReturns fake.recordInvocation("GetServiceInstances", []interface{}{arg1}) fake.getServiceInstancesMutex.Unlock() - if fake.GetServiceInstancesStub != nil { - return fake.GetServiceInstancesStub(arg1...) + if stub != nil { + return stub(arg1...) } if specificReturn { return ret.result1, ret.result2, ret.result3, ret.result4 } - fakeReturns := fake.getServiceInstancesReturns return fakeReturns.result1, fakeReturns.result2, fakeReturns.result3, fakeReturns.result4 } @@ -9918,15 +10017,16 @@ func (fake *FakeCloudControllerClient) GetServiceOfferingByGUID(arg1 string) (re fake.getServiceOfferingByGUIDArgsForCall = append(fake.getServiceOfferingByGUIDArgsForCall, struct { arg1 string }{arg1}) + stub := fake.GetServiceOfferingByGUIDStub + fakeReturns := fake.getServiceOfferingByGUIDReturns fake.recordInvocation("GetServiceOfferingByGUID", []interface{}{arg1}) fake.getServiceOfferingByGUIDMutex.Unlock() - if fake.GetServiceOfferingByGUIDStub != nil { - return fake.GetServiceOfferingByGUIDStub(arg1) + if stub != nil { + return stub(arg1) } if specificReturn { return ret.result1, ret.result2, ret.result3 } - fakeReturns := fake.getServiceOfferingByGUIDReturns return fakeReturns.result1, fakeReturns.result2, fakeReturns.result3 } @@ -9985,15 +10085,16 @@ func (fake *FakeCloudControllerClient) GetServiceOfferingByNameAndBroker(arg1 st arg1 string arg2 string }{arg1, arg2}) + stub := fake.GetServiceOfferingByNameAndBrokerStub + fakeReturns := fake.getServiceOfferingByNameAndBrokerReturns fake.recordInvocation("GetServiceOfferingByNameAndBroker", []interface{}{arg1, arg2}) fake.getServiceOfferingByNameAndBrokerMutex.Unlock() - if fake.GetServiceOfferingByNameAndBrokerStub != nil { - return fake.GetServiceOfferingByNameAndBrokerStub(arg1, arg2) + if stub != nil { + return stub(arg1, arg2) } if specificReturn { return ret.result1, ret.result2, ret.result3 } - fakeReturns := fake.getServiceOfferingByNameAndBrokerReturns return fakeReturns.result1, fakeReturns.result2, fakeReturns.result3 } @@ -10051,15 +10152,16 @@ func (fake *FakeCloudControllerClient) GetServiceOfferings(arg1 ...ccv3.Query) ( fake.getServiceOfferingsArgsForCall = append(fake.getServiceOfferingsArgsForCall, struct { arg1 []ccv3.Query }{arg1}) + stub := fake.GetServiceOfferingsStub + fakeReturns := fake.getServiceOfferingsReturns fake.recordInvocation("GetServiceOfferings", []interface{}{arg1}) fake.getServiceOfferingsMutex.Unlock() - if fake.GetServiceOfferingsStub != nil { - return fake.GetServiceOfferingsStub(arg1...) + if stub != nil { + return stub(arg1...) } if specificReturn { return ret.result1, ret.result2, ret.result3 } - fakeReturns := fake.getServiceOfferingsReturns return fakeReturns.result1, fakeReturns.result2, fakeReturns.result3 } @@ -10117,15 +10219,16 @@ func (fake *FakeCloudControllerClient) GetServicePlanByGUID(arg1 string) (resour fake.getServicePlanByGUIDArgsForCall = append(fake.getServicePlanByGUIDArgsForCall, struct { arg1 string }{arg1}) + stub := fake.GetServicePlanByGUIDStub + fakeReturns := fake.getServicePlanByGUIDReturns fake.recordInvocation("GetServicePlanByGUID", []interface{}{arg1}) fake.getServicePlanByGUIDMutex.Unlock() - if fake.GetServicePlanByGUIDStub != nil { - return fake.GetServicePlanByGUIDStub(arg1) + if stub != nil { + return stub(arg1) } if specificReturn { return ret.result1, ret.result2, ret.result3 } - fakeReturns := fake.getServicePlanByGUIDReturns return fakeReturns.result1, fakeReturns.result2, fakeReturns.result3 } @@ -10183,15 +10286,16 @@ func (fake *FakeCloudControllerClient) GetServicePlanVisibility(arg1 string) (re fake.getServicePlanVisibilityArgsForCall = append(fake.getServicePlanVisibilityArgsForCall, struct { arg1 string }{arg1}) + stub := fake.GetServicePlanVisibilityStub + fakeReturns := fake.getServicePlanVisibilityReturns fake.recordInvocation("GetServicePlanVisibility", []interface{}{arg1}) fake.getServicePlanVisibilityMutex.Unlock() - if fake.GetServicePlanVisibilityStub != nil { - return fake.GetServicePlanVisibilityStub(arg1) + if stub != nil { + return stub(arg1) } if specificReturn { return ret.result1, ret.result2, ret.result3 } - fakeReturns := fake.getServicePlanVisibilityReturns return fakeReturns.result1, fakeReturns.result2, fakeReturns.result3 } @@ -10249,15 +10353,16 @@ func (fake *FakeCloudControllerClient) GetServicePlans(arg1 ...ccv3.Query) ([]re fake.getServicePlansArgsForCall = append(fake.getServicePlansArgsForCall, struct { arg1 []ccv3.Query }{arg1}) + stub := fake.GetServicePlansStub + fakeReturns := fake.getServicePlansReturns fake.recordInvocation("GetServicePlans", []interface{}{arg1}) fake.getServicePlansMutex.Unlock() - if fake.GetServicePlansStub != nil { - return fake.GetServicePlansStub(arg1...) + if stub != nil { + return stub(arg1...) } if specificReturn { return ret.result1, ret.result2, ret.result3 } - fakeReturns := fake.getServicePlansReturns return fakeReturns.result1, fakeReturns.result2, fakeReturns.result3 } @@ -10315,15 +10420,16 @@ func (fake *FakeCloudControllerClient) GetServicePlansWithOfferings(arg1 ...ccv3 fake.getServicePlansWithOfferingsArgsForCall = append(fake.getServicePlansWithOfferingsArgsForCall, struct { arg1 []ccv3.Query }{arg1}) + stub := fake.GetServicePlansWithOfferingsStub + fakeReturns := fake.getServicePlansWithOfferingsReturns fake.recordInvocation("GetServicePlansWithOfferings", []interface{}{arg1}) fake.getServicePlansWithOfferingsMutex.Unlock() - if fake.GetServicePlansWithOfferingsStub != nil { - return fake.GetServicePlansWithOfferingsStub(arg1...) + if stub != nil { + return stub(arg1...) } if specificReturn { return ret.result1, ret.result2, ret.result3 } - fakeReturns := fake.getServicePlansWithOfferingsReturns return fakeReturns.result1, fakeReturns.result2, fakeReturns.result3 } @@ -10381,15 +10487,16 @@ func (fake *FakeCloudControllerClient) GetServicePlansWithSpaceAndOrganization(a fake.getServicePlansWithSpaceAndOrganizationArgsForCall = append(fake.getServicePlansWithSpaceAndOrganizationArgsForCall, struct { arg1 []ccv3.Query }{arg1}) + stub := fake.GetServicePlansWithSpaceAndOrganizationStub + fakeReturns := fake.getServicePlansWithSpaceAndOrganizationReturns fake.recordInvocation("GetServicePlansWithSpaceAndOrganization", []interface{}{arg1}) fake.getServicePlansWithSpaceAndOrganizationMutex.Unlock() - if fake.GetServicePlansWithSpaceAndOrganizationStub != nil { - return fake.GetServicePlansWithSpaceAndOrganizationStub(arg1...) + if stub != nil { + return stub(arg1...) } if specificReturn { return ret.result1, ret.result2, ret.result3 } - fakeReturns := fake.getServicePlansWithSpaceAndOrganizationReturns return fakeReturns.result1, fakeReturns.result2, fakeReturns.result3 } @@ -10448,15 +10555,16 @@ func (fake *FakeCloudControllerClient) GetSpaceFeature(arg1 string, arg2 string) arg1 string arg2 string }{arg1, arg2}) + stub := fake.GetSpaceFeatureStub + fakeReturns := fake.getSpaceFeatureReturns fake.recordInvocation("GetSpaceFeature", []interface{}{arg1, arg2}) fake.getSpaceFeatureMutex.Unlock() - if fake.GetSpaceFeatureStub != nil { - return fake.GetSpaceFeatureStub(arg1, arg2) + if stub != nil { + return stub(arg1, arg2) } if specificReturn { return ret.result1, ret.result2, ret.result3 } - fakeReturns := fake.getSpaceFeatureReturns return fakeReturns.result1, fakeReturns.result2, fakeReturns.result3 } @@ -10514,15 +10622,16 @@ func (fake *FakeCloudControllerClient) GetSpaceIsolationSegment(arg1 string) (re fake.getSpaceIsolationSegmentArgsForCall = append(fake.getSpaceIsolationSegmentArgsForCall, struct { arg1 string }{arg1}) + stub := fake.GetSpaceIsolationSegmentStub + fakeReturns := fake.getSpaceIsolationSegmentReturns fake.recordInvocation("GetSpaceIsolationSegment", []interface{}{arg1}) fake.getSpaceIsolationSegmentMutex.Unlock() - if fake.GetSpaceIsolationSegmentStub != nil { - return fake.GetSpaceIsolationSegmentStub(arg1) + if stub != nil { + return stub(arg1) } if specificReturn { return ret.result1, ret.result2, ret.result3 } - fakeReturns := fake.getSpaceIsolationSegmentReturns return fakeReturns.result1, fakeReturns.result2, fakeReturns.result3 } @@ -10586,15 +10695,16 @@ func (fake *FakeCloudControllerClient) GetSpaceManifestDiff(arg1 string, arg2 [] arg1 string arg2 []byte }{arg1, arg2Copy}) + stub := fake.GetSpaceManifestDiffStub + fakeReturns := fake.getSpaceManifestDiffReturns fake.recordInvocation("GetSpaceManifestDiff", []interface{}{arg1, arg2Copy}) fake.getSpaceManifestDiffMutex.Unlock() - if fake.GetSpaceManifestDiffStub != nil { - return fake.GetSpaceManifestDiffStub(arg1, arg2) + if stub != nil { + return stub(arg1, arg2) } if specificReturn { return ret.result1, ret.result2, ret.result3 } - fakeReturns := fake.getSpaceManifestDiffReturns return fakeReturns.result1, fakeReturns.result2, fakeReturns.result3 } @@ -10652,15 +10762,16 @@ func (fake *FakeCloudControllerClient) GetSpaceQuota(arg1 string) (resources.Spa fake.getSpaceQuotaArgsForCall = append(fake.getSpaceQuotaArgsForCall, struct { arg1 string }{arg1}) + stub := fake.GetSpaceQuotaStub + fakeReturns := fake.getSpaceQuotaReturns fake.recordInvocation("GetSpaceQuota", []interface{}{arg1}) fake.getSpaceQuotaMutex.Unlock() - if fake.GetSpaceQuotaStub != nil { - return fake.GetSpaceQuotaStub(arg1) + if stub != nil { + return stub(arg1) } if specificReturn { return ret.result1, ret.result2, ret.result3 } - fakeReturns := fake.getSpaceQuotaReturns return fakeReturns.result1, fakeReturns.result2, fakeReturns.result3 } @@ -10718,15 +10829,16 @@ func (fake *FakeCloudControllerClient) GetSpaceQuotas(arg1 ...ccv3.Query) ([]res fake.getSpaceQuotasArgsForCall = append(fake.getSpaceQuotasArgsForCall, struct { arg1 []ccv3.Query }{arg1}) + stub := fake.GetSpaceQuotasStub + fakeReturns := fake.getSpaceQuotasReturns fake.recordInvocation("GetSpaceQuotas", []interface{}{arg1}) fake.getSpaceQuotasMutex.Unlock() - if fake.GetSpaceQuotasStub != nil { - return fake.GetSpaceQuotasStub(arg1...) + if stub != nil { + return stub(arg1...) } if specificReturn { return ret.result1, ret.result2, ret.result3 } - fakeReturns := fake.getSpaceQuotasReturns return fakeReturns.result1, fakeReturns.result2, fakeReturns.result3 } @@ -10784,15 +10896,16 @@ func (fake *FakeCloudControllerClient) GetSpaces(arg1 ...ccv3.Query) ([]resource fake.getSpacesArgsForCall = append(fake.getSpacesArgsForCall, struct { arg1 []ccv3.Query }{arg1}) + stub := fake.GetSpacesStub + fakeReturns := fake.getSpacesReturns fake.recordInvocation("GetSpaces", []interface{}{arg1}) fake.getSpacesMutex.Unlock() - if fake.GetSpacesStub != nil { - return fake.GetSpacesStub(arg1...) + if stub != nil { + return stub(arg1...) } if specificReturn { return ret.result1, ret.result2, ret.result3, ret.result4 } - fakeReturns := fake.getSpacesReturns return fakeReturns.result1, fakeReturns.result2, fakeReturns.result3, fakeReturns.result4 } @@ -10853,15 +10966,16 @@ func (fake *FakeCloudControllerClient) GetStacks(arg1 ...ccv3.Query) ([]resource fake.getStacksArgsForCall = append(fake.getStacksArgsForCall, struct { arg1 []ccv3.Query }{arg1}) + stub := fake.GetStacksStub + fakeReturns := fake.getStacksReturns fake.recordInvocation("GetStacks", []interface{}{arg1}) fake.getStacksMutex.Unlock() - if fake.GetStacksStub != nil { - return fake.GetStacksStub(arg1...) + if stub != nil { + return stub(arg1...) } if specificReturn { return ret.result1, ret.result2, ret.result3 } - fakeReturns := fake.getStacksReturns return fakeReturns.result1, fakeReturns.result2, fakeReturns.result3 } @@ -10920,15 +11034,16 @@ func (fake *FakeCloudControllerClient) GetStagingSecurityGroups(arg1 string, arg arg1 string arg2 []ccv3.Query }{arg1, arg2}) + stub := fake.GetStagingSecurityGroupsStub + fakeReturns := fake.getStagingSecurityGroupsReturns fake.recordInvocation("GetStagingSecurityGroups", []interface{}{arg1, arg2}) fake.getStagingSecurityGroupsMutex.Unlock() - if fake.GetStagingSecurityGroupsStub != nil { - return fake.GetStagingSecurityGroupsStub(arg1, arg2...) + if stub != nil { + return stub(arg1, arg2...) } if specificReturn { return ret.result1, ret.result2, ret.result3 } - fakeReturns := fake.getStagingSecurityGroupsReturns return fakeReturns.result1, fakeReturns.result2, fakeReturns.result3 } @@ -10986,15 +11101,16 @@ func (fake *FakeCloudControllerClient) GetTask(arg1 string) (resources.Task, ccv fake.getTaskArgsForCall = append(fake.getTaskArgsForCall, struct { arg1 string }{arg1}) + stub := fake.GetTaskStub + fakeReturns := fake.getTaskReturns fake.recordInvocation("GetTask", []interface{}{arg1}) fake.getTaskMutex.Unlock() - if fake.GetTaskStub != nil { - return fake.GetTaskStub(arg1) + if stub != nil { + return stub(arg1) } if specificReturn { return ret.result1, ret.result2, ret.result3 } - fakeReturns := fake.getTaskReturns return fakeReturns.result1, fakeReturns.result2, fakeReturns.result3 } @@ -11052,15 +11168,16 @@ func (fake *FakeCloudControllerClient) GetUser(arg1 string) (resources.User, ccv fake.getUserArgsForCall = append(fake.getUserArgsForCall, struct { arg1 string }{arg1}) + stub := fake.GetUserStub + fakeReturns := fake.getUserReturns fake.recordInvocation("GetUser", []interface{}{arg1}) fake.getUserMutex.Unlock() - if fake.GetUserStub != nil { - return fake.GetUserStub(arg1) + if stub != nil { + return stub(arg1) } if specificReturn { return ret.result1, ret.result2, ret.result3 } - fakeReturns := fake.getUserReturns return fakeReturns.result1, fakeReturns.result2, fakeReturns.result3 } @@ -11118,15 +11235,16 @@ func (fake *FakeCloudControllerClient) GetUsers(arg1 ...ccv3.Query) ([]resources fake.getUsersArgsForCall = append(fake.getUsersArgsForCall, struct { arg1 []ccv3.Query }{arg1}) + stub := fake.GetUsersStub + fakeReturns := fake.getUsersReturns fake.recordInvocation("GetUsers", []interface{}{arg1}) fake.getUsersMutex.Unlock() - if fake.GetUsersStub != nil { - return fake.GetUsersStub(arg1...) + if stub != nil { + return stub(arg1...) } if specificReturn { return ret.result1, ret.result2, ret.result3 } - fakeReturns := fake.getUsersReturns return fakeReturns.result1, fakeReturns.result2, fakeReturns.result3 } @@ -11192,15 +11310,16 @@ func (fake *FakeCloudControllerClient) MakeRequestSendReceiveRaw(arg1 string, ar arg3 http.Header arg4 []byte }{arg1, arg2, arg3, arg4Copy}) + stub := fake.MakeRequestSendReceiveRawStub + fakeReturns := fake.makeRequestSendReceiveRawReturns fake.recordInvocation("MakeRequestSendReceiveRaw", []interface{}{arg1, arg2, arg3, arg4Copy}) fake.makeRequestSendReceiveRawMutex.Unlock() - if fake.MakeRequestSendReceiveRawStub != nil { - return fake.MakeRequestSendReceiveRawStub(arg1, arg2, arg3, arg4) + if stub != nil { + return stub(arg1, arg2, arg3, arg4) } if specificReturn { return ret.result1, ret.result2, ret.result3 } - fakeReturns := fake.makeRequestSendReceiveRawReturns return fakeReturns.result1, fakeReturns.result2, fakeReturns.result3 } @@ -11260,15 +11379,16 @@ func (fake *FakeCloudControllerClient) MapRoute(arg1 string, arg2 string, arg3 s arg2 string arg3 string }{arg1, arg2, arg3}) + stub := fake.MapRouteStub + fakeReturns := fake.mapRouteReturns fake.recordInvocation("MapRoute", []interface{}{arg1, arg2, arg3}) fake.mapRouteMutex.Unlock() - if fake.MapRouteStub != nil { - return fake.MapRouteStub(arg1, arg2, arg3) + if stub != nil { + return stub(arg1, arg2, arg3) } if specificReturn { return ret.result1, ret.result2 } - fakeReturns := fake.mapRouteReturns return fakeReturns.result1, fakeReturns.result2 } @@ -11324,15 +11444,16 @@ func (fake *FakeCloudControllerClient) MoveRoute(arg1 string, arg2 string) (ccv3 arg1 string arg2 string }{arg1, arg2}) + stub := fake.MoveRouteStub + fakeReturns := fake.moveRouteReturns fake.recordInvocation("MoveRoute", []interface{}{arg1, arg2}) fake.moveRouteMutex.Unlock() - if fake.MoveRouteStub != nil { - return fake.MoveRouteStub(arg1, arg2) + if stub != nil { + return stub(arg1, arg2) } if specificReturn { return ret.result1, ret.result2 } - fakeReturns := fake.moveRouteReturns return fakeReturns.result1, fakeReturns.result2 } @@ -11387,15 +11508,16 @@ func (fake *FakeCloudControllerClient) PollJob(arg1 ccv3.JobURL) (ccv3.Warnings, fake.pollJobArgsForCall = append(fake.pollJobArgsForCall, struct { arg1 ccv3.JobURL }{arg1}) + stub := fake.PollJobStub + fakeReturns := fake.pollJobReturns fake.recordInvocation("PollJob", []interface{}{arg1}) fake.pollJobMutex.Unlock() - if fake.PollJobStub != nil { - return fake.PollJobStub(arg1) + if stub != nil { + return stub(arg1) } if specificReturn { return ret.result1, ret.result2 } - fakeReturns := fake.pollJobReturns return fakeReturns.result1, fakeReturns.result2 } @@ -11451,15 +11573,16 @@ func (fake *FakeCloudControllerClient) PollJobForState(arg1 ccv3.JobURL, arg2 co arg1 ccv3.JobURL arg2 constant.JobState }{arg1, arg2}) + stub := fake.PollJobForStateStub + fakeReturns := fake.pollJobForStateReturns fake.recordInvocation("PollJobForState", []interface{}{arg1, arg2}) fake.pollJobForStateMutex.Unlock() - if fake.PollJobForStateStub != nil { - return fake.PollJobForStateStub(arg1, arg2) + if stub != nil { + return stub(arg1, arg2) } if specificReturn { return ret.result1, ret.result2 } - fakeReturns := fake.pollJobForStateReturns return fakeReturns.result1, fakeReturns.result2 } @@ -11514,15 +11637,16 @@ func (fake *FakeCloudControllerClient) PollJobToEventStream(arg1 ccv3.JobURL) ch fake.pollJobToEventStreamArgsForCall = append(fake.pollJobToEventStreamArgsForCall, struct { arg1 ccv3.JobURL }{arg1}) + stub := fake.PollJobToEventStreamStub + fakeReturns := fake.pollJobToEventStreamReturns fake.recordInvocation("PollJobToEventStream", []interface{}{arg1}) fake.pollJobToEventStreamMutex.Unlock() - if fake.PollJobToEventStreamStub != nil { - return fake.PollJobToEventStreamStub(arg1) + if stub != nil { + return stub(arg1) } if specificReturn { return ret.result1 } - fakeReturns := fake.pollJobToEventStreamReturns return fakeReturns.result1 } @@ -11574,15 +11698,16 @@ func (fake *FakeCloudControllerClient) PurgeServiceOffering(arg1 string) (ccv3.W fake.purgeServiceOfferingArgsForCall = append(fake.purgeServiceOfferingArgsForCall, struct { arg1 string }{arg1}) + stub := fake.PurgeServiceOfferingStub + fakeReturns := fake.purgeServiceOfferingReturns fake.recordInvocation("PurgeServiceOffering", []interface{}{arg1}) fake.purgeServiceOfferingMutex.Unlock() - if fake.PurgeServiceOfferingStub != nil { - return fake.PurgeServiceOfferingStub(arg1) + if stub != nil { + return stub(arg1) } if specificReturn { return ret.result1, ret.result2 } - fakeReturns := fake.purgeServiceOfferingReturns return fakeReturns.result1, fakeReturns.result2 } @@ -11642,15 +11767,16 @@ func (fake *FakeCloudControllerClient) ResourceMatch(arg1 []ccv3.Resource) ([]cc fake.resourceMatchArgsForCall = append(fake.resourceMatchArgsForCall, struct { arg1 []ccv3.Resource }{arg1Copy}) + stub := fake.ResourceMatchStub + fakeReturns := fake.resourceMatchReturns fake.recordInvocation("ResourceMatch", []interface{}{arg1Copy}) fake.resourceMatchMutex.Unlock() - if fake.ResourceMatchStub != nil { - return fake.ResourceMatchStub(arg1) + if stub != nil { + return stub(arg1) } if specificReturn { return ret.result1, ret.result2, ret.result3 } - fakeReturns := fake.resourceMatchReturns return fakeReturns.result1, fakeReturns.result2, fakeReturns.result3 } @@ -11707,15 +11833,16 @@ func (fake *FakeCloudControllerClient) RootResponse() (ccv3.Info, ccv3.Warnings, ret, specificReturn := fake.rootResponseReturnsOnCall[len(fake.rootResponseArgsForCall)] fake.rootResponseArgsForCall = append(fake.rootResponseArgsForCall, struct { }{}) + stub := fake.RootResponseStub + fakeReturns := fake.rootResponseReturns fake.recordInvocation("RootResponse", []interface{}{}) fake.rootResponseMutex.Unlock() - if fake.RootResponseStub != nil { - return fake.RootResponseStub() + if stub != nil { + return stub() } if specificReturn { return ret.result1, ret.result2, ret.result3 } - fakeReturns := fake.rootResponseReturns return fakeReturns.result1, fakeReturns.result2, fakeReturns.result3 } @@ -11767,15 +11894,16 @@ func (fake *FakeCloudControllerClient) SetApplicationDroplet(arg1 string, arg2 s arg1 string arg2 string }{arg1, arg2}) + stub := fake.SetApplicationDropletStub + fakeReturns := fake.setApplicationDropletReturns fake.recordInvocation("SetApplicationDroplet", []interface{}{arg1, arg2}) fake.setApplicationDropletMutex.Unlock() - if fake.SetApplicationDropletStub != nil { - return fake.SetApplicationDropletStub(arg1, arg2) + if stub != nil { + return stub(arg1, arg2) } if specificReturn { return ret.result1, ret.result2, ret.result3 } - fakeReturns := fake.setApplicationDropletReturns return fakeReturns.result1, fakeReturns.result2, fakeReturns.result3 } @@ -11834,15 +11962,16 @@ func (fake *FakeCloudControllerClient) SharePrivateDomainToOrgs(arg1 string, arg arg1 string arg2 ccv3.SharedOrgs }{arg1, arg2}) + stub := fake.SharePrivateDomainToOrgsStub + fakeReturns := fake.sharePrivateDomainToOrgsReturns fake.recordInvocation("SharePrivateDomainToOrgs", []interface{}{arg1, arg2}) fake.sharePrivateDomainToOrgsMutex.Unlock() - if fake.SharePrivateDomainToOrgsStub != nil { - return fake.SharePrivateDomainToOrgsStub(arg1, arg2) + if stub != nil { + return stub(arg1, arg2) } if specificReturn { return ret.result1, ret.result2 } - fakeReturns := fake.sharePrivateDomainToOrgsReturns return fakeReturns.result1, fakeReturns.result2 } @@ -11898,15 +12027,16 @@ func (fake *FakeCloudControllerClient) ShareRoute(arg1 string, arg2 string) (ccv arg1 string arg2 string }{arg1, arg2}) + stub := fake.ShareRouteStub + fakeReturns := fake.shareRouteReturns fake.recordInvocation("ShareRoute", []interface{}{arg1, arg2}) fake.shareRouteMutex.Unlock() - if fake.ShareRouteStub != nil { - return fake.ShareRouteStub(arg1, arg2) + if stub != nil { + return stub(arg1, arg2) } if specificReturn { return ret.result1, ret.result2 } - fakeReturns := fake.shareRouteReturns return fakeReturns.result1, fakeReturns.result2 } @@ -11967,15 +12097,16 @@ func (fake *FakeCloudControllerClient) ShareServiceInstanceToSpaces(arg1 string, arg1 string arg2 []string }{arg1, arg2Copy}) + stub := fake.ShareServiceInstanceToSpacesStub + fakeReturns := fake.shareServiceInstanceToSpacesReturns fake.recordInvocation("ShareServiceInstanceToSpaces", []interface{}{arg1, arg2Copy}) fake.shareServiceInstanceToSpacesMutex.Unlock() - if fake.ShareServiceInstanceToSpacesStub != nil { - return fake.ShareServiceInstanceToSpacesStub(arg1, arg2) + if stub != nil { + return stub(arg1, arg2) } if specificReturn { return ret.result1, ret.result2, ret.result3 } - fakeReturns := fake.shareServiceInstanceToSpacesReturns return fakeReturns.result1, fakeReturns.result2, fakeReturns.result3 } @@ -12032,9 +12163,10 @@ func (fake *FakeCloudControllerClient) TargetCF(arg1 ccv3.TargetSettings) { fake.targetCFArgsForCall = append(fake.targetCFArgsForCall, struct { arg1 ccv3.TargetSettings }{arg1}) + stub := fake.TargetCFStub fake.recordInvocation("TargetCF", []interface{}{arg1}) fake.targetCFMutex.Unlock() - if fake.TargetCFStub != nil { + if stub != nil { fake.TargetCFStub(arg1) } } @@ -12065,15 +12197,16 @@ func (fake *FakeCloudControllerClient) UnbindSecurityGroupRunningSpace(arg1 stri arg1 string arg2 string }{arg1, arg2}) + stub := fake.UnbindSecurityGroupRunningSpaceStub + fakeReturns := fake.unbindSecurityGroupRunningSpaceReturns fake.recordInvocation("UnbindSecurityGroupRunningSpace", []interface{}{arg1, arg2}) fake.unbindSecurityGroupRunningSpaceMutex.Unlock() - if fake.UnbindSecurityGroupRunningSpaceStub != nil { - return fake.UnbindSecurityGroupRunningSpaceStub(arg1, arg2) + if stub != nil { + return stub(arg1, arg2) } if specificReturn { return ret.result1, ret.result2 } - fakeReturns := fake.unbindSecurityGroupRunningSpaceReturns return fakeReturns.result1, fakeReturns.result2 } @@ -12129,15 +12262,16 @@ func (fake *FakeCloudControllerClient) UnbindSecurityGroupStagingSpace(arg1 stri arg1 string arg2 string }{arg1, arg2}) + stub := fake.UnbindSecurityGroupStagingSpaceStub + fakeReturns := fake.unbindSecurityGroupStagingSpaceReturns fake.recordInvocation("UnbindSecurityGroupStagingSpace", []interface{}{arg1, arg2}) fake.unbindSecurityGroupStagingSpaceMutex.Unlock() - if fake.UnbindSecurityGroupStagingSpaceStub != nil { - return fake.UnbindSecurityGroupStagingSpaceStub(arg1, arg2) + if stub != nil { + return stub(arg1, arg2) } if specificReturn { return ret.result1, ret.result2 } - fakeReturns := fake.unbindSecurityGroupStagingSpaceReturns return fakeReturns.result1, fakeReturns.result2 } @@ -12193,15 +12327,16 @@ func (fake *FakeCloudControllerClient) UnmapRoute(arg1 string, arg2 string) (ccv arg1 string arg2 string }{arg1, arg2}) + stub := fake.UnmapRouteStub + fakeReturns := fake.unmapRouteReturns fake.recordInvocation("UnmapRoute", []interface{}{arg1, arg2}) fake.unmapRouteMutex.Unlock() - if fake.UnmapRouteStub != nil { - return fake.UnmapRouteStub(arg1, arg2) + if stub != nil { + return stub(arg1, arg2) } if specificReturn { return ret.result1, ret.result2 } - fakeReturns := fake.unmapRouteReturns return fakeReturns.result1, fakeReturns.result2 } @@ -12257,15 +12392,16 @@ func (fake *FakeCloudControllerClient) UnsetSpaceQuota(arg1 string, arg2 string) arg1 string arg2 string }{arg1, arg2}) + stub := fake.UnsetSpaceQuotaStub + fakeReturns := fake.unsetSpaceQuotaReturns fake.recordInvocation("UnsetSpaceQuota", []interface{}{arg1, arg2}) fake.unsetSpaceQuotaMutex.Unlock() - if fake.UnsetSpaceQuotaStub != nil { - return fake.UnsetSpaceQuotaStub(arg1, arg2) + if stub != nil { + return stub(arg1, arg2) } if specificReturn { return ret.result1, ret.result2 } - fakeReturns := fake.unsetSpaceQuotaReturns return fakeReturns.result1, fakeReturns.result2 } @@ -12321,15 +12457,16 @@ func (fake *FakeCloudControllerClient) UnsharePrivateDomainFromOrg(arg1 string, arg1 string arg2 string }{arg1, arg2}) + stub := fake.UnsharePrivateDomainFromOrgStub + fakeReturns := fake.unsharePrivateDomainFromOrgReturns fake.recordInvocation("UnsharePrivateDomainFromOrg", []interface{}{arg1, arg2}) fake.unsharePrivateDomainFromOrgMutex.Unlock() - if fake.UnsharePrivateDomainFromOrgStub != nil { - return fake.UnsharePrivateDomainFromOrgStub(arg1, arg2) + if stub != nil { + return stub(arg1, arg2) } if specificReturn { return ret.result1, ret.result2 } - fakeReturns := fake.unsharePrivateDomainFromOrgReturns return fakeReturns.result1, fakeReturns.result2 } @@ -12385,15 +12522,16 @@ func (fake *FakeCloudControllerClient) UnshareRoute(arg1 string, arg2 string) (c arg1 string arg2 string }{arg1, arg2}) + stub := fake.UnshareRouteStub + fakeReturns := fake.unshareRouteReturns fake.recordInvocation("UnshareRoute", []interface{}{arg1, arg2}) fake.unshareRouteMutex.Unlock() - if fake.UnshareRouteStub != nil { - return fake.UnshareRouteStub(arg1, arg2) + if stub != nil { + return stub(arg1, arg2) } if specificReturn { return ret.result1, ret.result2 } - fakeReturns := fake.unshareRouteReturns return fakeReturns.result1, fakeReturns.result2 } @@ -12449,15 +12587,16 @@ func (fake *FakeCloudControllerClient) UnshareServiceInstanceFromSpace(arg1 stri arg1 string arg2 string }{arg1, arg2}) + stub := fake.UnshareServiceInstanceFromSpaceStub + fakeReturns := fake.unshareServiceInstanceFromSpaceReturns fake.recordInvocation("UnshareServiceInstanceFromSpace", []interface{}{arg1, arg2}) fake.unshareServiceInstanceFromSpaceMutex.Unlock() - if fake.UnshareServiceInstanceFromSpaceStub != nil { - return fake.UnshareServiceInstanceFromSpaceStub(arg1, arg2) + if stub != nil { + return stub(arg1, arg2) } if specificReturn { return ret.result1, ret.result2 } - fakeReturns := fake.unshareServiceInstanceFromSpaceReturns return fakeReturns.result1, fakeReturns.result2 } @@ -12514,15 +12653,16 @@ func (fake *FakeCloudControllerClient) UpdateAppFeature(arg1 string, arg2 bool, arg2 bool arg3 string }{arg1, arg2, arg3}) + stub := fake.UpdateAppFeatureStub + fakeReturns := fake.updateAppFeatureReturns fake.recordInvocation("UpdateAppFeature", []interface{}{arg1, arg2, arg3}) fake.updateAppFeatureMutex.Unlock() - if fake.UpdateAppFeatureStub != nil { - return fake.UpdateAppFeatureStub(arg1, arg2, arg3) + if stub != nil { + return stub(arg1, arg2, arg3) } if specificReturn { return ret.result1, ret.result2 } - fakeReturns := fake.updateAppFeatureReturns return fakeReturns.result1, fakeReturns.result2 } @@ -12577,15 +12717,16 @@ func (fake *FakeCloudControllerClient) UpdateApplication(arg1 resources.Applicat fake.updateApplicationArgsForCall = append(fake.updateApplicationArgsForCall, struct { arg1 resources.Application }{arg1}) + stub := fake.UpdateApplicationStub + fakeReturns := fake.updateApplicationReturns fake.recordInvocation("UpdateApplication", []interface{}{arg1}) fake.updateApplicationMutex.Unlock() - if fake.UpdateApplicationStub != nil { - return fake.UpdateApplicationStub(arg1) + if stub != nil { + return stub(arg1) } if specificReturn { return ret.result1, ret.result2, ret.result3 } - fakeReturns := fake.updateApplicationReturns return fakeReturns.result1, fakeReturns.result2, fakeReturns.result3 } @@ -12649,15 +12790,16 @@ func (fake *FakeCloudControllerClient) UpdateApplicationApplyManifest(arg1 strin arg1 string arg2 []byte }{arg1, arg2Copy}) + stub := fake.UpdateApplicationApplyManifestStub + fakeReturns := fake.updateApplicationApplyManifestReturns fake.recordInvocation("UpdateApplicationApplyManifest", []interface{}{arg1, arg2Copy}) fake.updateApplicationApplyManifestMutex.Unlock() - if fake.UpdateApplicationApplyManifestStub != nil { - return fake.UpdateApplicationApplyManifestStub(arg1, arg2) + if stub != nil { + return stub(arg1, arg2) } if specificReturn { return ret.result1, ret.result2, ret.result3 } - fakeReturns := fake.updateApplicationApplyManifestReturns return fakeReturns.result1, fakeReturns.result2, fakeReturns.result3 } @@ -12716,15 +12858,16 @@ func (fake *FakeCloudControllerClient) UpdateApplicationEnvironmentVariables(arg arg1 string arg2 resources.EnvironmentVariables }{arg1, arg2}) + stub := fake.UpdateApplicationEnvironmentVariablesStub + fakeReturns := fake.updateApplicationEnvironmentVariablesReturns fake.recordInvocation("UpdateApplicationEnvironmentVariables", []interface{}{arg1, arg2}) fake.updateApplicationEnvironmentVariablesMutex.Unlock() - if fake.UpdateApplicationEnvironmentVariablesStub != nil { - return fake.UpdateApplicationEnvironmentVariablesStub(arg1, arg2) + if stub != nil { + return stub(arg1, arg2) } if specificReturn { return ret.result1, ret.result2, ret.result3 } - fakeReturns := fake.updateApplicationEnvironmentVariablesReturns return fakeReturns.result1, fakeReturns.result2, fakeReturns.result3 } @@ -12783,15 +12926,16 @@ func (fake *FakeCloudControllerClient) UpdateApplicationName(arg1 string, arg2 s arg1 string arg2 string }{arg1, arg2}) + stub := fake.UpdateApplicationNameStub + fakeReturns := fake.updateApplicationNameReturns fake.recordInvocation("UpdateApplicationName", []interface{}{arg1, arg2}) fake.updateApplicationNameMutex.Unlock() - if fake.UpdateApplicationNameStub != nil { - return fake.UpdateApplicationNameStub(arg1, arg2) + if stub != nil { + return stub(arg1, arg2) } if specificReturn { return ret.result1, ret.result2, ret.result3 } - fakeReturns := fake.updateApplicationNameReturns return fakeReturns.result1, fakeReturns.result2, fakeReturns.result3 } @@ -12849,15 +12993,16 @@ func (fake *FakeCloudControllerClient) UpdateApplicationRestart(arg1 string) (re fake.updateApplicationRestartArgsForCall = append(fake.updateApplicationRestartArgsForCall, struct { arg1 string }{arg1}) + stub := fake.UpdateApplicationRestartStub + fakeReturns := fake.updateApplicationRestartReturns fake.recordInvocation("UpdateApplicationRestart", []interface{}{arg1}) fake.updateApplicationRestartMutex.Unlock() - if fake.UpdateApplicationRestartStub != nil { - return fake.UpdateApplicationRestartStub(arg1) + if stub != nil { + return stub(arg1) } if specificReturn { return ret.result1, ret.result2, ret.result3 } - fakeReturns := fake.updateApplicationRestartReturns return fakeReturns.result1, fakeReturns.result2, fakeReturns.result3 } @@ -12915,15 +13060,16 @@ func (fake *FakeCloudControllerClient) UpdateApplicationStart(arg1 string) (reso fake.updateApplicationStartArgsForCall = append(fake.updateApplicationStartArgsForCall, struct { arg1 string }{arg1}) + stub := fake.UpdateApplicationStartStub + fakeReturns := fake.updateApplicationStartReturns fake.recordInvocation("UpdateApplicationStart", []interface{}{arg1}) fake.updateApplicationStartMutex.Unlock() - if fake.UpdateApplicationStartStub != nil { - return fake.UpdateApplicationStartStub(arg1) + if stub != nil { + return stub(arg1) } if specificReturn { return ret.result1, ret.result2, ret.result3 } - fakeReturns := fake.updateApplicationStartReturns return fakeReturns.result1, fakeReturns.result2, fakeReturns.result3 } @@ -12981,15 +13127,16 @@ func (fake *FakeCloudControllerClient) UpdateApplicationStop(arg1 string) (resou fake.updateApplicationStopArgsForCall = append(fake.updateApplicationStopArgsForCall, struct { arg1 string }{arg1}) + stub := fake.UpdateApplicationStopStub + fakeReturns := fake.updateApplicationStopReturns fake.recordInvocation("UpdateApplicationStop", []interface{}{arg1}) fake.updateApplicationStopMutex.Unlock() - if fake.UpdateApplicationStopStub != nil { - return fake.UpdateApplicationStopStub(arg1) + if stub != nil { + return stub(arg1) } if specificReturn { return ret.result1, ret.result2, ret.result3 } - fakeReturns := fake.updateApplicationStopReturns return fakeReturns.result1, fakeReturns.result2, fakeReturns.result3 } @@ -13047,15 +13194,16 @@ func (fake *FakeCloudControllerClient) UpdateBuildpack(arg1 resources.Buildpack) fake.updateBuildpackArgsForCall = append(fake.updateBuildpackArgsForCall, struct { arg1 resources.Buildpack }{arg1}) + stub := fake.UpdateBuildpackStub + fakeReturns := fake.updateBuildpackReturns fake.recordInvocation("UpdateBuildpack", []interface{}{arg1}) fake.updateBuildpackMutex.Unlock() - if fake.UpdateBuildpackStub != nil { - return fake.UpdateBuildpackStub(arg1) + if stub != nil { + return stub(arg1) } if specificReturn { return ret.result1, ret.result2, ret.result3 } - fakeReturns := fake.updateBuildpackReturns return fakeReturns.result1, fakeReturns.result2, fakeReturns.result3 } @@ -13115,15 +13263,16 @@ func (fake *FakeCloudControllerClient) UpdateDestination(arg1 string, arg2 strin arg2 string arg3 string }{arg1, arg2, arg3}) + stub := fake.UpdateDestinationStub + fakeReturns := fake.updateDestinationReturns fake.recordInvocation("UpdateDestination", []interface{}{arg1, arg2, arg3}) fake.updateDestinationMutex.Unlock() - if fake.UpdateDestinationStub != nil { - return fake.UpdateDestinationStub(arg1, arg2, arg3) + if stub != nil { + return stub(arg1, arg2, arg3) } if specificReturn { return ret.result1, ret.result2 } - fakeReturns := fake.updateDestinationReturns return fakeReturns.result1, fakeReturns.result2 } @@ -13179,15 +13328,16 @@ func (fake *FakeCloudControllerClient) UpdateEnvironmentVariableGroup(arg1 const arg1 constant.EnvironmentVariableGroupName arg2 resources.EnvironmentVariables }{arg1, arg2}) + stub := fake.UpdateEnvironmentVariableGroupStub + fakeReturns := fake.updateEnvironmentVariableGroupReturns fake.recordInvocation("UpdateEnvironmentVariableGroup", []interface{}{arg1, arg2}) fake.updateEnvironmentVariableGroupMutex.Unlock() - if fake.UpdateEnvironmentVariableGroupStub != nil { - return fake.UpdateEnvironmentVariableGroupStub(arg1, arg2) + if stub != nil { + return stub(arg1, arg2) } if specificReturn { return ret.result1, ret.result2, ret.result3 } - fakeReturns := fake.updateEnvironmentVariableGroupReturns return fakeReturns.result1, fakeReturns.result2, fakeReturns.result3 } @@ -13245,15 +13395,16 @@ func (fake *FakeCloudControllerClient) UpdateFeatureFlag(arg1 resources.FeatureF fake.updateFeatureFlagArgsForCall = append(fake.updateFeatureFlagArgsForCall, struct { arg1 resources.FeatureFlag }{arg1}) + stub := fake.UpdateFeatureFlagStub + fakeReturns := fake.updateFeatureFlagReturns fake.recordInvocation("UpdateFeatureFlag", []interface{}{arg1}) fake.updateFeatureFlagMutex.Unlock() - if fake.UpdateFeatureFlagStub != nil { - return fake.UpdateFeatureFlagStub(arg1) + if stub != nil { + return stub(arg1) } if specificReturn { return ret.result1, ret.result2, ret.result3 } - fakeReturns := fake.updateFeatureFlagReturns return fakeReturns.result1, fakeReturns.result2, fakeReturns.result3 } @@ -13311,15 +13462,16 @@ func (fake *FakeCloudControllerClient) UpdateOrganization(arg1 resources.Organiz fake.updateOrganizationArgsForCall = append(fake.updateOrganizationArgsForCall, struct { arg1 resources.Organization }{arg1}) + stub := fake.UpdateOrganizationStub + fakeReturns := fake.updateOrganizationReturns fake.recordInvocation("UpdateOrganization", []interface{}{arg1}) fake.updateOrganizationMutex.Unlock() - if fake.UpdateOrganizationStub != nil { - return fake.UpdateOrganizationStub(arg1) + if stub != nil { + return stub(arg1) } if specificReturn { return ret.result1, ret.result2, ret.result3 } - fakeReturns := fake.updateOrganizationReturns return fakeReturns.result1, fakeReturns.result2, fakeReturns.result3 } @@ -13378,15 +13530,16 @@ func (fake *FakeCloudControllerClient) UpdateOrganizationDefaultIsolationSegment arg1 string arg2 string }{arg1, arg2}) + stub := fake.UpdateOrganizationDefaultIsolationSegmentRelationshipStub + fakeReturns := fake.updateOrganizationDefaultIsolationSegmentRelationshipReturns fake.recordInvocation("UpdateOrganizationDefaultIsolationSegmentRelationship", []interface{}{arg1, arg2}) fake.updateOrganizationDefaultIsolationSegmentRelationshipMutex.Unlock() - if fake.UpdateOrganizationDefaultIsolationSegmentRelationshipStub != nil { - return fake.UpdateOrganizationDefaultIsolationSegmentRelationshipStub(arg1, arg2) + if stub != nil { + return stub(arg1, arg2) } if specificReturn { return ret.result1, ret.result2, ret.result3 } - fakeReturns := fake.updateOrganizationDefaultIsolationSegmentRelationshipReturns return fakeReturns.result1, fakeReturns.result2, fakeReturns.result3 } @@ -13444,15 +13597,16 @@ func (fake *FakeCloudControllerClient) UpdateOrganizationQuota(arg1 resources.Or fake.updateOrganizationQuotaArgsForCall = append(fake.updateOrganizationQuotaArgsForCall, struct { arg1 resources.OrganizationQuota }{arg1}) + stub := fake.UpdateOrganizationQuotaStub + fakeReturns := fake.updateOrganizationQuotaReturns fake.recordInvocation("UpdateOrganizationQuota", []interface{}{arg1}) fake.updateOrganizationQuotaMutex.Unlock() - if fake.UpdateOrganizationQuotaStub != nil { - return fake.UpdateOrganizationQuotaStub(arg1) + if stub != nil { + return stub(arg1) } if specificReturn { return ret.result1, ret.result2, ret.result3 } - fakeReturns := fake.updateOrganizationQuotaReturns return fakeReturns.result1, fakeReturns.result2, fakeReturns.result3 } @@ -13510,15 +13664,16 @@ func (fake *FakeCloudControllerClient) UpdateProcess(arg1 resources.Process) (re fake.updateProcessArgsForCall = append(fake.updateProcessArgsForCall, struct { arg1 resources.Process }{arg1}) + stub := fake.UpdateProcessStub + fakeReturns := fake.updateProcessReturns fake.recordInvocation("UpdateProcess", []interface{}{arg1}) fake.updateProcessMutex.Unlock() - if fake.UpdateProcessStub != nil { - return fake.UpdateProcessStub(arg1) + if stub != nil { + return stub(arg1) } if specificReturn { return ret.result1, ret.result2, ret.result3 } - fakeReturns := fake.updateProcessReturns return fakeReturns.result1, fakeReturns.result2, fakeReturns.result3 } @@ -13578,15 +13733,16 @@ func (fake *FakeCloudControllerClient) UpdateResourceMetadata(arg1 string, arg2 arg2 string arg3 resources.Metadata }{arg1, arg2, arg3}) + stub := fake.UpdateResourceMetadataStub + fakeReturns := fake.updateResourceMetadataReturns fake.recordInvocation("UpdateResourceMetadata", []interface{}{arg1, arg2, arg3}) fake.updateResourceMetadataMutex.Unlock() - if fake.UpdateResourceMetadataStub != nil { - return fake.UpdateResourceMetadataStub(arg1, arg2, arg3) + if stub != nil { + return stub(arg1, arg2, arg3) } if specificReturn { return ret.result1, ret.result2, ret.result3 } - fakeReturns := fake.updateResourceMetadataReturns return fakeReturns.result1, fakeReturns.result2, fakeReturns.result3 } @@ -13644,15 +13800,16 @@ func (fake *FakeCloudControllerClient) UpdateSecurityGroup(arg1 resources.Securi fake.updateSecurityGroupArgsForCall = append(fake.updateSecurityGroupArgsForCall, struct { arg1 resources.SecurityGroup }{arg1}) + stub := fake.UpdateSecurityGroupStub + fakeReturns := fake.updateSecurityGroupReturns fake.recordInvocation("UpdateSecurityGroup", []interface{}{arg1}) fake.updateSecurityGroupMutex.Unlock() - if fake.UpdateSecurityGroupStub != nil { - return fake.UpdateSecurityGroupStub(arg1) + if stub != nil { + return stub(arg1) } if specificReturn { return ret.result1, ret.result2, ret.result3 } - fakeReturns := fake.updateSecurityGroupReturns return fakeReturns.result1, fakeReturns.result2, fakeReturns.result3 } @@ -13716,15 +13873,16 @@ func (fake *FakeCloudControllerClient) UpdateSecurityGroupRunningSpace(arg1 stri arg1 string arg2 []string }{arg1, arg2Copy}) + stub := fake.UpdateSecurityGroupRunningSpaceStub + fakeReturns := fake.updateSecurityGroupRunningSpaceReturns fake.recordInvocation("UpdateSecurityGroupRunningSpace", []interface{}{arg1, arg2Copy}) fake.updateSecurityGroupRunningSpaceMutex.Unlock() - if fake.UpdateSecurityGroupRunningSpaceStub != nil { - return fake.UpdateSecurityGroupRunningSpaceStub(arg1, arg2) + if stub != nil { + return stub(arg1, arg2) } if specificReturn { return ret.result1, ret.result2 } - fakeReturns := fake.updateSecurityGroupRunningSpaceReturns return fakeReturns.result1, fakeReturns.result2 } @@ -13785,15 +13943,16 @@ func (fake *FakeCloudControllerClient) UpdateSecurityGroupStagingSpace(arg1 stri arg1 string arg2 []string }{arg1, arg2Copy}) + stub := fake.UpdateSecurityGroupStagingSpaceStub + fakeReturns := fake.updateSecurityGroupStagingSpaceReturns fake.recordInvocation("UpdateSecurityGroupStagingSpace", []interface{}{arg1, arg2Copy}) fake.updateSecurityGroupStagingSpaceMutex.Unlock() - if fake.UpdateSecurityGroupStagingSpaceStub != nil { - return fake.UpdateSecurityGroupStagingSpaceStub(arg1, arg2) + if stub != nil { + return stub(arg1, arg2) } if specificReturn { return ret.result1, ret.result2 } - fakeReturns := fake.updateSecurityGroupStagingSpaceReturns return fakeReturns.result1, fakeReturns.result2 } @@ -13849,15 +14008,16 @@ func (fake *FakeCloudControllerClient) UpdateServiceBroker(arg1 string, arg2 res arg1 string arg2 resources.ServiceBroker }{arg1, arg2}) + stub := fake.UpdateServiceBrokerStub + fakeReturns := fake.updateServiceBrokerReturns fake.recordInvocation("UpdateServiceBroker", []interface{}{arg1, arg2}) fake.updateServiceBrokerMutex.Unlock() - if fake.UpdateServiceBrokerStub != nil { - return fake.UpdateServiceBrokerStub(arg1, arg2) + if stub != nil { + return stub(arg1, arg2) } if specificReturn { return ret.result1, ret.result2, ret.result3 } - fakeReturns := fake.updateServiceBrokerReturns return fakeReturns.result1, fakeReturns.result2, fakeReturns.result3 } @@ -13916,15 +14076,16 @@ func (fake *FakeCloudControllerClient) UpdateServiceInstance(arg1 string, arg2 r arg1 string arg2 resources.ServiceInstance }{arg1, arg2}) + stub := fake.UpdateServiceInstanceStub + fakeReturns := fake.updateServiceInstanceReturns fake.recordInvocation("UpdateServiceInstance", []interface{}{arg1, arg2}) fake.updateServiceInstanceMutex.Unlock() - if fake.UpdateServiceInstanceStub != nil { - return fake.UpdateServiceInstanceStub(arg1, arg2) + if stub != nil { + return stub(arg1, arg2) } if specificReturn { return ret.result1, ret.result2, ret.result3 } - fakeReturns := fake.updateServiceInstanceReturns return fakeReturns.result1, fakeReturns.result2, fakeReturns.result3 } @@ -13983,15 +14144,16 @@ func (fake *FakeCloudControllerClient) UpdateServicePlanVisibility(arg1 string, arg1 string arg2 resources.ServicePlanVisibility }{arg1, arg2}) + stub := fake.UpdateServicePlanVisibilityStub + fakeReturns := fake.updateServicePlanVisibilityReturns fake.recordInvocation("UpdateServicePlanVisibility", []interface{}{arg1, arg2}) fake.updateServicePlanVisibilityMutex.Unlock() - if fake.UpdateServicePlanVisibilityStub != nil { - return fake.UpdateServicePlanVisibilityStub(arg1, arg2) + if stub != nil { + return stub(arg1, arg2) } if specificReturn { return ret.result1, ret.result2, ret.result3 } - fakeReturns := fake.updateServicePlanVisibilityReturns return fakeReturns.result1, fakeReturns.result2, fakeReturns.result3 } @@ -14049,15 +14211,16 @@ func (fake *FakeCloudControllerClient) UpdateSpace(arg1 resources.Space) (resour fake.updateSpaceArgsForCall = append(fake.updateSpaceArgsForCall, struct { arg1 resources.Space }{arg1}) + stub := fake.UpdateSpaceStub + fakeReturns := fake.updateSpaceReturns fake.recordInvocation("UpdateSpace", []interface{}{arg1}) fake.updateSpaceMutex.Unlock() - if fake.UpdateSpaceStub != nil { - return fake.UpdateSpaceStub(arg1) + if stub != nil { + return stub(arg1) } if specificReturn { return ret.result1, ret.result2, ret.result3 } - fakeReturns := fake.updateSpaceReturns return fakeReturns.result1, fakeReturns.result2, fakeReturns.result3 } @@ -14121,15 +14284,16 @@ func (fake *FakeCloudControllerClient) UpdateSpaceApplyManifest(arg1 string, arg arg1 string arg2 []byte }{arg1, arg2Copy}) + stub := fake.UpdateSpaceApplyManifestStub + fakeReturns := fake.updateSpaceApplyManifestReturns fake.recordInvocation("UpdateSpaceApplyManifest", []interface{}{arg1, arg2Copy}) fake.updateSpaceApplyManifestMutex.Unlock() - if fake.UpdateSpaceApplyManifestStub != nil { - return fake.UpdateSpaceApplyManifestStub(arg1, arg2) + if stub != nil { + return stub(arg1, arg2) } if specificReturn { return ret.result1, ret.result2, ret.result3 } - fakeReturns := fake.updateSpaceApplyManifestReturns return fakeReturns.result1, fakeReturns.result2, fakeReturns.result3 } @@ -14189,15 +14353,16 @@ func (fake *FakeCloudControllerClient) UpdateSpaceFeature(arg1 string, arg2 bool arg2 bool arg3 string }{arg1, arg2, arg3}) + stub := fake.UpdateSpaceFeatureStub + fakeReturns := fake.updateSpaceFeatureReturns fake.recordInvocation("UpdateSpaceFeature", []interface{}{arg1, arg2, arg3}) fake.updateSpaceFeatureMutex.Unlock() - if fake.UpdateSpaceFeatureStub != nil { - return fake.UpdateSpaceFeatureStub(arg1, arg2, arg3) + if stub != nil { + return stub(arg1, arg2, arg3) } if specificReturn { return ret.result1, ret.result2 } - fakeReturns := fake.updateSpaceFeatureReturns return fakeReturns.result1, fakeReturns.result2 } @@ -14253,15 +14418,16 @@ func (fake *FakeCloudControllerClient) UpdateSpaceIsolationSegmentRelationship(a arg1 string arg2 string }{arg1, arg2}) + stub := fake.UpdateSpaceIsolationSegmentRelationshipStub + fakeReturns := fake.updateSpaceIsolationSegmentRelationshipReturns fake.recordInvocation("UpdateSpaceIsolationSegmentRelationship", []interface{}{arg1, arg2}) fake.updateSpaceIsolationSegmentRelationshipMutex.Unlock() - if fake.UpdateSpaceIsolationSegmentRelationshipStub != nil { - return fake.UpdateSpaceIsolationSegmentRelationshipStub(arg1, arg2) + if stub != nil { + return stub(arg1, arg2) } if specificReturn { return ret.result1, ret.result2, ret.result3 } - fakeReturns := fake.updateSpaceIsolationSegmentRelationshipReturns return fakeReturns.result1, fakeReturns.result2, fakeReturns.result3 } @@ -14319,15 +14485,16 @@ func (fake *FakeCloudControllerClient) UpdateSpaceQuota(arg1 resources.SpaceQuot fake.updateSpaceQuotaArgsForCall = append(fake.updateSpaceQuotaArgsForCall, struct { arg1 resources.SpaceQuota }{arg1}) + stub := fake.UpdateSpaceQuotaStub + fakeReturns := fake.updateSpaceQuotaReturns fake.recordInvocation("UpdateSpaceQuota", []interface{}{arg1}) fake.updateSpaceQuotaMutex.Unlock() - if fake.UpdateSpaceQuotaStub != nil { - return fake.UpdateSpaceQuotaStub(arg1) + if stub != nil { + return stub(arg1) } if specificReturn { return ret.result1, ret.result2, ret.result3 } - fakeReturns := fake.updateSpaceQuotaReturns return fakeReturns.result1, fakeReturns.result2, fakeReturns.result3 } @@ -14385,15 +14552,16 @@ func (fake *FakeCloudControllerClient) UpdateTaskCancel(arg1 string) (resources. fake.updateTaskCancelArgsForCall = append(fake.updateTaskCancelArgsForCall, struct { arg1 string }{arg1}) + stub := fake.UpdateTaskCancelStub + fakeReturns := fake.updateTaskCancelReturns fake.recordInvocation("UpdateTaskCancel", []interface{}{arg1}) fake.updateTaskCancelMutex.Unlock() - if fake.UpdateTaskCancelStub != nil { - return fake.UpdateTaskCancelStub(arg1) + if stub != nil { + return stub(arg1) } if specificReturn { return ret.result1, ret.result2, ret.result3 } - fakeReturns := fake.updateTaskCancelReturns return fakeReturns.result1, fakeReturns.result2, fakeReturns.result3 } @@ -14459,15 +14627,16 @@ func (fake *FakeCloudControllerClient) UploadBitsPackage(arg1 resources.Package, arg3 io.Reader arg4 int64 }{arg1, arg2Copy, arg3, arg4}) + stub := fake.UploadBitsPackageStub + fakeReturns := fake.uploadBitsPackageReturns fake.recordInvocation("UploadBitsPackage", []interface{}{arg1, arg2Copy, arg3, arg4}) fake.uploadBitsPackageMutex.Unlock() - if fake.UploadBitsPackageStub != nil { - return fake.UploadBitsPackageStub(arg1, arg2, arg3, arg4) + if stub != nil { + return stub(arg1, arg2, arg3, arg4) } if specificReturn { return ret.result1, ret.result2, ret.result3 } - fakeReturns := fake.uploadBitsPackageReturns return fakeReturns.result1, fakeReturns.result2, fakeReturns.result3 } @@ -14528,15 +14697,16 @@ func (fake *FakeCloudControllerClient) UploadBuildpack(arg1 string, arg2 string, arg3 io.Reader arg4 int64 }{arg1, arg2, arg3, arg4}) + stub := fake.UploadBuildpackStub + fakeReturns := fake.uploadBuildpackReturns fake.recordInvocation("UploadBuildpack", []interface{}{arg1, arg2, arg3, arg4}) fake.uploadBuildpackMutex.Unlock() - if fake.UploadBuildpackStub != nil { - return fake.UploadBuildpackStub(arg1, arg2, arg3, arg4) + if stub != nil { + return stub(arg1, arg2, arg3, arg4) } if specificReturn { return ret.result1, ret.result2, ret.result3 } - fakeReturns := fake.uploadBuildpackReturns return fakeReturns.result1, fakeReturns.result2, fakeReturns.result3 } @@ -14597,15 +14767,16 @@ func (fake *FakeCloudControllerClient) UploadDropletBits(arg1 string, arg2 strin arg3 io.Reader arg4 int64 }{arg1, arg2, arg3, arg4}) + stub := fake.UploadDropletBitsStub + fakeReturns := fake.uploadDropletBitsReturns fake.recordInvocation("UploadDropletBits", []interface{}{arg1, arg2, arg3, arg4}) fake.uploadDropletBitsMutex.Unlock() - if fake.UploadDropletBitsStub != nil { - return fake.UploadDropletBitsStub(arg1, arg2, arg3, arg4) + if stub != nil { + return stub(arg1, arg2, arg3, arg4) } if specificReturn { return ret.result1, ret.result2, ret.result3 } - fakeReturns := fake.uploadDropletBitsReturns return fakeReturns.result1, fakeReturns.result2, fakeReturns.result3 } @@ -14664,15 +14835,16 @@ func (fake *FakeCloudControllerClient) UploadPackage(arg1 resources.Package, arg arg1 resources.Package arg2 string }{arg1, arg2}) + stub := fake.UploadPackageStub + fakeReturns := fake.uploadPackageReturns fake.recordInvocation("UploadPackage", []interface{}{arg1, arg2}) fake.uploadPackageMutex.Unlock() - if fake.UploadPackageStub != nil { - return fake.UploadPackageStub(arg1, arg2) + if stub != nil { + return stub(arg1, arg2) } if specificReturn { return ret.result1, ret.result2, ret.result3 } - fakeReturns := fake.uploadPackageReturns return fakeReturns.result1, fakeReturns.result2, fakeReturns.result3 } @@ -14729,15 +14901,16 @@ func (fake *FakeCloudControllerClient) WhoAmI() (resources.K8sUser, ccv3.Warning ret, specificReturn := fake.whoAmIReturnsOnCall[len(fake.whoAmIArgsForCall)] fake.whoAmIArgsForCall = append(fake.whoAmIArgsForCall, struct { }{}) + stub := fake.WhoAmIStub + fakeReturns := fake.whoAmIReturns fake.recordInvocation("WhoAmI", []interface{}{}) fake.whoAmIMutex.Unlock() - if fake.WhoAmIStub != nil { - return fake.WhoAmIStub() + if stub != nil { + return stub() } if specificReturn { return ret.result1, ret.result2, ret.result3 } - fakeReturns := fake.whoAmIReturns return fakeReturns.result1, fakeReturns.result2, fakeReturns.result3 } @@ -14793,14 +14966,14 @@ func (fake *FakeCloudControllerClient) Invocations() map[string][][]interface{} defer fake.cancelDeploymentMutex.RUnlock() fake.checkRouteMutex.RLock() defer fake.checkRouteMutex.RUnlock() + fake.continueDeploymentMutex.RLock() + defer fake.continueDeploymentMutex.RUnlock() fake.copyPackageMutex.RLock() defer fake.copyPackageMutex.RUnlock() fake.createApplicationMutex.RLock() defer fake.createApplicationMutex.RUnlock() fake.createApplicationDeploymentMutex.RLock() defer fake.createApplicationDeploymentMutex.RUnlock() - fake.createApplicationDeploymentByRevisionMutex.RLock() - defer fake.createApplicationDeploymentByRevisionMutex.RUnlock() fake.createApplicationProcessScaleMutex.RLock() defer fake.createApplicationProcessScaleMutex.RUnlock() fake.createApplicationTaskMutex.RLock() diff --git a/actor/v7pushaction/create_deployment_for_push_plan.go b/actor/v7pushaction/create_deployment_for_push_plan.go index 7d5b7ce1a27..241568f8141 100644 --- a/actor/v7pushaction/create_deployment_for_push_plan.go +++ b/actor/v7pushaction/create_deployment_for_push_plan.go @@ -1,9 +1,18 @@ package v7pushaction +import ( + "code.cloudfoundry.org/cli/api/cloudcontroller/ccv3/constant" + "code.cloudfoundry.org/cli/resources" +) + func (actor Actor) CreateDeploymentForApplication(pushPlan PushPlan, eventStream chan<- *PushEvent, progressBar ProgressBar) (PushPlan, Warnings, error) { eventStream <- &PushEvent{Plan: pushPlan, Event: StartingDeployment} - deploymentGUID, warnings, err := actor.V7Actor.CreateDeploymentByApplicationAndDroplet(pushPlan.Application.GUID, pushPlan.DropletGUID) + var dep resources.Deployment + dep.DropletGUID = pushPlan.DropletGUID + dep.Strategy = pushPlan.Strategy + dep.Relationships = resources.Relationships{constant.RelationshipTypeApplication: resources.Relationship{GUID: pushPlan.Application.GUID}} + deploymentGUID, warnings, err := actor.V7Actor.CreateDeployment(dep) if err != nil { return pushPlan, Warnings(warnings), err @@ -19,7 +28,7 @@ func (actor Actor) CreateDeploymentForApplication(pushPlan PushPlan, eventStream } } - pollWarnings, err := actor.V7Actor.PollStartForRolling(pushPlan.Application, deploymentGUID, pushPlan.NoWait, handleInstanceDetails) + pollWarnings, err := actor.V7Actor.PollStartForDeployment(pushPlan.Application, deploymentGUID, pushPlan.NoWait, handleInstanceDetails) warnings = append(warnings, pollWarnings...) return pushPlan, Warnings(warnings), err diff --git a/actor/v7pushaction/create_deployment_for_push_plan_test.go b/actor/v7pushaction/create_deployment_for_push_plan_test.go index 126eb5dc094..9bbcfa30578 100644 --- a/actor/v7pushaction/create_deployment_for_push_plan_test.go +++ b/actor/v7pushaction/create_deployment_for_push_plan_test.go @@ -47,12 +47,12 @@ var _ = Describe("CreateDeploymentForApplication()", func() { Describe("creating deployment", func() { When("creating the deployment is successful", func() { BeforeEach(func() { - fakeV7Actor.PollStartForRollingCalls(func(_ resources.Application, _ string, _ bool, handleInstanceDetails func(string)) (warnings v7action.Warnings, err error) { + fakeV7Actor.PollStartForDeploymentCalls(func(_ resources.Application, _ string, _ bool, handleInstanceDetails func(string)) (warnings v7action.Warnings, err error) { handleInstanceDetails("Instances starting...") return nil, nil }) - fakeV7Actor.CreateDeploymentByApplicationAndDropletReturns( + fakeV7Actor.CreateDeploymentReturns( "some-deployment-guid", v7action.Warnings{"some-deployment-warning"}, nil, @@ -60,8 +60,8 @@ var _ = Describe("CreateDeploymentForApplication()", func() { }) It("waits for the app to start", func() { - Expect(fakeV7Actor.PollStartForRollingCallCount()).To(Equal(1)) - givenApp, givenDeploymentGUID, noWait, _ := fakeV7Actor.PollStartForRollingArgsForCall(0) + Expect(fakeV7Actor.PollStartForDeploymentCallCount()).To(Equal(1)) + givenApp, givenDeploymentGUID, noWait, _ := fakeV7Actor.PollStartForDeploymentArgsForCall(0) Expect(givenApp).To(Equal(resources.Application{GUID: "some-app-guid"})) Expect(givenDeploymentGUID).To(Equal("some-deployment-guid")) Expect(noWait).To(Equal(false)) @@ -85,7 +85,7 @@ var _ = Describe("CreateDeploymentForApplication()", func() { BeforeEach(func() { someErr = errors.New("failed to create deployment") - fakeV7Actor.CreateDeploymentByApplicationAndDropletReturns( + fakeV7Actor.CreateDeploymentReturns( "", v7action.Warnings{"some-deployment-warning"}, someErr, @@ -93,7 +93,7 @@ var _ = Describe("CreateDeploymentForApplication()", func() { }) It("does not wait for the app to start", func() { - Expect(fakeV7Actor.PollStartForRollingCallCount()).To(Equal(0)) + Expect(fakeV7Actor.PollStartForDeploymentCallCount()).To(Equal(0)) }) It("returns errors and warnings", func() { @@ -111,7 +111,7 @@ var _ = Describe("CreateDeploymentForApplication()", func() { Describe("waiting for app to start", func() { When("the the polling is successful", func() { BeforeEach(func() { - fakeV7Actor.PollStartForRollingReturns(v7action.Warnings{"some-poll-start-warning"}, nil) + fakeV7Actor.PollStartForDeploymentReturns(v7action.Warnings{"some-poll-start-warning"}, nil) }) It("returns warnings and unchanged push plan", func() { @@ -129,7 +129,7 @@ var _ = Describe("CreateDeploymentForApplication()", func() { BeforeEach(func() { someErr = errors.New("app failed to start") - fakeV7Actor.PollStartForRollingReturns(v7action.Warnings{"some-poll-start-warning"}, someErr) + fakeV7Actor.PollStartForDeploymentReturns(v7action.Warnings{"some-poll-start-warning"}, someErr) }) It("returns errors and warnings", func() { @@ -148,7 +148,7 @@ var _ = Describe("CreateDeploymentForApplication()", func() { }) It("passes in the noWait flag", func() { - _, _, noWait, _ := fakeV7Actor.PollStartForRollingArgsForCall(0) + _, _, noWait, _ := fakeV7Actor.PollStartForDeploymentArgsForCall(0) Expect(noWait).To(Equal(true)) }) }) diff --git a/actor/v7pushaction/sequence.go b/actor/v7pushaction/sequence.go index b8e4608fe70..1f9aa741a7f 100644 --- a/actor/v7pushaction/sequence.go +++ b/actor/v7pushaction/sequence.go @@ -21,7 +21,7 @@ func ShouldStagePackage(plan PushPlan) bool { } func ShouldCreateDeployment(plan PushPlan) bool { - return plan.Strategy == constant.DeploymentStrategyRolling + return plan.Strategy != "" } func ShouldStopApplication(plan PushPlan) bool { diff --git a/actor/v7pushaction/sequence_test.go b/actor/v7pushaction/sequence_test.go index 158725f66c5..5274516b04c 100644 --- a/actor/v7pushaction/sequence_test.go +++ b/actor/v7pushaction/sequence_test.go @@ -113,6 +113,18 @@ var _ = Describe("Actor", func() { }) }) + When("the plan has strategy 'canary'", func() { + BeforeEach(func() { + plan = PushPlan{ + Strategy: constant.DeploymentStrategyCanary, + } + }) + + It("returns a sequence that creates a canary deployment", func() { + Expect(sequence).To(matchers.MatchFuncsByName(actor.StagePackageForApplication, actor.CreateDeploymentForApplication)) + }) + }) + When("the plan has task application type", func() { BeforeEach(func() { plan = PushPlan{ diff --git a/actor/v7pushaction/v7_actor.go b/actor/v7pushaction/v7_actor.go index db59052da50..91356c9df46 100644 --- a/actor/v7pushaction/v7_actor.go +++ b/actor/v7pushaction/v7_actor.go @@ -14,7 +14,7 @@ type V7Actor interface { CreateApplicationDroplet(appGUID string) (resources.Droplet, v7action.Warnings, error) CreateApplicationInSpace(app resources.Application, spaceGUID string) (resources.Application, v7action.Warnings, error) CreateBitsPackageByApplication(appGUID string) (resources.Package, v7action.Warnings, error) - CreateDeploymentByApplicationAndDroplet(appGUID string, dropletGUID string) (string, v7action.Warnings, error) + CreateDeployment(dep resources.Deployment) (string, v7action.Warnings, error) CreateDockerPackageByApplication(appGUID string, dockerImageCredentials v7action.DockerImageCredentials) (resources.Package, v7action.Warnings, error) CreateRoute(spaceGUID, domainName, hostname, path string, port int) (resources.Route, v7action.Warnings, error) GetApplicationByNameAndSpace(appName string, spaceGUID string) (resources.Application, v7action.Warnings, error) @@ -29,7 +29,7 @@ type V7Actor interface { PollBuild(buildGUID string, appName string) (resources.Droplet, v7action.Warnings, error) PollPackage(pkg resources.Package) (resources.Package, v7action.Warnings, error) PollStart(app resources.Application, noWait bool, handleProcessStats func(string)) (v7action.Warnings, error) - PollStartForRolling(app resources.Application, deploymentGUID string, noWait bool, handleProcessStats func(string)) (v7action.Warnings, error) + PollStartForDeployment(app resources.Application, deploymentGUID string, noWait bool, handleProcessStats func(string)) (v7action.Warnings, error) ResourceMatch(resources []sharedaction.V3Resource) ([]sharedaction.V3Resource, v7action.Warnings, error) RestartApplication(appGUID string, noWait bool) (v7action.Warnings, error) ScaleProcessByApplication(appGUID string, process resources.Process) (v7action.Warnings, error) diff --git a/actor/v7pushaction/v7pushactionfakes/fake_v7actor.go b/actor/v7pushaction/v7pushactionfakes/fake_v7actor.go index c9e8539321e..76d8d4d185d 100644 --- a/actor/v7pushaction/v7pushactionfakes/fake_v7actor.go +++ b/actor/v7pushaction/v7pushactionfakes/fake_v7actor.go @@ -58,18 +58,17 @@ type FakeV7Actor struct { result2 v7action.Warnings result3 error } - CreateDeploymentByApplicationAndDropletStub func(string, string) (string, v7action.Warnings, error) - createDeploymentByApplicationAndDropletMutex sync.RWMutex - createDeploymentByApplicationAndDropletArgsForCall []struct { - arg1 string - arg2 string + CreateDeploymentStub func(resources.Deployment) (string, v7action.Warnings, error) + createDeploymentMutex sync.RWMutex + createDeploymentArgsForCall []struct { + arg1 resources.Deployment } - createDeploymentByApplicationAndDropletReturns struct { + createDeploymentReturns struct { result1 string result2 v7action.Warnings result3 error } - createDeploymentByApplicationAndDropletReturnsOnCall map[int]struct { + createDeploymentReturnsOnCall map[int]struct { result1 string result2 v7action.Warnings result3 error @@ -295,19 +294,19 @@ type FakeV7Actor struct { result1 v7action.Warnings result2 error } - PollStartForRollingStub func(resources.Application, string, bool, func(string)) (v7action.Warnings, error) - pollStartForRollingMutex sync.RWMutex - pollStartForRollingArgsForCall []struct { + PollStartForDeploymentStub func(resources.Application, string, bool, func(string)) (v7action.Warnings, error) + pollStartForDeploymentMutex sync.RWMutex + pollStartForDeploymentArgsForCall []struct { arg1 resources.Application arg2 string arg3 bool arg4 func(string) } - pollStartForRollingReturns struct { + pollStartForDeploymentReturns struct { result1 v7action.Warnings result2 error } - pollStartForRollingReturnsOnCall map[int]struct { + pollStartForDeploymentReturnsOnCall map[int]struct { result1 v7action.Warnings result2 error } @@ -512,15 +511,16 @@ func (fake *FakeV7Actor) CreateApplicationDroplet(arg1 string) (resources.Drople fake.createApplicationDropletArgsForCall = append(fake.createApplicationDropletArgsForCall, struct { arg1 string }{arg1}) + stub := fake.CreateApplicationDropletStub + fakeReturns := fake.createApplicationDropletReturns fake.recordInvocation("CreateApplicationDroplet", []interface{}{arg1}) fake.createApplicationDropletMutex.Unlock() - if fake.CreateApplicationDropletStub != nil { - return fake.CreateApplicationDropletStub(arg1) + if stub != nil { + return stub(arg1) } if specificReturn { return ret.result1, ret.result2, ret.result3 } - fakeReturns := fake.createApplicationDropletReturns return fakeReturns.result1, fakeReturns.result2, fakeReturns.result3 } @@ -579,15 +579,16 @@ func (fake *FakeV7Actor) CreateApplicationInSpace(arg1 resources.Application, ar arg1 resources.Application arg2 string }{arg1, arg2}) + stub := fake.CreateApplicationInSpaceStub + fakeReturns := fake.createApplicationInSpaceReturns fake.recordInvocation("CreateApplicationInSpace", []interface{}{arg1, arg2}) fake.createApplicationInSpaceMutex.Unlock() - if fake.CreateApplicationInSpaceStub != nil { - return fake.CreateApplicationInSpaceStub(arg1, arg2) + if stub != nil { + return stub(arg1, arg2) } if specificReturn { return ret.result1, ret.result2, ret.result3 } - fakeReturns := fake.createApplicationInSpaceReturns return fakeReturns.result1, fakeReturns.result2, fakeReturns.result3 } @@ -645,15 +646,16 @@ func (fake *FakeV7Actor) CreateBitsPackageByApplication(arg1 string) (resources. fake.createBitsPackageByApplicationArgsForCall = append(fake.createBitsPackageByApplicationArgsForCall, struct { arg1 string }{arg1}) + stub := fake.CreateBitsPackageByApplicationStub + fakeReturns := fake.createBitsPackageByApplicationReturns fake.recordInvocation("CreateBitsPackageByApplication", []interface{}{arg1}) fake.createBitsPackageByApplicationMutex.Unlock() - if fake.CreateBitsPackageByApplicationStub != nil { - return fake.CreateBitsPackageByApplicationStub(arg1) + if stub != nil { + return stub(arg1) } if specificReturn { return ret.result1, ret.result2, ret.result3 } - fakeReturns := fake.createBitsPackageByApplicationReturns return fakeReturns.result1, fakeReturns.result2, fakeReturns.result3 } @@ -705,67 +707,67 @@ func (fake *FakeV7Actor) CreateBitsPackageByApplicationReturnsOnCall(i int, resu }{result1, result2, result3} } -func (fake *FakeV7Actor) CreateDeploymentByApplicationAndDroplet(arg1 string, arg2 string) (string, v7action.Warnings, error) { - fake.createDeploymentByApplicationAndDropletMutex.Lock() - ret, specificReturn := fake.createDeploymentByApplicationAndDropletReturnsOnCall[len(fake.createDeploymentByApplicationAndDropletArgsForCall)] - fake.createDeploymentByApplicationAndDropletArgsForCall = append(fake.createDeploymentByApplicationAndDropletArgsForCall, struct { - arg1 string - arg2 string - }{arg1, arg2}) - fake.recordInvocation("CreateDeploymentByApplicationAndDroplet", []interface{}{arg1, arg2}) - fake.createDeploymentByApplicationAndDropletMutex.Unlock() - if fake.CreateDeploymentByApplicationAndDropletStub != nil { - return fake.CreateDeploymentByApplicationAndDropletStub(arg1, arg2) +func (fake *FakeV7Actor) CreateDeployment(arg1 resources.Deployment) (string, v7action.Warnings, error) { + fake.createDeploymentMutex.Lock() + ret, specificReturn := fake.createDeploymentReturnsOnCall[len(fake.createDeploymentArgsForCall)] + fake.createDeploymentArgsForCall = append(fake.createDeploymentArgsForCall, struct { + arg1 resources.Deployment + }{arg1}) + stub := fake.CreateDeploymentStub + fakeReturns := fake.createDeploymentReturns + fake.recordInvocation("CreateDeployment", []interface{}{arg1}) + fake.createDeploymentMutex.Unlock() + if stub != nil { + return stub(arg1) } if specificReturn { return ret.result1, ret.result2, ret.result3 } - fakeReturns := fake.createDeploymentByApplicationAndDropletReturns return fakeReturns.result1, fakeReturns.result2, fakeReturns.result3 } -func (fake *FakeV7Actor) CreateDeploymentByApplicationAndDropletCallCount() int { - fake.createDeploymentByApplicationAndDropletMutex.RLock() - defer fake.createDeploymentByApplicationAndDropletMutex.RUnlock() - return len(fake.createDeploymentByApplicationAndDropletArgsForCall) +func (fake *FakeV7Actor) CreateDeploymentCallCount() int { + fake.createDeploymentMutex.RLock() + defer fake.createDeploymentMutex.RUnlock() + return len(fake.createDeploymentArgsForCall) } -func (fake *FakeV7Actor) CreateDeploymentByApplicationAndDropletCalls(stub func(string, string) (string, v7action.Warnings, error)) { - fake.createDeploymentByApplicationAndDropletMutex.Lock() - defer fake.createDeploymentByApplicationAndDropletMutex.Unlock() - fake.CreateDeploymentByApplicationAndDropletStub = stub +func (fake *FakeV7Actor) CreateDeploymentCalls(stub func(resources.Deployment) (string, v7action.Warnings, error)) { + fake.createDeploymentMutex.Lock() + defer fake.createDeploymentMutex.Unlock() + fake.CreateDeploymentStub = stub } -func (fake *FakeV7Actor) CreateDeploymentByApplicationAndDropletArgsForCall(i int) (string, string) { - fake.createDeploymentByApplicationAndDropletMutex.RLock() - defer fake.createDeploymentByApplicationAndDropletMutex.RUnlock() - argsForCall := fake.createDeploymentByApplicationAndDropletArgsForCall[i] - return argsForCall.arg1, argsForCall.arg2 +func (fake *FakeV7Actor) CreateDeploymentArgsForCall(i int) resources.Deployment { + fake.createDeploymentMutex.RLock() + defer fake.createDeploymentMutex.RUnlock() + argsForCall := fake.createDeploymentArgsForCall[i] + return argsForCall.arg1 } -func (fake *FakeV7Actor) CreateDeploymentByApplicationAndDropletReturns(result1 string, result2 v7action.Warnings, result3 error) { - fake.createDeploymentByApplicationAndDropletMutex.Lock() - defer fake.createDeploymentByApplicationAndDropletMutex.Unlock() - fake.CreateDeploymentByApplicationAndDropletStub = nil - fake.createDeploymentByApplicationAndDropletReturns = struct { +func (fake *FakeV7Actor) CreateDeploymentReturns(result1 string, result2 v7action.Warnings, result3 error) { + fake.createDeploymentMutex.Lock() + defer fake.createDeploymentMutex.Unlock() + fake.CreateDeploymentStub = nil + fake.createDeploymentReturns = struct { result1 string result2 v7action.Warnings result3 error }{result1, result2, result3} } -func (fake *FakeV7Actor) CreateDeploymentByApplicationAndDropletReturnsOnCall(i int, result1 string, result2 v7action.Warnings, result3 error) { - fake.createDeploymentByApplicationAndDropletMutex.Lock() - defer fake.createDeploymentByApplicationAndDropletMutex.Unlock() - fake.CreateDeploymentByApplicationAndDropletStub = nil - if fake.createDeploymentByApplicationAndDropletReturnsOnCall == nil { - fake.createDeploymentByApplicationAndDropletReturnsOnCall = make(map[int]struct { +func (fake *FakeV7Actor) CreateDeploymentReturnsOnCall(i int, result1 string, result2 v7action.Warnings, result3 error) { + fake.createDeploymentMutex.Lock() + defer fake.createDeploymentMutex.Unlock() + fake.CreateDeploymentStub = nil + if fake.createDeploymentReturnsOnCall == nil { + fake.createDeploymentReturnsOnCall = make(map[int]struct { result1 string result2 v7action.Warnings result3 error }) } - fake.createDeploymentByApplicationAndDropletReturnsOnCall[i] = struct { + fake.createDeploymentReturnsOnCall[i] = struct { result1 string result2 v7action.Warnings result3 error @@ -779,15 +781,16 @@ func (fake *FakeV7Actor) CreateDockerPackageByApplication(arg1 string, arg2 v7ac arg1 string arg2 v7action.DockerImageCredentials }{arg1, arg2}) + stub := fake.CreateDockerPackageByApplicationStub + fakeReturns := fake.createDockerPackageByApplicationReturns fake.recordInvocation("CreateDockerPackageByApplication", []interface{}{arg1, arg2}) fake.createDockerPackageByApplicationMutex.Unlock() - if fake.CreateDockerPackageByApplicationStub != nil { - return fake.CreateDockerPackageByApplicationStub(arg1, arg2) + if stub != nil { + return stub(arg1, arg2) } if specificReturn { return ret.result1, ret.result2, ret.result3 } - fakeReturns := fake.createDockerPackageByApplicationReturns return fakeReturns.result1, fakeReturns.result2, fakeReturns.result3 } @@ -849,15 +852,16 @@ func (fake *FakeV7Actor) CreateRoute(arg1 string, arg2 string, arg3 string, arg4 arg4 string arg5 int }{arg1, arg2, arg3, arg4, arg5}) + stub := fake.CreateRouteStub + fakeReturns := fake.createRouteReturns fake.recordInvocation("CreateRoute", []interface{}{arg1, arg2, arg3, arg4, arg5}) fake.createRouteMutex.Unlock() - if fake.CreateRouteStub != nil { - return fake.CreateRouteStub(arg1, arg2, arg3, arg4, arg5) + if stub != nil { + return stub(arg1, arg2, arg3, arg4, arg5) } if specificReturn { return ret.result1, ret.result2, ret.result3 } - fakeReturns := fake.createRouteReturns return fakeReturns.result1, fakeReturns.result2, fakeReturns.result3 } @@ -916,15 +920,16 @@ func (fake *FakeV7Actor) GetApplicationByNameAndSpace(arg1 string, arg2 string) arg1 string arg2 string }{arg1, arg2}) + stub := fake.GetApplicationByNameAndSpaceStub + fakeReturns := fake.getApplicationByNameAndSpaceReturns fake.recordInvocation("GetApplicationByNameAndSpace", []interface{}{arg1, arg2}) fake.getApplicationByNameAndSpaceMutex.Unlock() - if fake.GetApplicationByNameAndSpaceStub != nil { - return fake.GetApplicationByNameAndSpaceStub(arg1, arg2) + if stub != nil { + return stub(arg1, arg2) } if specificReturn { return ret.result1, ret.result2, ret.result3 } - fakeReturns := fake.getApplicationByNameAndSpaceReturns return fakeReturns.result1, fakeReturns.result2, fakeReturns.result3 } @@ -983,15 +988,16 @@ func (fake *FakeV7Actor) GetApplicationDroplets(arg1 string, arg2 string) ([]res arg1 string arg2 string }{arg1, arg2}) + stub := fake.GetApplicationDropletsStub + fakeReturns := fake.getApplicationDropletsReturns fake.recordInvocation("GetApplicationDroplets", []interface{}{arg1, arg2}) fake.getApplicationDropletsMutex.Unlock() - if fake.GetApplicationDropletsStub != nil { - return fake.GetApplicationDropletsStub(arg1, arg2) + if stub != nil { + return stub(arg1, arg2) } if specificReturn { return ret.result1, ret.result2, ret.result3 } - fakeReturns := fake.getApplicationDropletsReturns return fakeReturns.result1, fakeReturns.result2, fakeReturns.result3 } @@ -1049,15 +1055,16 @@ func (fake *FakeV7Actor) GetApplicationRoutes(arg1 string) ([]resources.Route, v fake.getApplicationRoutesArgsForCall = append(fake.getApplicationRoutesArgsForCall, struct { arg1 string }{arg1}) + stub := fake.GetApplicationRoutesStub + fakeReturns := fake.getApplicationRoutesReturns fake.recordInvocation("GetApplicationRoutes", []interface{}{arg1}) fake.getApplicationRoutesMutex.Unlock() - if fake.GetApplicationRoutesStub != nil { - return fake.GetApplicationRoutesStub(arg1) + if stub != nil { + return stub(arg1) } if specificReturn { return ret.result1, ret.result2, ret.result3 } - fakeReturns := fake.getApplicationRoutesReturns return fakeReturns.result1, fakeReturns.result2, fakeReturns.result3 } @@ -1121,15 +1128,16 @@ func (fake *FakeV7Actor) GetApplicationsByNamesAndSpace(arg1 []string, arg2 stri arg1 []string arg2 string }{arg1Copy, arg2}) + stub := fake.GetApplicationsByNamesAndSpaceStub + fakeReturns := fake.getApplicationsByNamesAndSpaceReturns fake.recordInvocation("GetApplicationsByNamesAndSpace", []interface{}{arg1Copy, arg2}) fake.getApplicationsByNamesAndSpaceMutex.Unlock() - if fake.GetApplicationsByNamesAndSpaceStub != nil { - return fake.GetApplicationsByNamesAndSpaceStub(arg1, arg2) + if stub != nil { + return stub(arg1, arg2) } if specificReturn { return ret.result1, ret.result2, ret.result3 } - fakeReturns := fake.getApplicationsByNamesAndSpaceReturns return fakeReturns.result1, fakeReturns.result2, fakeReturns.result3 } @@ -1187,15 +1195,16 @@ func (fake *FakeV7Actor) GetDefaultDomain(arg1 string) (resources.Domain, v7acti fake.getDefaultDomainArgsForCall = append(fake.getDefaultDomainArgsForCall, struct { arg1 string }{arg1}) + stub := fake.GetDefaultDomainStub + fakeReturns := fake.getDefaultDomainReturns fake.recordInvocation("GetDefaultDomain", []interface{}{arg1}) fake.getDefaultDomainMutex.Unlock() - if fake.GetDefaultDomainStub != nil { - return fake.GetDefaultDomainStub(arg1) + if stub != nil { + return stub(arg1) } if specificReturn { return ret.result1, ret.result2, ret.result3 } - fakeReturns := fake.getDefaultDomainReturns return fakeReturns.result1, fakeReturns.result2, fakeReturns.result3 } @@ -1253,15 +1262,16 @@ func (fake *FakeV7Actor) GetDomain(arg1 string) (resources.Domain, v7action.Warn fake.getDomainArgsForCall = append(fake.getDomainArgsForCall, struct { arg1 string }{arg1}) + stub := fake.GetDomainStub + fakeReturns := fake.getDomainReturns fake.recordInvocation("GetDomain", []interface{}{arg1}) fake.getDomainMutex.Unlock() - if fake.GetDomainStub != nil { - return fake.GetDomainStub(arg1) + if stub != nil { + return stub(arg1) } if specificReturn { return ret.result1, ret.result2, ret.result3 } - fakeReturns := fake.getDomainReturns return fakeReturns.result1, fakeReturns.result2, fakeReturns.result3 } @@ -1322,15 +1332,16 @@ func (fake *FakeV7Actor) GetRouteByAttributes(arg1 resources.Domain, arg2 string arg3 string arg4 int }{arg1, arg2, arg3, arg4}) + stub := fake.GetRouteByAttributesStub + fakeReturns := fake.getRouteByAttributesReturns fake.recordInvocation("GetRouteByAttributes", []interface{}{arg1, arg2, arg3, arg4}) fake.getRouteByAttributesMutex.Unlock() - if fake.GetRouteByAttributesStub != nil { - return fake.GetRouteByAttributesStub(arg1, arg2, arg3, arg4) + if stub != nil { + return stub(arg1, arg2, arg3, arg4) } if specificReturn { return ret.result1, ret.result2, ret.result3 } - fakeReturns := fake.getRouteByAttributesReturns return fakeReturns.result1, fakeReturns.result2, fakeReturns.result3 } @@ -1389,15 +1400,16 @@ func (fake *FakeV7Actor) GetRouteDestinationByAppGUID(arg1 resources.Route, arg2 arg1 resources.Route arg2 string }{arg1, arg2}) + stub := fake.GetRouteDestinationByAppGUIDStub + fakeReturns := fake.getRouteDestinationByAppGUIDReturns fake.recordInvocation("GetRouteDestinationByAppGUID", []interface{}{arg1, arg2}) fake.getRouteDestinationByAppGUIDMutex.Unlock() - if fake.GetRouteDestinationByAppGUIDStub != nil { - return fake.GetRouteDestinationByAppGUIDStub(arg1, arg2) + if stub != nil { + return stub(arg1, arg2) } if specificReturn { return ret.result1, ret.result2 } - fakeReturns := fake.getRouteDestinationByAppGUIDReturns return fakeReturns.result1, fakeReturns.result2 } @@ -1454,15 +1466,16 @@ func (fake *FakeV7Actor) MapRoute(arg1 string, arg2 string, arg3 string) (v7acti arg2 string arg3 string }{arg1, arg2, arg3}) + stub := fake.MapRouteStub + fakeReturns := fake.mapRouteReturns fake.recordInvocation("MapRoute", []interface{}{arg1, arg2, arg3}) fake.mapRouteMutex.Unlock() - if fake.MapRouteStub != nil { - return fake.MapRouteStub(arg1, arg2, arg3) + if stub != nil { + return stub(arg1, arg2, arg3) } if specificReturn { return ret.result1, ret.result2 } - fakeReturns := fake.mapRouteReturns return fakeReturns.result1, fakeReturns.result2 } @@ -1518,15 +1531,16 @@ func (fake *FakeV7Actor) PollBuild(arg1 string, arg2 string) (resources.Droplet, arg1 string arg2 string }{arg1, arg2}) + stub := fake.PollBuildStub + fakeReturns := fake.pollBuildReturns fake.recordInvocation("PollBuild", []interface{}{arg1, arg2}) fake.pollBuildMutex.Unlock() - if fake.PollBuildStub != nil { - return fake.PollBuildStub(arg1, arg2) + if stub != nil { + return stub(arg1, arg2) } if specificReturn { return ret.result1, ret.result2, ret.result3 } - fakeReturns := fake.pollBuildReturns return fakeReturns.result1, fakeReturns.result2, fakeReturns.result3 } @@ -1584,15 +1598,16 @@ func (fake *FakeV7Actor) PollPackage(arg1 resources.Package) (resources.Package, fake.pollPackageArgsForCall = append(fake.pollPackageArgsForCall, struct { arg1 resources.Package }{arg1}) + stub := fake.PollPackageStub + fakeReturns := fake.pollPackageReturns fake.recordInvocation("PollPackage", []interface{}{arg1}) fake.pollPackageMutex.Unlock() - if fake.PollPackageStub != nil { - return fake.PollPackageStub(arg1) + if stub != nil { + return stub(arg1) } if specificReturn { return ret.result1, ret.result2, ret.result3 } - fakeReturns := fake.pollPackageReturns return fakeReturns.result1, fakeReturns.result2, fakeReturns.result3 } @@ -1652,15 +1667,16 @@ func (fake *FakeV7Actor) PollStart(arg1 resources.Application, arg2 bool, arg3 f arg2 bool arg3 func(string) }{arg1, arg2, arg3}) + stub := fake.PollStartStub + fakeReturns := fake.pollStartReturns fake.recordInvocation("PollStart", []interface{}{arg1, arg2, arg3}) fake.pollStartMutex.Unlock() - if fake.PollStartStub != nil { - return fake.PollStartStub(arg1, arg2, arg3) + if stub != nil { + return stub(arg1, arg2, arg3) } if specificReturn { return ret.result1, ret.result2 } - fakeReturns := fake.pollStartReturns return fakeReturns.result1, fakeReturns.result2 } @@ -1709,67 +1725,68 @@ func (fake *FakeV7Actor) PollStartReturnsOnCall(i int, result1 v7action.Warnings }{result1, result2} } -func (fake *FakeV7Actor) PollStartForRolling(arg1 resources.Application, arg2 string, arg3 bool, arg4 func(string)) (v7action.Warnings, error) { - fake.pollStartForRollingMutex.Lock() - ret, specificReturn := fake.pollStartForRollingReturnsOnCall[len(fake.pollStartForRollingArgsForCall)] - fake.pollStartForRollingArgsForCall = append(fake.pollStartForRollingArgsForCall, struct { +func (fake *FakeV7Actor) PollStartForDeployment(arg1 resources.Application, arg2 string, arg3 bool, arg4 func(string)) (v7action.Warnings, error) { + fake.pollStartForDeploymentMutex.Lock() + ret, specificReturn := fake.pollStartForDeploymentReturnsOnCall[len(fake.pollStartForDeploymentArgsForCall)] + fake.pollStartForDeploymentArgsForCall = append(fake.pollStartForDeploymentArgsForCall, struct { arg1 resources.Application arg2 string arg3 bool arg4 func(string) }{arg1, arg2, arg3, arg4}) - fake.recordInvocation("PollStartForRolling", []interface{}{arg1, arg2, arg3, arg4}) - fake.pollStartForRollingMutex.Unlock() - if fake.PollStartForRollingStub != nil { - return fake.PollStartForRollingStub(arg1, arg2, arg3, arg4) + stub := fake.PollStartForDeploymentStub + fakeReturns := fake.pollStartForDeploymentReturns + fake.recordInvocation("PollStartForDeployment", []interface{}{arg1, arg2, arg3, arg4}) + fake.pollStartForDeploymentMutex.Unlock() + if stub != nil { + return stub(arg1, arg2, arg3, arg4) } if specificReturn { return ret.result1, ret.result2 } - fakeReturns := fake.pollStartForRollingReturns return fakeReturns.result1, fakeReturns.result2 } -func (fake *FakeV7Actor) PollStartForRollingCallCount() int { - fake.pollStartForRollingMutex.RLock() - defer fake.pollStartForRollingMutex.RUnlock() - return len(fake.pollStartForRollingArgsForCall) +func (fake *FakeV7Actor) PollStartForDeploymentCallCount() int { + fake.pollStartForDeploymentMutex.RLock() + defer fake.pollStartForDeploymentMutex.RUnlock() + return len(fake.pollStartForDeploymentArgsForCall) } -func (fake *FakeV7Actor) PollStartForRollingCalls(stub func(resources.Application, string, bool, func(string)) (v7action.Warnings, error)) { - fake.pollStartForRollingMutex.Lock() - defer fake.pollStartForRollingMutex.Unlock() - fake.PollStartForRollingStub = stub +func (fake *FakeV7Actor) PollStartForDeploymentCalls(stub func(resources.Application, string, bool, func(string)) (v7action.Warnings, error)) { + fake.pollStartForDeploymentMutex.Lock() + defer fake.pollStartForDeploymentMutex.Unlock() + fake.PollStartForDeploymentStub = stub } -func (fake *FakeV7Actor) PollStartForRollingArgsForCall(i int) (resources.Application, string, bool, func(string)) { - fake.pollStartForRollingMutex.RLock() - defer fake.pollStartForRollingMutex.RUnlock() - argsForCall := fake.pollStartForRollingArgsForCall[i] +func (fake *FakeV7Actor) PollStartForDeploymentArgsForCall(i int) (resources.Application, string, bool, func(string)) { + fake.pollStartForDeploymentMutex.RLock() + defer fake.pollStartForDeploymentMutex.RUnlock() + argsForCall := fake.pollStartForDeploymentArgsForCall[i] return argsForCall.arg1, argsForCall.arg2, argsForCall.arg3, argsForCall.arg4 } -func (fake *FakeV7Actor) PollStartForRollingReturns(result1 v7action.Warnings, result2 error) { - fake.pollStartForRollingMutex.Lock() - defer fake.pollStartForRollingMutex.Unlock() - fake.PollStartForRollingStub = nil - fake.pollStartForRollingReturns = struct { +func (fake *FakeV7Actor) PollStartForDeploymentReturns(result1 v7action.Warnings, result2 error) { + fake.pollStartForDeploymentMutex.Lock() + defer fake.pollStartForDeploymentMutex.Unlock() + fake.PollStartForDeploymentStub = nil + fake.pollStartForDeploymentReturns = struct { result1 v7action.Warnings result2 error }{result1, result2} } -func (fake *FakeV7Actor) PollStartForRollingReturnsOnCall(i int, result1 v7action.Warnings, result2 error) { - fake.pollStartForRollingMutex.Lock() - defer fake.pollStartForRollingMutex.Unlock() - fake.PollStartForRollingStub = nil - if fake.pollStartForRollingReturnsOnCall == nil { - fake.pollStartForRollingReturnsOnCall = make(map[int]struct { +func (fake *FakeV7Actor) PollStartForDeploymentReturnsOnCall(i int, result1 v7action.Warnings, result2 error) { + fake.pollStartForDeploymentMutex.Lock() + defer fake.pollStartForDeploymentMutex.Unlock() + fake.PollStartForDeploymentStub = nil + if fake.pollStartForDeploymentReturnsOnCall == nil { + fake.pollStartForDeploymentReturnsOnCall = make(map[int]struct { result1 v7action.Warnings result2 error }) } - fake.pollStartForRollingReturnsOnCall[i] = struct { + fake.pollStartForDeploymentReturnsOnCall[i] = struct { result1 v7action.Warnings result2 error }{result1, result2} @@ -1786,15 +1803,16 @@ func (fake *FakeV7Actor) ResourceMatch(arg1 []sharedaction.V3Resource) ([]shared fake.resourceMatchArgsForCall = append(fake.resourceMatchArgsForCall, struct { arg1 []sharedaction.V3Resource }{arg1Copy}) + stub := fake.ResourceMatchStub + fakeReturns := fake.resourceMatchReturns fake.recordInvocation("ResourceMatch", []interface{}{arg1Copy}) fake.resourceMatchMutex.Unlock() - if fake.ResourceMatchStub != nil { - return fake.ResourceMatchStub(arg1) + if stub != nil { + return stub(arg1) } if specificReturn { return ret.result1, ret.result2, ret.result3 } - fakeReturns := fake.resourceMatchReturns return fakeReturns.result1, fakeReturns.result2, fakeReturns.result3 } @@ -1853,15 +1871,16 @@ func (fake *FakeV7Actor) RestartApplication(arg1 string, arg2 bool) (v7action.Wa arg1 string arg2 bool }{arg1, arg2}) + stub := fake.RestartApplicationStub + fakeReturns := fake.restartApplicationReturns fake.recordInvocation("RestartApplication", []interface{}{arg1, arg2}) fake.restartApplicationMutex.Unlock() - if fake.RestartApplicationStub != nil { - return fake.RestartApplicationStub(arg1, arg2) + if stub != nil { + return stub(arg1, arg2) } if specificReturn { return ret.result1, ret.result2 } - fakeReturns := fake.restartApplicationReturns return fakeReturns.result1, fakeReturns.result2 } @@ -1917,15 +1936,16 @@ func (fake *FakeV7Actor) ScaleProcessByApplication(arg1 string, arg2 resources.P arg1 string arg2 resources.Process }{arg1, arg2}) + stub := fake.ScaleProcessByApplicationStub + fakeReturns := fake.scaleProcessByApplicationReturns fake.recordInvocation("ScaleProcessByApplication", []interface{}{arg1, arg2}) fake.scaleProcessByApplicationMutex.Unlock() - if fake.ScaleProcessByApplicationStub != nil { - return fake.ScaleProcessByApplicationStub(arg1, arg2) + if stub != nil { + return stub(arg1, arg2) } if specificReturn { return ret.result1, ret.result2 } - fakeReturns := fake.scaleProcessByApplicationReturns return fakeReturns.result1, fakeReturns.result2 } @@ -1981,15 +2001,16 @@ func (fake *FakeV7Actor) SetApplicationDroplet(arg1 string, arg2 string) (v7acti arg1 string arg2 string }{arg1, arg2}) + stub := fake.SetApplicationDropletStub + fakeReturns := fake.setApplicationDropletReturns fake.recordInvocation("SetApplicationDroplet", []interface{}{arg1, arg2}) fake.setApplicationDropletMutex.Unlock() - if fake.SetApplicationDropletStub != nil { - return fake.SetApplicationDropletStub(arg1, arg2) + if stub != nil { + return stub(arg1, arg2) } if specificReturn { return ret.result1, ret.result2 } - fakeReturns := fake.setApplicationDropletReturns return fakeReturns.result1, fakeReturns.result2 } @@ -2050,15 +2071,16 @@ func (fake *FakeV7Actor) SetApplicationManifest(arg1 string, arg2 []byte) (v7act arg1 string arg2 []byte }{arg1, arg2Copy}) + stub := fake.SetApplicationManifestStub + fakeReturns := fake.setApplicationManifestReturns fake.recordInvocation("SetApplicationManifest", []interface{}{arg1, arg2Copy}) fake.setApplicationManifestMutex.Unlock() - if fake.SetApplicationManifestStub != nil { - return fake.SetApplicationManifestStub(arg1, arg2) + if stub != nil { + return stub(arg1, arg2) } if specificReturn { return ret.result1, ret.result2 } - fakeReturns := fake.setApplicationManifestReturns return fakeReturns.result1, fakeReturns.result2 } @@ -2119,15 +2141,16 @@ func (fake *FakeV7Actor) SetSpaceManifest(arg1 string, arg2 []byte) (v7action.Wa arg1 string arg2 []byte }{arg1, arg2Copy}) + stub := fake.SetSpaceManifestStub + fakeReturns := fake.setSpaceManifestReturns fake.recordInvocation("SetSpaceManifest", []interface{}{arg1, arg2Copy}) fake.setSpaceManifestMutex.Unlock() - if fake.SetSpaceManifestStub != nil { - return fake.SetSpaceManifestStub(arg1, arg2) + if stub != nil { + return stub(arg1, arg2) } if specificReturn { return ret.result1, ret.result2 } - fakeReturns := fake.setSpaceManifestReturns return fakeReturns.result1, fakeReturns.result2 } @@ -2182,15 +2205,16 @@ func (fake *FakeV7Actor) StageApplicationPackage(arg1 string) (resources.Build, fake.stageApplicationPackageArgsForCall = append(fake.stageApplicationPackageArgsForCall, struct { arg1 string }{arg1}) + stub := fake.StageApplicationPackageStub + fakeReturns := fake.stageApplicationPackageReturns fake.recordInvocation("StageApplicationPackage", []interface{}{arg1}) fake.stageApplicationPackageMutex.Unlock() - if fake.StageApplicationPackageStub != nil { - return fake.StageApplicationPackageStub(arg1) + if stub != nil { + return stub(arg1) } if specificReturn { return ret.result1, ret.result2, ret.result3 } - fakeReturns := fake.stageApplicationPackageReturns return fakeReturns.result1, fakeReturns.result2, fakeReturns.result3 } @@ -2248,15 +2272,16 @@ func (fake *FakeV7Actor) StopApplication(arg1 string) (v7action.Warnings, error) fake.stopApplicationArgsForCall = append(fake.stopApplicationArgsForCall, struct { arg1 string }{arg1}) + stub := fake.StopApplicationStub + fakeReturns := fake.stopApplicationReturns fake.recordInvocation("StopApplication", []interface{}{arg1}) fake.stopApplicationMutex.Unlock() - if fake.StopApplicationStub != nil { - return fake.StopApplicationStub(arg1) + if stub != nil { + return stub(arg1) } if specificReturn { return ret.result1, ret.result2 } - fakeReturns := fake.stopApplicationReturns return fakeReturns.result1, fakeReturns.result2 } @@ -2312,15 +2337,16 @@ func (fake *FakeV7Actor) UnmapRoute(arg1 string, arg2 string) (v7action.Warnings arg1 string arg2 string }{arg1, arg2}) + stub := fake.UnmapRouteStub + fakeReturns := fake.unmapRouteReturns fake.recordInvocation("UnmapRoute", []interface{}{arg1, arg2}) fake.unmapRouteMutex.Unlock() - if fake.UnmapRouteStub != nil { - return fake.UnmapRouteStub(arg1, arg2) + if stub != nil { + return stub(arg1, arg2) } if specificReturn { return ret.result1, ret.result2 } - fakeReturns := fake.unmapRouteReturns return fakeReturns.result1, fakeReturns.result2 } @@ -2375,15 +2401,16 @@ func (fake *FakeV7Actor) UpdateApplication(arg1 resources.Application) (resource fake.updateApplicationArgsForCall = append(fake.updateApplicationArgsForCall, struct { arg1 resources.Application }{arg1}) + stub := fake.UpdateApplicationStub + fakeReturns := fake.updateApplicationReturns fake.recordInvocation("UpdateApplication", []interface{}{arg1}) fake.updateApplicationMutex.Unlock() - if fake.UpdateApplicationStub != nil { - return fake.UpdateApplicationStub(arg1) + if stub != nil { + return stub(arg1) } if specificReturn { return ret.result1, ret.result2, ret.result3 } - fakeReturns := fake.updateApplicationReturns return fakeReturns.result1, fakeReturns.result2, fakeReturns.result3 } @@ -2443,15 +2470,16 @@ func (fake *FakeV7Actor) UpdateProcessByTypeAndApplication(arg1 string, arg2 str arg2 string arg3 resources.Process }{arg1, arg2, arg3}) + stub := fake.UpdateProcessByTypeAndApplicationStub + fakeReturns := fake.updateProcessByTypeAndApplicationReturns fake.recordInvocation("UpdateProcessByTypeAndApplication", []interface{}{arg1, arg2, arg3}) fake.updateProcessByTypeAndApplicationMutex.Unlock() - if fake.UpdateProcessByTypeAndApplicationStub != nil { - return fake.UpdateProcessByTypeAndApplicationStub(arg1, arg2, arg3) + if stub != nil { + return stub(arg1, arg2, arg3) } if specificReturn { return ret.result1, ret.result2 } - fakeReturns := fake.updateProcessByTypeAndApplicationReturns return fakeReturns.result1, fakeReturns.result2 } @@ -2514,15 +2542,16 @@ func (fake *FakeV7Actor) UploadBitsPackage(arg1 resources.Package, arg2 []shared arg3 io.Reader arg4 int64 }{arg1, arg2Copy, arg3, arg4}) + stub := fake.UploadBitsPackageStub + fakeReturns := fake.uploadBitsPackageReturns fake.recordInvocation("UploadBitsPackage", []interface{}{arg1, arg2Copy, arg3, arg4}) fake.uploadBitsPackageMutex.Unlock() - if fake.UploadBitsPackageStub != nil { - return fake.UploadBitsPackageStub(arg1, arg2, arg3, arg4) + if stub != nil { + return stub(arg1, arg2, arg3, arg4) } if specificReturn { return ret.result1, ret.result2, ret.result3 } - fakeReturns := fake.uploadBitsPackageReturns return fakeReturns.result1, fakeReturns.result2, fakeReturns.result3 } @@ -2583,15 +2612,16 @@ func (fake *FakeV7Actor) UploadDroplet(arg1 string, arg2 string, arg3 io.Reader, arg3 io.Reader arg4 int64 }{arg1, arg2, arg3, arg4}) + stub := fake.UploadDropletStub + fakeReturns := fake.uploadDropletReturns fake.recordInvocation("UploadDroplet", []interface{}{arg1, arg2, arg3, arg4}) fake.uploadDropletMutex.Unlock() - if fake.UploadDropletStub != nil { - return fake.UploadDropletStub(arg1, arg2, arg3, arg4) + if stub != nil { + return stub(arg1, arg2, arg3, arg4) } if specificReturn { return ret.result1, ret.result2 } - fakeReturns := fake.uploadDropletReturns return fakeReturns.result1, fakeReturns.result2 } @@ -2649,8 +2679,8 @@ func (fake *FakeV7Actor) Invocations() map[string][][]interface{} { defer fake.createApplicationInSpaceMutex.RUnlock() fake.createBitsPackageByApplicationMutex.RLock() defer fake.createBitsPackageByApplicationMutex.RUnlock() - fake.createDeploymentByApplicationAndDropletMutex.RLock() - defer fake.createDeploymentByApplicationAndDropletMutex.RUnlock() + fake.createDeploymentMutex.RLock() + defer fake.createDeploymentMutex.RUnlock() fake.createDockerPackageByApplicationMutex.RLock() defer fake.createDockerPackageByApplicationMutex.RUnlock() fake.createRouteMutex.RLock() @@ -2679,8 +2709,8 @@ func (fake *FakeV7Actor) Invocations() map[string][][]interface{} { defer fake.pollPackageMutex.RUnlock() fake.pollStartMutex.RLock() defer fake.pollStartMutex.RUnlock() - fake.pollStartForRollingMutex.RLock() - defer fake.pollStartForRollingMutex.RUnlock() + fake.pollStartForDeploymentMutex.RLock() + defer fake.pollStartForDeploymentMutex.RUnlock() fake.resourceMatchMutex.RLock() defer fake.resourceMatchMutex.RUnlock() fake.restartApplicationMutex.RLock() diff --git a/api/cloudcontroller/ccv3/constant/deployment.go b/api/cloudcontroller/ccv3/constant/deployment.go index 86c2a1194da..2ae6159ebb7 100644 --- a/api/cloudcontroller/ccv3/constant/deployment.go +++ b/api/cloudcontroller/ccv3/constant/deployment.go @@ -5,61 +5,29 @@ package constant type DeploymentState string const ( - // DeploymentDeploying means the deployment is in state 'DEPLOYING' DeploymentDeploying DeploymentState = "DEPLOYING" - - // DeploymentCanceled means the deployment is in state 'CANCELED' - DeploymentCanceled DeploymentState = "CANCELED" - - // DeploymentDeployed means the deployment is in state 'DEPLOYED' - DeploymentDeployed DeploymentState = "DEPLOYED" - - // DeploymentCanceled means the deployment is in state 'CANCELING' + DeploymentCanceled DeploymentState = "CANCELED" + DeploymentDeployed DeploymentState = "DEPLOYED" DeploymentCanceling DeploymentState = "CANCELING" - - // DeploymentFailing means the deployment is in state 'FAILING' - DeploymentFailing DeploymentState = "FAILING" - - // DeploymentFailed means the deployment is in state 'FAILED' - DeploymentFailed DeploymentState = "FAILED" + DeploymentFailing DeploymentState = "FAILING" + DeploymentFailed DeploymentState = "FAILED" ) // DeploymentStatusReason describes the status reasons a deployment can have type DeploymentStatusReason string const ( - // DeploymentStatusReasonDeploying means the deployment is in state 'DEPLOYING' - DeploymentStatusReasonDeploying DeploymentStatusReason = "DEPLOYING" - - // DeploymentCanceling means the deployment is in state 'CANCELING' - DeploymentStatusReasonCanceling DeploymentStatusReason = "CANCELING" - - // DeploymentStatusReasonDeployed means the deployment's status.value is - // 'DEPLOYED' - DeploymentStatusReasonDeployed DeploymentStatusReason = "DEPLOYED" - - // DeploymentStatusReasonCanceled means the deployment's status.value is - // 'CANCELED' - DeploymentStatusReasonCanceled DeploymentStatusReason = "CANCELED" - - // DeploymentStatusReasonSuperseded means the deployment's status.value is - // 'SUPERSEDED' + DeploymentStatusReasonDeploying DeploymentStatusReason = "DEPLOYING" + DeploymentStatusReasonCanceling DeploymentStatusReason = "CANCELING" + DeploymentStatusReasonDeployed DeploymentStatusReason = "DEPLOYED" + DeploymentStatusReasonCanceled DeploymentStatusReason = "CANCELED" DeploymentStatusReasonSuperseded DeploymentStatusReason = "SUPERSEDED" - - // DeploymentStatusReasonPaused means the deployment's status.value is - // 'PAUSED' - DeploymentStatusReasonPaused DeploymentStatusReason = "PAUSED" + DeploymentStatusReasonPaused DeploymentStatusReason = "PAUSED" ) -// DeploymentStatusValue describes the status values a deployment can have type DeploymentStatusValue string const ( - // DeploymentStatusValueActive means the deployment's status.value is - // 'ACTIVE' - DeploymentStatusValueActive DeploymentStatusValue = "ACTIVE" - - // DeploymentStatusValueFinalized means the deployment's status.value is - // 'FINALIZED' + DeploymentStatusValueActive DeploymentStatusValue = "ACTIVE" DeploymentStatusValueFinalized DeploymentStatusValue = "FINALIZED" ) diff --git a/api/cloudcontroller/ccv3/deployment.go b/api/cloudcontroller/ccv3/deployment.go index a4dc7da040f..3d72e47f482 100644 --- a/api/cloudcontroller/ccv3/deployment.go +++ b/api/cloudcontroller/ccv3/deployment.go @@ -1,42 +1,29 @@ package ccv3 import ( - "code.cloudfoundry.org/cli/api/cloudcontroller/ccv3/constant" "code.cloudfoundry.org/cli/api/cloudcontroller/ccv3/internal" "code.cloudfoundry.org/cli/resources" ) -func (client *Client) CancelDeployment(deploymentGUID string) (Warnings, error) { +func (client *Client) ContinueDeployment(deploymentGUID string) (Warnings, error) { _, warnings, err := client.MakeRequest(RequestParams{ - RequestName: internal.PostApplicationDeploymentActionCancelRequest, + RequestName: internal.PostApplicationDeploymentActionContinueRequest, URIParams: internal.Params{"deployment_guid": deploymentGUID}, }) return warnings, err } -func (client *Client) CreateApplicationDeployment(appGUID string, dropletGUID string) (string, Warnings, error) { - dep := resources.Deployment{ - DropletGUID: dropletGUID, - Relationships: resources.Relationships{constant.RelationshipTypeApplication: resources.Relationship{GUID: appGUID}}, - } - - var responseBody resources.Deployment - +func (client *Client) CancelDeployment(deploymentGUID string) (Warnings, error) { _, warnings, err := client.MakeRequest(RequestParams{ - RequestName: internal.PostApplicationDeploymentRequest, - RequestBody: dep, - ResponseBody: &responseBody, + RequestName: internal.PostApplicationDeploymentActionCancelRequest, + URIParams: internal.Params{"deployment_guid": deploymentGUID}, }) - return responseBody.GUID, warnings, err + return warnings, err } -func (client *Client) CreateApplicationDeploymentByRevision(appGUID string, revisionGUID string) (string, Warnings, error) { - dep := resources.Deployment{ - RevisionGUID: revisionGUID, - Relationships: resources.Relationships{constant.RelationshipTypeApplication: resources.Relationship{GUID: appGUID}}, - } +func (client *Client) CreateApplicationDeployment(dep resources.Deployment) (string, Warnings, error) { var responseBody resources.Deployment diff --git a/api/cloudcontroller/ccv3/deployment_test.go b/api/cloudcontroller/ccv3/deployment_test.go index 56f336b1437..ad2099583b1 100644 --- a/api/cloudcontroller/ccv3/deployment_test.go +++ b/api/cloudcontroller/ccv3/deployment_test.go @@ -165,7 +165,7 @@ var _ = Describe("Deployment", func() { }) }) - Describe("CreateApplicationDeployment", func() { + Describe("Create a deployment with app and droplet guids", func() { var ( deploymentGUID string warnings Warnings @@ -174,7 +174,11 @@ var _ = Describe("Deployment", func() { ) JustBeforeEach(func() { - deploymentGUID, warnings, executeErr = client.CreateApplicationDeployment("some-app-guid", dropletGUID) + var dep resources.Deployment + dep.Strategy = constant.DeploymentStrategyRolling + dep.DropletGUID = dropletGUID + dep.Relationships = resources.Relationships{constant.RelationshipTypeApplication: resources.Relationship{GUID: "some-app-guid"}} + deploymentGUID, warnings, executeErr = client.CreateApplicationDeployment(dep) }) Context("when the application exists", func() { @@ -184,6 +188,7 @@ var _ = Describe("Deployment", func() { response = `{ "guid": "some-deployment-guid", "created_at": "2018-04-25T22:42:10Z", + "strategy": "rolling", "relationships": { "app": { "data": { @@ -199,7 +204,7 @@ var _ = Describe("Deployment", func() { server.AppendHandlers( CombineHandlers( VerifyRequest(http.MethodPost, "/v3/deployments"), - VerifyJSON(`{"droplet":{ "guid":"some-droplet-guid" }, "relationships":{"app":{"data":{"guid":"some-app-guid"}}}}`), + VerifyJSON(`{"droplet":{ "guid":"some-droplet-guid" }, "strategy": "rolling", "relationships":{"app":{"data":{"guid":"some-app-guid"}}}}`), RespondWith(http.StatusAccepted, response, http.Header{"X-Cf-Warnings": {"warning"}}), ), ) @@ -219,7 +224,7 @@ var _ = Describe("Deployment", func() { server.AppendHandlers( CombineHandlers( VerifyRequest(http.MethodPost, "/v3/deployments"), - VerifyJSON(`{"relationships":{"app":{"data":{"guid":"some-app-guid"}}}}`), + VerifyJSON(`{"strategy":"rolling", "relationships":{"app":{"data":{"guid":"some-app-guid"}}}}`), RespondWith(http.StatusAccepted, response, http.Header{"X-Cf-Warnings": {"warning"}}), ), ) @@ -233,7 +238,7 @@ var _ = Describe("Deployment", func() { }) }) - Describe("CreateApplicationDeploymentByRevision", func() { + Describe("Create a deployment with app and revision guids", func() { var ( deploymentGUID string warnings Warnings @@ -242,7 +247,11 @@ var _ = Describe("Deployment", func() { ) JustBeforeEach(func() { - deploymentGUID, warnings, executeErr = client.CreateApplicationDeploymentByRevision("some-app-guid", revisionGUID) + var dep resources.Deployment + dep.Strategy = constant.DeploymentStrategyCanary + dep.RevisionGUID = revisionGUID + dep.Relationships = resources.Relationships{constant.RelationshipTypeApplication: resources.Relationship{GUID: "some-app-guid"}} + deploymentGUID, warnings, executeErr = client.CreateApplicationDeployment(dep) }) Context("when the application exists", func() { @@ -252,6 +261,7 @@ var _ = Describe("Deployment", func() { response = `{ "guid": "some-deployment-guid", "created_at": "2018-04-25T22:42:10Z", + "strategy": "canary", "relationships": { "app": { "data": { @@ -267,7 +277,7 @@ var _ = Describe("Deployment", func() { server.AppendHandlers( CombineHandlers( VerifyRequest(http.MethodPost, "/v3/deployments"), - VerifyJSON(`{"revision":{ "guid":"some-revision-guid" }, "relationships":{"app":{"data":{"guid":"some-app-guid"}}}}`), + VerifyJSON(`{"revision":{ "guid":"some-revision-guid" }, "strategy": "canary", "relationships":{"app":{"data":{"guid":"some-app-guid"}}}}`), RespondWith(http.StatusAccepted, response, http.Header{"X-Cf-Warnings": {"warning"}}), ), ) @@ -280,6 +290,43 @@ var _ = Describe("Deployment", func() { }) }) }) + + When("the cloud controller version does not support canary deployment", func() { + BeforeEach(func() { + revisionGUID = "some-revision-guid" + response := `{ + "errors": [ + { + "code": 10008, + "detail": "Strategy 'canary' is not a supported deployment strategy", + "title": "CF-UnprocessableEntity" + } + ] +}` + server.AppendHandlers( + CombineHandlers( + VerifyRequest(http.MethodPost, "/v3/deployments"), + VerifyJSON(`{"revision":{ "guid":"some-revision-guid" }, "strategy": "canary", "relationships":{"app":{"data":{"guid":"some-app-guid"}}}}`), + RespondWith(http.StatusTeapot, response, http.Header{}), + ), + ) + }) + + It("returns an error", func() { + fmt.Printf("executeErr: %v\n", executeErr) + Expect(executeErr).To(HaveOccurred()) + Expect(executeErr).To(MatchError(ccerror.V3UnexpectedResponseError{ + ResponseCode: http.StatusTeapot, + V3ErrorResponse: ccerror.V3ErrorResponse{ + Errors: []ccerror.V3Error{{ + Code: 10008, + Detail: "Strategy 'canary' is not a supported deployment strategy", + Title: "CF-UnprocessableEntity", + }}}, + }, + )) + }) + }) }) Describe("GetDeployment", func() { @@ -289,6 +336,7 @@ var _ = Describe("Deployment", func() { response = `{ "guid": "some-deployment-guid", "state": "DEPLOYED", + "strategy": "canary", "status": { "value": "FINALIZED", "reason": "SUPERSEDED" @@ -325,6 +373,7 @@ var _ = Describe("Deployment", func() { Expect(deployment.State).To(Equal(constant.DeploymentDeployed)) Expect(deployment.StatusValue).To(Equal(constant.DeploymentStatusValueFinalized)) Expect(deployment.StatusReason).To(Equal(constant.DeploymentStatusReasonSuperseded)) + Expect(deployment.Strategy).To(Equal(constant.DeploymentStrategyCanary)) }) }) diff --git a/api/cloudcontroller/ccv3/internal/api_routes.go b/api/cloudcontroller/ccv3/internal/api_routes.go index c095b2df4a2..83d740b56af 100644 --- a/api/cloudcontroller/ccv3/internal/api_routes.go +++ b/api/cloudcontroller/ccv3/internal/api_routes.go @@ -138,6 +138,7 @@ const ( PostApplicationActionStartRequest = "PostApplicationActionStart" PostApplicationActionStopRequest = "PostApplicationActionStop" PostApplicationDeploymentActionCancelRequest = "PostApplicationDeploymentActionCancel" + PostApplicationDeploymentActionContinueRequest = "PostApplicationDeploymentActionContinue" PostApplicationDeploymentRequest = "PostApplicationDeployment" PostApplicationProcessActionScaleRequest = "PostApplicationProcessActionScale" PostApplicationRequest = "PostApplication" @@ -219,6 +220,7 @@ var APIRoutes = map[string]Route{ PostApplicationDeploymentRequest: {Path: "/v3/deployments", Method: http.MethodPost}, GetDeploymentRequest: {Path: "/v3/deployments/:deployment_guid", Method: http.MethodGet}, PostApplicationDeploymentActionCancelRequest: {Path: "/v3/deployments/:deployment_guid/actions/cancel", Method: http.MethodPost}, + PostApplicationDeploymentActionContinueRequest: {Path: "/v3/deployments/:deployment_guid/actions/continue", Method: http.MethodPost}, GetDomainsRequest: {Path: "/v3/domains", Method: http.MethodGet}, PostDomainRequest: {Path: "/v3/domains", Method: http.MethodPost}, DeleteDomainRequest: {Path: "/v3/domains/:domain_guid", Method: http.MethodDelete}, diff --git a/command/common/command_list_v7.go b/command/common/command_list_v7.go index 2e1bc07ea5e..d1e86445932 100644 --- a/command/common/command_list_v7.go +++ b/command/common/command_list_v7.go @@ -32,6 +32,7 @@ type commandList struct { CancelDeployment v7.CancelDeploymentCommand `command:"cancel-deployment" description:"Cancel the most recent deployment for an app. Resets the current droplet to the previous deployment's droplet."` CheckRoute v7.CheckRouteCommand `command:"check-route" description:"Perform a check to determine whether a route currently exists or not"` Config v7.ConfigCommand `command:"config" description:"Write default values to the config"` + ContinueDeployment v7.ContinueDeploymentCommand `command:"continue-deployment" description:"Continue the most recent deployment for an app."` CopySource v7.CopySourceCommand `command:"copy-source" description:"Copies the source code of an application to another existing application and restages that application"` CreateApp v7.CreateAppCommand `command:"create-app" description:"Create an Application in the target space"` CreateAppManifest v7.CreateAppManifestCommand `command:"create-app-manifest" description:"Create an app manifest for an app that has been pushed successfully"` diff --git a/command/common/internal/help_all_display.go b/command/common/internal/help_all_display.go index 738f496672e..f2dbcc4c981 100644 --- a/command/common/internal/help_all_display.go +++ b/command/common/internal/help_all_display.go @@ -13,7 +13,7 @@ var HelpCategoryList = []HelpCategory{ CommandList: [][]string{ {"apps", "app", "create-app"}, {"push", "scale", "delete", "rename"}, - {"cancel-deployment"}, + {"cancel-deployment", "continue-deployment"}, {"start", "stop", "restart", "stage-package", "restage", "restart-app-instance"}, {"run-task", "tasks", "terminate-task"}, {"packages", "create-package"}, diff --git a/command/flag/deployment_strategy.go b/command/flag/deployment_strategy.go index 0c7a98bb5e4..47ee1b52ee2 100644 --- a/command/flag/deployment_strategy.go +++ b/command/flag/deployment_strategy.go @@ -12,7 +12,7 @@ type DeploymentStrategy struct { } func (DeploymentStrategy) Complete(prefix string) []flags.Completion { - return completions([]string{string(constant.DeploymentStrategyRolling)}, prefix, false) + return completions([]string{string(constant.DeploymentStrategyRolling), string(constant.DeploymentStrategyCanary)}, prefix, false) } func (h *DeploymentStrategy) UnmarshalFlag(val string) error { @@ -23,13 +23,14 @@ func (h *DeploymentStrategy) UnmarshalFlag(val string) error { case string(constant.DeploymentStrategyDefault): // Do nothing, leave the default value - case string(constant.DeploymentStrategyRolling): + case string(constant.DeploymentStrategyRolling), + string(constant.DeploymentStrategyCanary): h.Name = constant.DeploymentStrategy(valLower) default: return &flags.Error{ Type: flags.ErrInvalidChoice, - Message: `STRATEGY must be "rolling" or not set`, + Message: `STRATEGY must be "canary", "rolling" or not set`, } } diff --git a/command/flag/deployment_strategy_test.go b/command/flag/deployment_strategy_test.go index d8f8ad229a5..90ac3c0b1d5 100644 --- a/command/flag/deployment_strategy_test.go +++ b/command/flag/deployment_strategy_test.go @@ -34,7 +34,7 @@ var _ = Describe("DeploymentStrategy", func() { Expect(strategy.Name).To(Equal(expectedType)) }, Entry("sets 'rolling' when passed 'rolling'", "rolling", constant.DeploymentStrategyRolling), - Entry("sets 'rolling' when passed 'rOlliNg'", "rOlliNg", constant.DeploymentStrategyRolling), + Entry("sets 'rolling' when passed 'cAnaRy'", "cAnaRy", constant.DeploymentStrategyCanary), Entry("sets 'rolling' when passed 'ROLLING'", "ROLLING", constant.DeploymentStrategyRolling), ) @@ -43,7 +43,7 @@ var _ = Describe("DeploymentStrategy", func() { err := strategy.UnmarshalFlag("banana") Expect(err).To(MatchError(&flags.Error{ Type: flags.ErrInvalidChoice, - Message: `STRATEGY must be "rolling" or not set`, + Message: `STRATEGY must be "canary", "rolling" or not set`, })) Expect(strategy.Name).To(BeEmpty()) }) diff --git a/command/v7/actor.go b/command/v7/actor.go index 7617493d79c..ff5303ea855 100644 --- a/command/v7/actor.go +++ b/command/v7/actor.go @@ -27,6 +27,7 @@ type Actor interface { Authenticate(credentials map[string]string, origin string, grantType uaa.GrantType) error BindSecurityGroupToSpaces(securityGroupGUID string, spaces []resources.Space, lifecycle constant.SecurityGroupLifecycle) (v7action.Warnings, error) CancelDeployment(deploymentGUID string) (v7action.Warnings, error) + ContinueDeployment(deploymentGUID string) (v7action.Warnings, error) CheckRoute(domainName string, hostname string, path string, port int) (bool, v7action.Warnings, error) ClearTarget() CopyPackage(sourceApp resources.Application, targetApp resources.Application) (resources.Package, v7action.Warnings, error) @@ -35,8 +36,7 @@ type Actor interface { CreateApplicationInSpace(app resources.Application, spaceGUID string) (resources.Application, v7action.Warnings, error) CreateBitsPackageByApplication(appGUID string) (resources.Package, v7action.Warnings, error) CreateBuildpack(buildpack resources.Buildpack) (resources.Buildpack, v7action.Warnings, error) - CreateDeploymentByApplicationAndDroplet(appGUID string, dropletGUID string) (string, v7action.Warnings, error) - CreateDeploymentByApplicationAndRevision(appGUID string, revisionGUID string) (string, v7action.Warnings, error) + CreateDeployment(dep resources.Deployment) (string, v7action.Warnings, error) CreateDockerPackageByApplication(appGUID string, dockerImageCredentials v7action.DockerImageCredentials) (resources.Package, v7action.Warnings, error) CreateDockerPackageByApplicationNameAndSpace(appName string, spaceGUID string, dockerImageCredentials v7action.DockerImageCredentials) (resources.Package, v7action.Warnings, error) CreateIsolationSegmentByName(isolationSegment resources.IsolationSegment) (v7action.Warnings, error) @@ -188,7 +188,7 @@ type Actor interface { PollBuild(buildGUID string, appName string) (resources.Droplet, v7action.Warnings, error) PollPackage(pkg resources.Package) (resources.Package, v7action.Warnings, error) PollStart(app resources.Application, noWait bool, handleProcessStats func(string)) (v7action.Warnings, error) - PollStartForRolling(app resources.Application, deploymentGUID string, noWait bool, handleProcessStats func(string)) (v7action.Warnings, error) + PollStartForDeployment(app resources.Application, deploymentGUID string, noWait bool, handleProcessStats func(string)) (v7action.Warnings, error) PollTask(task resources.Task) (resources.Task, v7action.Warnings, error) PollUploadBuildpackJob(jobURL ccv3.JobURL) (v7action.Warnings, error) PrepareBuildpackBits(inputPath string, tmpDirPath string, downloader v7action.Downloader) (string, error) diff --git a/command/v7/continue_deployment_command.go b/command/v7/continue_deployment_command.go new file mode 100644 index 00000000000..cfd5530080e --- /dev/null +++ b/command/v7/continue_deployment_command.go @@ -0,0 +1,79 @@ +package v7 + +import ( + "code.cloudfoundry.org/cli/command/flag" + "code.cloudfoundry.org/cli/command/v7/shared" +) + +type ContinueDeploymentCommand struct { + BaseCommand + + RequiredArgs flag.AppName `positional-args:"yes"` + usage interface{} `usage:"CF_NAME continue-deployment APP_NAME\n\nEXAMPLES:\n cf continue-deployment my-app"` + relatedCommands interface{} `related_commands:"app, push"` +} + +func (cmd *ContinueDeploymentCommand) Execute(args []string) error { + err := cmd.SharedActor.CheckTarget(true, true) + if err != nil { + return err + } + + user, err := cmd.Actor.GetCurrentUser() + if err != nil { + return err + } + + cmd.UI.DisplayTextWithFlavor( + "Continuing deployment for app {{.AppName}} in org {{.OrgName}} / space {{.SpaceName}} as {{.UserName}}...\n", + map[string]interface{}{ + "AppName": cmd.RequiredArgs.AppName, + "OrgName": cmd.Config.TargetedOrganization().Name, + "SpaceName": cmd.Config.TargetedSpace().Name, + "UserName": user.Name, + }, + ) + + application, warnings, err := cmd.Actor.GetApplicationByNameAndSpace(cmd.RequiredArgs.AppName, cmd.Config.TargetedSpace().GUID) + cmd.UI.DisplayWarnings(warnings) + if err != nil { + return err + } + + deployment, warnings, err := cmd.Actor.GetLatestActiveDeploymentForApp(application.GUID) + cmd.UI.DisplayWarnings(warnings) + if err != nil { + return err + } + + warnings, err = cmd.Actor.ContinueDeployment(deployment.GUID) + cmd.UI.DisplayWarnings(warnings) + if err != nil { + return err + } + + cmd.UI.DisplayText("Waiting for app to deploy...\n") + + handleInstanceDetails := func(instanceDetails string) { + cmd.UI.DisplayText(instanceDetails) + } + + warnings, err = cmd.Actor.PollStartForDeployment(application, deployment.GUID, false, handleInstanceDetails) + cmd.UI.DisplayNewline() + cmd.UI.DisplayWarnings(warnings) + if err != nil { + return err + } + + summary, warnings, err := cmd.Actor.GetDetailedAppSummary(application.Name, application.SpaceGUID, false) + cmd.UI.DisplayWarnings(warnings) + if err != nil { + return err + } + + appSummaryDisplayer := shared.NewAppSummaryDisplayer(cmd.UI) + appSummaryDisplayer.AppDisplay(summary, false) + + cmd.UI.DisplayText("\nTIP: Run 'cf app {{.AppName}}' to view app status.", map[string]interface{}{"AppName": cmd.RequiredArgs.AppName}) + return nil +} diff --git a/command/v7/continue_deployment_command_test.go b/command/v7/continue_deployment_command_test.go new file mode 100644 index 00000000000..a5086c5c9bb --- /dev/null +++ b/command/v7/continue_deployment_command_test.go @@ -0,0 +1,244 @@ +package v7_test + +import ( + "errors" + + "code.cloudfoundry.org/cli/actor/actionerror" + "code.cloudfoundry.org/cli/actor/v7action" + "code.cloudfoundry.org/cli/command/commandfakes" + "code.cloudfoundry.org/cli/command/flag" + . "code.cloudfoundry.org/cli/command/v7" + "code.cloudfoundry.org/cli/command/v7/v7fakes" + "code.cloudfoundry.org/cli/resources" + "code.cloudfoundry.org/cli/util/configv3" + "code.cloudfoundry.org/cli/util/ui" + + . "github.com/onsi/ginkgo/v2" + . "github.com/onsi/gomega" + . "github.com/onsi/gomega/gbytes" +) + +var _ = Describe("Continue deployment command", func() { + var ( + cmd ContinueDeploymentCommand + testUI *ui.UI + input *Buffer + fakeConfig *commandfakes.FakeConfig + fakeSharedActor *commandfakes.FakeSharedActor + fakeActor *v7fakes.FakeActor + binaryName string + appName string + spaceGUID string + executeErr error + ) + + BeforeEach(func() { + input = NewBuffer() + testUI = ui.NewTestUI(input, NewBuffer(), NewBuffer()) + fakeConfig = new(commandfakes.FakeConfig) + fakeSharedActor = new(commandfakes.FakeSharedActor) + fakeActor = new(v7fakes.FakeActor) + + binaryName = "clodFoundry" + fakeConfig.BinaryNameReturns(binaryName) + + cmd = ContinueDeploymentCommand{ + RequiredArgs: flag.AppName{AppName: appName}, + BaseCommand: BaseCommand{ + UI: testUI, + Config: fakeConfig, + SharedActor: fakeSharedActor, + Actor: fakeActor, + }, + } + + fakeConfig.TargetedOrganizationReturns(configv3.Organization{ + Name: "some-org", + GUID: "some-org-guid", + }) + + spaceGUID = "some-space-guid" + fakeConfig.TargetedSpaceReturns(configv3.Space{ + Name: "some-space", + GUID: spaceGUID, + }) + + fakeActor.GetCurrentUserReturns(configv3.User{Name: "timmyD"}, nil) + }) + + JustBeforeEach(func() { + executeErr = cmd.Execute(nil) + }) + + When("checking target fails", func() { + BeforeEach(func() { + fakeSharedActor.CheckTargetReturns(actionerror.NoOrganizationTargetedError{BinaryName: binaryName}) + }) + + It("returns an error", func() { + Expect(executeErr).To(MatchError(actionerror.NoOrganizationTargetedError{BinaryName: binaryName})) + + Expect(fakeSharedActor.CheckTargetCallCount()).To(Equal(1)) + checkTargetedOrg, checkTargetedSpace := fakeSharedActor.CheckTargetArgsForCall(0) + Expect(checkTargetedOrg).To(BeTrue()) + Expect(checkTargetedSpace).To(BeTrue()) + }) + }) + + When("the user is not logged in", func() { + var expectedErr error + + BeforeEach(func() { + expectedErr = errors.New("some current user error") + fakeActor.GetCurrentUserReturns(configv3.User{}, expectedErr) + }) + + It("return an error", func() { + Expect(executeErr).To(Equal(expectedErr)) + }) + }) + + When("the user is logged in", func() { + It("delegates to actor.GetApplicationByNameAndSpace", func() { + Expect(fakeActor.GetApplicationByNameAndSpaceCallCount()).To(Equal(1)) + actualAppName, actualSpaceGUID := fakeActor.GetApplicationByNameAndSpaceArgsForCall(0) + Expect(actualAppName).To(Equal(appName)) + Expect(actualSpaceGUID).To(Equal(spaceGUID)) + }) + + When("getting the app fails", func() { + BeforeEach(func() { + fakeActor.GetApplicationByNameAndSpaceReturns( + resources.Application{}, + v7action.Warnings{"get-app-warning"}, + errors.New("get-app-error"), + ) + }) + + It("returns the errors and outputs warnings", func() { + Expect(executeErr).To(MatchError("get-app-error")) + Expect(testUI.Err).To(Say("get-app-warning")) + + Expect(fakeActor.GetLatestActiveDeploymentForAppCallCount()).To(Equal(0)) + Expect(fakeActor.ContinueDeploymentCallCount()).To(Equal(0)) + }) + }) + + When("getting the app succeeds", func() { + var appGUID string + BeforeEach(func() { + appGUID = "some-app-guid" + fakeActor.GetApplicationByNameAndSpaceReturns( + resources.Application{Name: appName, GUID: appGUID}, + v7action.Warnings{"get-app-warning"}, + nil, + ) + }) + + It("delegates to actor.GetLatestDeployment", func() { + Expect(fakeActor.GetLatestActiveDeploymentForAppCallCount()).To(Equal(1)) + Expect(fakeActor.GetLatestActiveDeploymentForAppArgsForCall(0)).To(Equal(appGUID)) + }) + + When("getting the latest deployment fails", func() { + BeforeEach(func() { + fakeActor.GetLatestActiveDeploymentForAppReturns( + resources.Deployment{}, + v7action.Warnings{"get-deployment-warning"}, + errors.New("get-deployment-error"), + ) + }) + + It("returns the error and all warnings", func() { + Expect(executeErr).To(MatchError("get-deployment-error")) + Expect(testUI.Err).To(Say("get-app-warning")) + Expect(testUI.Err).To(Say("get-deployment-warning")) + + Expect(fakeActor.ContinueDeploymentCallCount()).To(Equal(0)) + }) + }) + + When("getting the latest deployment succeeds", func() { + var deploymentGUID string + BeforeEach(func() { + deploymentGUID = "some-deployment-guid" + fakeActor.GetLatestActiveDeploymentForAppReturns( + resources.Deployment{GUID: deploymentGUID}, + v7action.Warnings{"get-deployment-warning"}, + nil, + ) + }) + + It("delegates to actor.ContinueDeployment", func() { + Expect(fakeActor.ContinueDeploymentCallCount()).To(Equal(1)) + Expect(fakeActor.ContinueDeploymentArgsForCall(0)).To(Equal(deploymentGUID)) + }) + + When("continuing the deployment fails", func() { + BeforeEach(func() { + fakeActor.ContinueDeploymentReturns( + v7action.Warnings{"continue-deployment-warning"}, + errors.New("continue-deployment-error"), + ) + }) + + It("returns all warnings and errors", func() { + Expect(executeErr).To(MatchError("continue-deployment-error")) + Expect(testUI.Err).To(Say("get-app-warning")) + Expect(testUI.Err).To(Say("get-deployment-warning")) + Expect(testUI.Err).To(Say("continue-deployment-warning")) + }) + }) + + When("continuing the deployment succeeds", func() { + BeforeEach(func() { + fakeActor.ContinueDeploymentReturns( + nil, + nil, + ) + }) + + It("returns success", func() { + Expect(executeErr).ToNot(HaveOccurred()) + }) + + When("polling the application fails", func() { + BeforeEach(func() { + fakeActor.PollStartForDeploymentReturns( + v7action.Warnings{"poll-app-warning"}, errors.New("poll-app-error")) + }) + + It("returns an error", func() { + Expect(executeErr).To(MatchError("poll-app-error")) + }) + }) + + When("polling the application succeeds", func() { + BeforeEach(func() { + fakeActor.PollStartForDeploymentReturns(nil, nil) + }) + + When("getting the app summary fails", func() { + var expectedErr error + + BeforeEach(func() { + expectedErr = actionerror.ApplicationNotFoundError{Name: appName} + fakeActor.GetDetailedAppSummaryReturns(v7action.DetailedApplicationSummary{}, v7action.Warnings{"application-summary-warning-1", "application-summary-warning-2"}, expectedErr) + }) + + It("displays all warnings and returns an error", func() { + Expect(executeErr).To(Equal(actionerror.ApplicationNotFoundError{Name: appName})) + }) + }) + + When("getting the app summary succeeds", func() { + It("succeeds", func() { + Expect(executeErr).To(Not(HaveOccurred())) + }) + }) + }) + }) + }) + }) + }) +}) diff --git a/command/v7/copy_source_command.go b/command/v7/copy_source_command.go index a5c74ae0ea4..9d18a329d83 100644 --- a/command/v7/copy_source_command.go +++ b/command/v7/copy_source_command.go @@ -16,7 +16,7 @@ type CopySourceCommand struct { RequiredArgs flag.CopySourceArgs `positional-args:"yes"` usage interface{} `usage:"CF_NAME copy-source SOURCE_APP DESTINATION_APP [-s TARGET_SPACE [-o TARGET_ORG]] [--no-restart] [--strategy STRATEGY] [--no-wait]"` - Strategy flag.DeploymentStrategy `long:"strategy" description:"Deployment strategy, either rolling or null"` + Strategy flag.DeploymentStrategy `long:"strategy" description:"Deployment strategy can be canary, rolling or null"` NoWait bool `long:"no-wait" description:"Exit when the first instance of the web process is healthy"` NoRestart bool `long:"no-restart" description:"Do not restage the destination application"` Organization string `short:"o" long:"organization" description:"Org that contains the destination application"` @@ -159,15 +159,12 @@ func (cmd CopySourceCommand) Execute(args []string) error { ) cmd.UI.DisplayNewline() - err = cmd.Stager.StageAndStart( - targetApp, - targetSpace, - targetOrg, - pkg.GUID, - cmd.Strategy.Name, - cmd.NoWait, - constant.ApplicationRestarting, - ) + opts := shared.AppStartOpts{ + Strategy: cmd.Strategy.Name, + NoWait: cmd.NoWait, + AppAction: constant.ApplicationRestarting, + } + err = cmd.Stager.StageAndStart(targetApp, targetSpace, targetOrg, pkg.GUID, opts) if err != nil { return mapErr(cmd.Config, targetApp.Name, err) } diff --git a/command/v7/copy_source_command_test.go b/command/v7/copy_source_command_test.go index 17388c3f18b..2afadbdb1b0 100644 --- a/command/v7/copy_source_command_test.go +++ b/command/v7/copy_source_command_test.go @@ -333,14 +333,34 @@ var _ = Describe("copy-source Command", func() { It("stages and starts the app with the appropriate strategy", func() { Expect(fakeAppStager.StageAndStartCallCount()).To(Equal(1)) - returnedApp, spaceForApp, orgForApp, pkgGUID, strategy, noWait, appAction := fakeAppStager.StageAndStartArgsForCall(0) + returnedApp, spaceForApp, orgForApp, pkgGUID, opts := fakeAppStager.StageAndStartArgsForCall(0) Expect(returnedApp).To(Equal(targetApp)) Expect(spaceForApp).To(Equal(configv3.Space{Name: "some-space", GUID: "some-space-guid"})) Expect(orgForApp).To(Equal(configv3.Organization{Name: "some-org"})) Expect(pkgGUID).To(Equal("target-package-guid")) - Expect(strategy).To(Equal(constant.DeploymentStrategyRolling)) - Expect(noWait).To(Equal(false)) - Expect(appAction).To(Equal(constant.ApplicationRestarting)) + Expect(opts.Strategy).To(Equal(constant.DeploymentStrategyRolling)) + Expect(opts.NoWait).To(Equal(false)) + Expect(opts.AppAction).To(Equal(constant.ApplicationRestarting)) + }) + }) + + When("the strategy flag is set to canary", func() { + BeforeEach(func() { + cmd.Strategy = flag.DeploymentStrategy{ + Name: constant.DeploymentStrategyCanary, + } + }) + + It("stages and starts the app with the appropriate strategy", func() { + Expect(fakeAppStager.StageAndStartCallCount()).To(Equal(1)) + returnedApp, spaceForApp, orgForApp, pkgGUID, opts := fakeAppStager.StageAndStartArgsForCall(0) + Expect(returnedApp).To(Equal(targetApp)) + Expect(spaceForApp).To(Equal(configv3.Space{Name: "some-space", GUID: "some-space-guid"})) + Expect(orgForApp).To(Equal(configv3.Organization{Name: "some-org"})) + Expect(pkgGUID).To(Equal("target-package-guid")) + Expect(opts.Strategy).To(Equal(constant.DeploymentStrategyCanary)) + Expect(opts.NoWait).To(Equal(false)) + Expect(opts.AppAction).To(Equal(constant.ApplicationRestarting)) }) }) @@ -351,27 +371,27 @@ var _ = Describe("copy-source Command", func() { It("stages and starts the app with the appropriate strategy", func() { Expect(fakeAppStager.StageAndStartCallCount()).To(Equal(1)) - returnedApp, spaceForApp, orgForApp, pkgGUID, strategy, noWait, appAction := fakeAppStager.StageAndStartArgsForCall(0) + returnedApp, spaceForApp, orgForApp, pkgGUID, opts := fakeAppStager.StageAndStartArgsForCall(0) Expect(returnedApp).To(Equal(targetApp)) Expect(spaceForApp).To(Equal(configv3.Space{Name: "some-space", GUID: "some-space-guid"})) Expect(orgForApp).To(Equal(configv3.Organization{Name: "some-org"})) Expect(pkgGUID).To(Equal("target-package-guid")) - Expect(strategy).To(Equal(constant.DeploymentStrategyDefault)) - Expect(noWait).To(Equal(true)) - Expect(appAction).To(Equal(constant.ApplicationRestarting)) + Expect(opts.Strategy).To(Equal(constant.DeploymentStrategyDefault)) + Expect(opts.NoWait).To(Equal(true)) + Expect(opts.AppAction).To(Equal(constant.ApplicationRestarting)) }) }) It("stages and starts the target app", func() { Expect(fakeAppStager.StageAndStartCallCount()).To(Equal(1)) - returnedApp, spaceForApp, orgForApp, pkgGUID, strategy, noWait, appAction := fakeAppStager.StageAndStartArgsForCall(0) + returnedApp, spaceForApp, orgForApp, pkgGUID, opts := fakeAppStager.StageAndStartArgsForCall(0) Expect(returnedApp).To(Equal(targetApp)) Expect(spaceForApp).To(Equal(configv3.Space{Name: "some-space", GUID: "some-space-guid"})) Expect(orgForApp).To(Equal(configv3.Organization{Name: "some-org"})) Expect(pkgGUID).To(Equal("target-package-guid")) - Expect(strategy).To(Equal(constant.DeploymentStrategyDefault)) - Expect(noWait).To(Equal(false)) - Expect(appAction).To(Equal(constant.ApplicationRestarting)) + Expect(opts.Strategy).To(Equal(constant.DeploymentStrategyDefault)) + Expect(opts.NoWait).To(Equal(false)) + Expect(opts.AppAction).To(Equal(constant.ApplicationRestarting)) }) When("staging and starting the app fails", func() { diff --git a/command/v7/push_command.go b/command/v7/push_command.go index 675d5b26e14..12e0001b15e 100644 --- a/command/v7/push_command.go +++ b/command/v7/push_command.go @@ -100,7 +100,7 @@ type PushCommand struct { RedactEnv bool `long:"redact-env" description:"Do not print values for environment vars set in the application manifest"` Stack string `long:"stack" short:"s" description:"Stack to use (a stack is a pre-built file system, including an operating system, that can run apps)"` StartCommand flag.Command `long:"start-command" short:"c" description:"Startup command, set to null to reset to default start command"` - Strategy flag.DeploymentStrategy `long:"strategy" description:"Deployment strategy, either rolling or null."` + Strategy flag.DeploymentStrategy `long:"strategy" description:"Deployment strategy can be canary, rolling or null."` Task bool `long:"task" description:"Push an app that is used only to execute tasks. The app will be staged, but not started and will have no route assigned."` Vars []template.VarKV `long:"var" description:"Variable key value pair for variable substitution, (e.g., name=app1); can specify multiple times"` PathsToVarsFiles []flag.PathWithExistenceCheck `long:"vars-file" description:"Path to a variable substitution file for manifest; can specify multiple times"` @@ -452,6 +452,22 @@ func (cmd PushCommand) ValidateFlags() error { }, } + case cmd.NoStart && cmd.Strategy == flag.DeploymentStrategy{Name: constant.DeploymentStrategyCanary}: + return translatableerror.ArgumentCombinationError{ + Args: []string{ + "--no-start", + "--strategy=canary", + }, + } + + case cmd.Task && cmd.Strategy == flag.DeploymentStrategy{Name: constant.DeploymentStrategyCanary}: + return translatableerror.ArgumentCombinationError{ + Args: []string{ + "--task", + "--strategy=canary", + }, + } + case cmd.NoStart && cmd.NoWait: return translatableerror.ArgumentCombinationError{ Args: []string{ diff --git a/command/v7/push_command_test.go b/command/v7/push_command_test.go index 9bd3c070ab1..00a464644cc 100644 --- a/command/v7/push_command_test.go +++ b/command/v7/push_command_test.go @@ -1218,6 +1218,17 @@ var _ = Describe("push Command", func() { }, }), + Entry("when strategy 'canary' and no-start flags are passed", + func() { + cmd.Strategy = flag.DeploymentStrategy{Name: constant.DeploymentStrategyCanary} + cmd.NoStart = true + }, + translatableerror.ArgumentCombinationError{ + Args: []string{ + "--no-start", "--strategy=canary", + }, + }), + Entry("when strategy is not set and no-start flags are passed", func() { cmd.Strategy = flag.DeploymentStrategy{Name: constant.DeploymentStrategyDefault} @@ -1258,7 +1269,7 @@ var _ = Describe("push Command", func() { }, translatableerror.InvalidBuildpacksError{}), - Entry("task and strategy flags are passed", + Entry("task and 'rolling' strategy flags are passed", func() { cmd.Task = true cmd.Strategy = flag.DeploymentStrategy{Name: constant.DeploymentStrategyRolling} @@ -1268,5 +1279,16 @@ var _ = Describe("push Command", func() { "--task", "--strategy=rolling", }, }), + + Entry("task and 'canary' strategy flags are passed", + func() { + cmd.Task = true + cmd.Strategy = flag.DeploymentStrategy{Name: constant.DeploymentStrategyCanary} + }, + translatableerror.ArgumentCombinationError{ + Args: []string{ + "--task", "--strategy=canary", + }, + }), ) }) diff --git a/command/v7/restage_command.go b/command/v7/restage_command.go index e9dc01ced53..76b02c618bd 100644 --- a/command/v7/restage_command.go +++ b/command/v7/restage_command.go @@ -15,9 +15,9 @@ type RestageCommand struct { BaseCommand RequiredArgs flag.AppName `positional-args:"yes"` - Strategy flag.DeploymentStrategy `long:"strategy" description:"Deployment strategy, either rolling or null."` + Strategy flag.DeploymentStrategy `long:"strategy" description:"Deployment strategy can be canary, rolling or null."` NoWait bool `long:"no-wait" description:"Exit when the first instance of the web process is healthy"` - usage interface{} `usage:"CF_NAME restage APP_NAME\n\n This command will cause downtime unless you use '--strategy rolling'.\n\nEXAMPLES:\n CF_NAME restage APP_NAME\n CF_NAME restage APP_NAME --strategy rolling\n CF_NAME restage APP_NAME --strategy rolling --no-wait"` + usage interface{} `usage:"CF_NAME restage APP_NAME\n\n This command will cause downtime unless you use '--strategy' flag.\n\nEXAMPLES:\n CF_NAME restage APP_NAME\n CF_NAME restage APP_NAME --strategy rolling\n CF_NAME restage APP_NAME --strategy canary --no-wait"` relatedCommands interface{} `related_commands:"restart"` envCFStagingTimeout interface{} `environmentName:"CF_STAGING_TIMEOUT" environmentDescription:"Max wait time for staging, in minutes" environmentDefault:"15"` envCFStartupTimeout interface{} `environmentName:"CF_STARTUP_TIMEOUT" environmentDescription:"Max wait time for app instance startup, in minutes" environmentDefault:"5"` @@ -52,7 +52,7 @@ func (cmd RestageCommand) Execute(args []string) error { return err } - if cmd.Strategy.Name != constant.DeploymentStrategyRolling { + if len(cmd.Strategy.Name) <= 0 { cmd.UI.DisplayWarning("This action will cause app downtime.") } @@ -77,15 +77,12 @@ func (cmd RestageCommand) Execute(args []string) error { return mapErr(cmd.Config, cmd.RequiredArgs.AppName, err) } - err = cmd.Stager.StageAndStart( - app, - cmd.Config.TargetedSpace(), - cmd.Config.TargetedOrganization(), - pkg.GUID, - cmd.Strategy.Name, - cmd.NoWait, - constant.ApplicationRestarting, - ) + opts := shared.AppStartOpts{ + Strategy: cmd.Strategy.Name, + NoWait: cmd.NoWait, + AppAction: constant.ApplicationRestarting, + } + err = cmd.Stager.StageAndStart(app, cmd.Config.TargetedSpace(), cmd.Config.TargetedOrganization(), pkg.GUID, opts) if err != nil { return mapErr(cmd.Config, cmd.RequiredArgs.AppName, err) } diff --git a/command/v7/restage_command_test.go b/command/v7/restage_command_test.go index 741a2f108da..652e7740d84 100644 --- a/command/v7/restage_command_test.go +++ b/command/v7/restage_command_test.go @@ -105,7 +105,7 @@ var _ = Describe("restage Command", func() { }) }) - When("it's NOT a rolling deploy", func() { + When("No strategy flag is given", func() { BeforeEach(func() { cmd.Strategy.Name = constant.DeploymentStrategyDefault }) @@ -165,14 +165,14 @@ var _ = Describe("restage Command", func() { It("stages and starts the app", func() { Expect(fakeAppStager.StageAndStartCallCount()).To(Equal(1)) - returnedApp, spaceForApp, orgForApp, pkgGUID, strategy, noWait, appAction := fakeAppStager.StageAndStartArgsForCall(0) + returnedApp, spaceForApp, orgForApp, pkgGUID, opts := fakeAppStager.StageAndStartArgsForCall(0) Expect(returnedApp).To(Equal(app)) Expect(spaceForApp).To(Equal(fakeConfig.TargetedSpace())) Expect(orgForApp).To(Equal(fakeConfig.TargetedOrganization())) Expect(pkgGUID).To(Equal("earliest-package-guid")) - Expect(strategy).To(Equal(constant.DeploymentStrategyDefault)) - Expect(noWait).To(Equal(false)) - Expect(appAction).To(Equal(constant.ApplicationRestarting)) + Expect(opts.Strategy).To(Equal(constant.DeploymentStrategyDefault)) + Expect(opts.NoWait).To(Equal(false)) + Expect(opts.AppAction).To(Equal(constant.ApplicationRestarting)) }) When("staging and starting the app fails", func() { diff --git a/command/v7/restart_command.go b/command/v7/restart_command.go index 71b7774e796..1a453d50b9e 100644 --- a/command/v7/restart_command.go +++ b/command/v7/restart_command.go @@ -13,9 +13,9 @@ type RestartCommand struct { BaseCommand RequiredArgs flag.AppName `positional-args:"yes"` - Strategy flag.DeploymentStrategy `long:"strategy" description:"Deployment strategy, either rolling or null."` + Strategy flag.DeploymentStrategy `long:"strategy" description:"Deployment strategy can be canary, rolling or null."` NoWait bool `long:"no-wait" description:"Exit when the first instance of the web process is healthy"` - usage interface{} `usage:"CF_NAME restart APP_NAME\n\n This command will cause downtime unless you use '--strategy rolling'.\n\n If the app's most recent package is unstaged, restarting the app will stage and run that package.\n Otherwise, the app's current droplet will be run."` + usage interface{} `usage:"CF_NAME restart APP_NAME\n\n This command will cause downtime unless you use '--strategy canary' or '--strategy rolling'.\n\n If the app's most recent package is unstaged, restarting the app will stage and run that package.\n Otherwise, the app's current droplet will be run."` relatedCommands interface{} `related_commands:"restage, restart-app-instance"` envCFStagingTimeout interface{} `environmentName:"CF_STAGING_TIMEOUT" environmentDescription:"Max wait time for staging, in minutes" environmentDefault:"15"` envCFStartupTimeout interface{} `environmentName:"CF_STARTUP_TIMEOUT" environmentDescription:"Max wait time for app instance startup, in minutes" environmentDefault:"5"` @@ -62,7 +62,7 @@ func (cmd RestartCommand) Execute(args []string) error { return err } - if packageGUID != "" || cmd.Strategy.Name == constant.DeploymentStrategyRolling { + if packageGUID != "" || len(cmd.Strategy.Name) > 0 { cmd.UI.DisplayTextWithFlavor("Restarting app {{.AppName}} in org {{.OrgName}} / space {{.SpaceName}} as {{.Username}}...", map[string]interface{}{ "AppName": cmd.RequiredArgs.AppName, "OrgName": cmd.Config.TargetedOrganization().Name, @@ -72,13 +72,18 @@ func (cmd RestartCommand) Execute(args []string) error { cmd.UI.DisplayNewline() } + opts := shared.AppStartOpts{ + Strategy: cmd.Strategy.Name, + NoWait: cmd.NoWait, + AppAction: constant.ApplicationRestarting, + } if packageGUID != "" { - err = cmd.Stager.StageAndStart(app, cmd.Config.TargetedSpace(), cmd.Config.TargetedOrganization(), packageGUID, cmd.Strategy.Name, cmd.NoWait, constant.ApplicationRestarting) + err = cmd.Stager.StageAndStart(app, cmd.Config.TargetedSpace(), cmd.Config.TargetedOrganization(), packageGUID, opts) if err != nil { return err } } else { - err = cmd.Stager.StartApp(app, "", cmd.Strategy.Name, cmd.NoWait, cmd.Config.TargetedSpace(), cmd.Config.TargetedOrganization(), constant.ApplicationRestarting) + err = cmd.Stager.StartApp(app, cmd.Config.TargetedSpace(), cmd.Config.TargetedOrganization(), "", opts) if err != nil { return err } diff --git a/command/v7/restart_command_test.go b/command/v7/restart_command_test.go index a339fa05cf1..2cea1f43b97 100644 --- a/command/v7/restart_command_test.go +++ b/command/v7/restart_command_test.go @@ -136,14 +136,14 @@ var _ = Describe("restart Command", func() { Expect(executeErr).ToNot(HaveOccurred()) Expect(fakeAppStager.StageAndStartCallCount()).To(Equal(1)) - inputApp, inputSpace, inputOrg, inputPkgGUID, inputStrategy, inputNoWait, inputAppAction := fakeAppStager.StageAndStartArgsForCall(0) + inputApp, inputSpace, inputOrg, inputPkgGUID, opts := fakeAppStager.StageAndStartArgsForCall(0) Expect(inputApp).To(Equal(app)) Expect(inputSpace).To(Equal(cmd.Config.TargetedSpace())) Expect(inputOrg).To(Equal(cmd.Config.TargetedOrganization())) Expect(inputPkgGUID).To(Equal("package-guid")) - Expect(inputStrategy).To(Equal(strategy)) - Expect(inputNoWait).To(Equal(noWait)) - Expect(inputAppAction).To(Equal(constant.ApplicationRestarting)) + Expect(opts.Strategy).To(Equal(strategy)) + Expect(opts.NoWait).To(Equal(noWait)) + Expect(opts.AppAction).To(Equal(constant.ApplicationRestarting)) }) Context("staging and starting the app returns an error", func() { @@ -166,14 +166,14 @@ var _ = Describe("restart Command", func() { Expect(executeErr).ToNot(HaveOccurred()) Expect(fakeAppStager.StartAppCallCount()).To(Equal(1)) - inputApp, inputDropletGuid, inputStrategy, inputNoWait, inputSpace, inputOrg, inputAppAction := fakeAppStager.StartAppArgsForCall(0) + inputApp, inputSpace, inputOrg, inputDropletGuid, opts := fakeAppStager.StartAppArgsForCall(0) Expect(inputApp).To(Equal(app)) Expect(inputDropletGuid).To(Equal("")) - Expect(inputStrategy).To(Equal(strategy)) - Expect(inputNoWait).To(Equal(noWait)) Expect(inputSpace).To(Equal(cmd.Config.TargetedSpace())) Expect(inputOrg).To(Equal(cmd.Config.TargetedOrganization())) - Expect(inputAppAction).To(Equal(constant.ApplicationRestarting)) + Expect(opts.Strategy).To(Equal(strategy)) + Expect(opts.NoWait).To(Equal(noWait)) + Expect(opts.AppAction).To(Equal(constant.ApplicationRestarting)) }) When("starting the app returns an error", func() { diff --git a/command/v7/revisions_command.go b/command/v7/revisions_command.go index c6c484fff5b..d2b1b87b9b8 100644 --- a/command/v7/revisions_command.go +++ b/command/v7/revisions_command.go @@ -113,7 +113,7 @@ func (cmd RevisionsCommand) Execute(_ []string) error { } if len(revisionsDeployed) > 1 { - cmd.UI.DisplayText("Info: this app is in the middle of a rolling deployment. More than one revision is deployed.") + cmd.UI.DisplayText("Info: this app is in the middle of a deployment. More than one revision is deployed.") cmd.UI.DisplayNewline() } diff --git a/command/v7/revisions_command_test.go b/command/v7/revisions_command_test.go index 669896448b8..e7a7987ea46 100644 --- a/command/v7/revisions_command_test.go +++ b/command/v7/revisions_command_test.go @@ -166,7 +166,7 @@ var _ = Describe("revisions Command", func() { }) It("does not display an informative message", func() { - Expect(testUI.Out).NotTo(Say("Info: this app is in the middle of a rolling deployment. More than one revision is deployed.")) + Expect(testUI.Out).NotTo(Say("Info: this app is in the middle of a deployment. More than one revision is deployed.")) }) When("there is more than one revision deployed", func() { @@ -195,7 +195,7 @@ var _ = Describe("revisions Command", func() { Expect(testUI.Out).To(Say("2\\(deployed\\) Something else true A89F8259-D32B-491A-ABD6-F100AC42D74C 2020-03-08T12:43:30Z")) }) It("displays an informative message", func() { - Expect(testUI.Out).To(Say("Info: this app is in the middle of a rolling deployment. More than one revision is deployed.")) + Expect(testUI.Out).To(Say("Info: this app is in the middle of a deployment. More than one revision is deployed.")) }) }) diff --git a/command/v7/rollback_command.go b/command/v7/rollback_command.go index 8c3e0f005ca..f01205837f6 100644 --- a/command/v7/rollback_command.go +++ b/command/v7/rollback_command.go @@ -106,15 +106,13 @@ func (cmd RollbackCommand) Execute(args []string) error { "Username": user.Name, }) - startAppErr := cmd.Stager.StartApp( - app, - revision.GUID, - constant.DeploymentStrategyRolling, - false, - cmd.Config.TargetedSpace(), - cmd.Config.TargetedOrganization(), - constant.ApplicationRollingBack, - ) + opts := shared.AppStartOpts{ + Strategy: constant.DeploymentStrategyRolling, + NoWait: false, + AppAction: constant.ApplicationRollingBack, + } + + startAppErr := cmd.Stager.StartApp(app, cmd.Config.TargetedSpace(), cmd.Config.TargetedOrganization(), revision.GUID, opts) if startAppErr != nil { return startAppErr } diff --git a/command/v7/rollback_command_test.go b/command/v7/rollback_command_test.go index e5ce2ac4925..59f1a6bec36 100644 --- a/command/v7/rollback_command_test.go +++ b/command/v7/rollback_command_test.go @@ -188,10 +188,10 @@ var _ = Describe("rollback Command", func() { It("skips the prompt and executes the rollback", func() { Expect(fakeAppStager.StartAppCallCount()).To(Equal(1), "GetStartApp call count") - application, revisionGUID, _, _, _, _, appAction := fakeAppStager.StartAppArgsForCall(0) + application, _, _, revisionGUID, opts := fakeAppStager.StartAppArgsForCall(0) Expect(application.GUID).To(Equal("123")) Expect(revisionGUID).To(Equal("some-1-guid")) - Expect(appAction).To(Equal(constant.ApplicationRollingBack)) + Expect(opts.AppAction).To(Equal(constant.ApplicationRollingBack)) Expect(testUI.Out).ToNot(Say("Rolling '%s' back to revision '1' will create a new revision. The new revision '3' will use the settings from revision '1'.", app)) Expect(testUI.Out).ToNot(Say("Are you sure you want to continue?")) @@ -215,10 +215,10 @@ var _ = Describe("rollback Command", func() { It("successfully executes the command and outputs warnings", func() { Expect(fakeAppStager.StartAppCallCount()).To(Equal(1), "GetStartApp call count") - application, revisionGUID, _, _, _, _, appAction := fakeAppStager.StartAppArgsForCall(0) + application, _, _, revisionGUID, opts := fakeAppStager.StartAppArgsForCall(0) Expect(application.GUID).To(Equal("123")) Expect(revisionGUID).To(Equal("some-1-guid")) - Expect(appAction).To(Equal(constant.ApplicationRollingBack)) + Expect(opts.AppAction).To(Equal(constant.ApplicationRollingBack)) Expect(testUI.Out).To(Say("Rolling '%s' back to revision '1' will create a new revision. The new revision will use the settings from revision '1'.", app)) Expect(testUI.Out).To(Say("Are you sure you want to continue?")) diff --git a/command/v7/shared/app_stager.go b/command/v7/shared/app_stager.go index 5399d6f5575..5364bbd31c2 100644 --- a/command/v7/shared/app_stager.go +++ b/command/v7/shared/app_stager.go @@ -21,31 +21,17 @@ import ( //go:generate go run github.com/maxbrunsfeld/counterfeiter/v6 . AppStager type AppStager interface { - StageAndStart( - app resources.Application, - space configv3.Space, - organization configv3.Organization, - packageGUID string, - strategy constant.DeploymentStrategy, - noWait bool, - appAction constant.ApplicationAction, - ) error - - StageApp( - app resources.Application, - packageGUID string, - space configv3.Space, - ) (resources.Droplet, error) - - StartApp( - app resources.Application, - resourceGuid string, - strategy constant.DeploymentStrategy, - noWait bool, - space configv3.Space, - organization configv3.Organization, - appAction constant.ApplicationAction, - ) error + StageAndStart(app resources.Application, space configv3.Space, organization configv3.Organization, packageGUID string, opts AppStartOpts) error + + StageApp(app resources.Application, packageGUID string, space configv3.Space) (resources.Droplet, error) + + StartApp(app resources.Application, space configv3.Space, organization configv3.Organization, resourceGuid string, opts AppStartOpts) error +} + +type AppStartOpts struct { + Strategy constant.DeploymentStrategy + NoWait bool + AppAction constant.ApplicationAction } type Stager struct { @@ -56,13 +42,12 @@ type Stager struct { } type stagingAndStartActor interface { - CreateDeploymentByApplicationAndDroplet(appGUID string, dropletGUID string) (string, v7action.Warnings, error) - CreateDeploymentByApplicationAndRevision(appGUID string, revisionGUID string) (string, v7action.Warnings, error) + CreateDeployment(dep resources.Deployment) (string, v7action.Warnings, error) GetCurrentUser() (configv3.User, error) GetDetailedAppSummary(appName string, spaceGUID string, withObfuscatedValues bool) (v7action.DetailedApplicationSummary, v7action.Warnings, error) GetStreamingLogsForApplicationByNameAndSpace(appName string, spaceGUID string, client sharedaction.LogCacheClient) (<-chan sharedaction.LogMessage, <-chan error, context.CancelFunc, v7action.Warnings, error) PollStart(app resources.Application, noWait bool, handleProcessStats func(string)) (v7action.Warnings, error) - PollStartForRolling(app resources.Application, deploymentGUID string, noWait bool, handleProcessStats func(string)) (v7action.Warnings, error) + PollStartForDeployment(app resources.Application, deploymentGUID string, noWait bool, handleProcessStats func(string)) (v7action.Warnings, error) SetApplicationDroplet(appGUID string, dropletGUID string) (v7action.Warnings, error) StagePackage(packageGUID, appName, spaceGUID string) (<-chan resources.Droplet, <-chan v7action.Warnings, <-chan error) StartApplication(appGUID string) (v7action.Warnings, error) @@ -78,15 +63,7 @@ func NewAppStager(actor stagingAndStartActor, ui command.UI, config command.Conf } } -func (stager *Stager) StageAndStart( - app resources.Application, - space configv3.Space, - organization configv3.Organization, - packageGUID string, - strategy constant.DeploymentStrategy, - noWait bool, - appAction constant.ApplicationAction, -) error { +func (stager *Stager) StageAndStart(app resources.Application, space configv3.Space, organization configv3.Organization, packageGUID string, opts AppStartOpts) error { droplet, err := stager.StageApp(app, packageGUID, space) if err != nil { @@ -95,7 +72,7 @@ func (stager *Stager) StageAndStart( stager.UI.DisplayNewline() - err = stager.StartApp(app, droplet.GUID, strategy, noWait, space, organization, appAction) + err = stager.StartApp(app, space, organization, droplet.GUID, opts) if err != nil { return err } @@ -126,16 +103,8 @@ func (stager *Stager) StageApp(app resources.Application, packageGUID string, sp return droplet, nil } -func (stager *Stager) StartApp( - app resources.Application, - resourceGuid string, - strategy constant.DeploymentStrategy, - noWait bool, - space configv3.Space, - organization configv3.Organization, - appAction constant.ApplicationAction, -) error { - if strategy == constant.DeploymentStrategyRolling { +func (stager *Stager) StartApp(app resources.Application, space configv3.Space, organization configv3.Organization, resourceGuid string, opts AppStartOpts) error { + if len(opts.Strategy) > 0 { stager.UI.DisplayText("Creating deployment for app {{.AppName}}...\n", map[string]interface{}{ "AppName": app.Name, @@ -148,11 +117,17 @@ func (stager *Stager) StartApp( err error ) - switch appAction { + dep := resources.Deployment{ + Strategy: opts.Strategy, + Relationships: resources.Relationships{constant.RelationshipTypeApplication: resources.Relationship{GUID: app.GUID}}, + } + switch opts.AppAction { case constant.ApplicationRollingBack: - deploymentGUID, warnings, err = stager.Actor.CreateDeploymentByApplicationAndRevision(app.GUID, resourceGuid) + dep.RevisionGUID = resourceGuid + deploymentGUID, warnings, err = stager.Actor.CreateDeployment(dep) default: - deploymentGUID, warnings, err = stager.Actor.CreateDeploymentByApplicationAndDroplet(app.GUID, resourceGuid) + dep.DropletGUID = resourceGuid + deploymentGUID, warnings, err = stager.Actor.CreateDeployment(dep) } stager.UI.DisplayWarnings(warnings) @@ -166,13 +141,14 @@ func (stager *Stager) StartApp( stager.UI.DisplayText(instanceDetails) } - warnings, err = stager.Actor.PollStartForRolling(app, deploymentGUID, noWait, handleInstanceDetails) + warnings, err = stager.Actor.PollStartForDeployment(app, deploymentGUID, opts.NoWait, handleInstanceDetails) stager.UI.DisplayNewline() stager.UI.DisplayWarnings(warnings) if err != nil { return err } - if noWait == true { + + if opts.NoWait && opts.Strategy != constant.DeploymentStrategyCanary { stager.UI.DisplayText("First instance restaged correctly, restaging remaining in the background") return nil } @@ -182,7 +158,7 @@ func (stager *Stager) StartApp( return err } - flavorText := fmt.Sprintf("%s app {{.App}} in org {{.Org}} / space {{.Space}} as {{.UserName}}...", appAction) + flavorText := fmt.Sprintf("%s app {{.App}} in org {{.Org}} / space {{.Space}} as {{.UserName}}...", opts.AppAction) stager.UI.DisplayTextWithFlavor(flavorText, map[string]interface{}{ "App": app.Name, @@ -194,7 +170,7 @@ func (stager *Stager) StartApp( stager.UI.DisplayNewline() if app.Started() { - if appAction == constant.ApplicationStarting { + if opts.AppAction == constant.ApplicationStarting { stager.UI.DisplayText("App '{{.AppName}}' is already started.", map[string]interface{}{ "AppName": app.Name, @@ -237,7 +213,7 @@ func (stager *Stager) StartApp( stager.UI.DisplayText(instanceDetails) } - warnings, err = stager.Actor.PollStart(app, noWait, handleInstanceDetails) + warnings, err = stager.Actor.PollStart(app, opts.NoWait, handleInstanceDetails) stager.UI.DisplayNewline() stager.UI.DisplayWarnings(warnings) if err != nil { diff --git a/command/v7/shared/app_stager_test.go b/command/v7/shared/app_stager_test.go index de22a805a23..9c6b936ea59 100644 --- a/command/v7/shared/app_stager_test.go +++ b/command/v7/shared/app_stager_test.go @@ -106,15 +106,12 @@ var _ = Describe("app stager", func() { JustBeforeEach(func() { appStager = shared.NewAppStager(fakeActor, testUI, fakeConfig, fakeLogCacheClient) - executeErr = appStager.StageAndStart( - app, - space, - organization, - pkgGUID, - strategy, - noWait, - appAction, - ) + opts := shared.AppStartOpts{ + Strategy: strategy, + NoWait: noWait, + AppAction: appAction, + } + executeErr = appStager.StageAndStart(app, space, organization, pkgGUID, opts) }) It("stages and starts the app", func() { @@ -177,15 +174,12 @@ var _ = Describe("app stager", func() { strategy = constant.DeploymentStrategyRolling noWait = true appStager = shared.NewAppStager(fakeActor, testUI, fakeConfig, fakeLogCacheClient) - executeErr = appStager.StageAndStart( - app, - space, - organization, - pkgGUID, - strategy, - noWait, - appAction, - ) + opts := shared.AppStartOpts{ + Strategy: strategy, + NoWait: noWait, + AppAction: appAction, + } + executeErr = appStager.StageAndStart(app, space, organization, pkgGUID, opts) }) It("Restages and starts the app", func() { @@ -363,27 +357,24 @@ var _ = Describe("app stager", func() { JustBeforeEach(func() { appStager = shared.NewAppStager(fakeActor, testUI, fakeConfig, fakeLogCacheClient) - executeErr = appStager.StartApp( - app, - resourceGUID, - strategy, - noWait, - space, - organization, - appAction, - ) + opts := shared.AppStartOpts{ + Strategy: strategy, + NoWait: noWait, + AppAction: appAction, + } + executeErr = appStager.StartApp(app, space, organization, resourceGUID, opts) }) When("the deployment strategy is rolling", func() { BeforeEach(func() { strategy = constant.DeploymentStrategyRolling - fakeActor.CreateDeploymentByApplicationAndDropletReturns( + fakeActor.CreateDeploymentReturns( "some-deployment-guid", v7action.Warnings{"create-deployment-warning"}, nil, ) - fakeActor.PollStartForRollingReturns( + fakeActor.PollStartForDeploymentReturns( v7action.Warnings{"poll-start-warning"}, nil, ) @@ -393,7 +384,7 @@ var _ = Describe("app stager", func() { BeforeEach(func() { appAction = constant.ApplicationRollingBack resourceGUID = "revision-guid" - fakeActor.CreateDeploymentByApplicationAndRevisionReturns( + fakeActor.CreateDeploymentReturns( "some-deployment-guid", v7action.Warnings{"create-deployment-warning"}, nil, @@ -404,14 +395,14 @@ var _ = Describe("app stager", func() { Expect(executeErr).NotTo(HaveOccurred()) Expect(testUI.Out).To(Say("Creating deployment for app %s...", app.Name)) - Expect(fakeActor.CreateDeploymentByApplicationAndRevisionCallCount()).To(Equal(1), "CreateDeployment...") - appGUID, revisionGUID := fakeActor.CreateDeploymentByApplicationAndRevisionArgsForCall(0) - Expect(appGUID).To(Equal(app.GUID)) - Expect(revisionGUID).To(Equal("revision-guid")) + Expect(fakeActor.CreateDeploymentCallCount()).To(Equal(1), "CreateDeployment...") + dep := fakeActor.CreateDeploymentArgsForCall(0) + Expect(dep.Relationships[constant.RelationshipTypeApplication].GUID).To(Equal(app.GUID)) + Expect(dep.RevisionGUID).To(Equal("revision-guid")) Expect(testUI.Err).To(Say("create-deployment-warning")) Expect(testUI.Out).To(Say("Waiting for app to deploy...")) - Expect(fakeActor.PollStartForRollingCallCount()).To(Equal(1)) + Expect(fakeActor.PollStartForDeploymentCallCount()).To(Equal(1)) Expect(testUI.Err).To(Say("poll-start-warning")) }) }) @@ -421,21 +412,21 @@ var _ = Describe("app stager", func() { Expect(executeErr).To(BeNil()) Expect(testUI.Out).To(Say("Creating deployment for app %s...", app.Name)) - Expect(fakeActor.CreateDeploymentByApplicationAndDropletCallCount()).To(Equal(1)) - appGUID, dropletGUID := fakeActor.CreateDeploymentByApplicationAndDropletArgsForCall(0) - Expect(appGUID).To(Equal(app.GUID)) - Expect(dropletGUID).To(Equal("droplet-guid")) + Expect(fakeActor.CreateDeploymentCallCount()).To(Equal(1)) + dep := fakeActor.CreateDeploymentArgsForCall(0) + Expect(dep.Relationships[constant.RelationshipTypeApplication].GUID).To(Equal(app.GUID)) + Expect(dep.DropletGUID).To(Equal("droplet-guid")) Expect(testUI.Err).To(Say("create-deployment-warning")) Expect(testUI.Out).To(Say("Waiting for app to deploy...")) - Expect(fakeActor.PollStartForRollingCallCount()).To(Equal(1)) + Expect(fakeActor.PollStartForDeploymentCallCount()).To(Equal(1)) Expect(testUI.Err).To(Say("poll-start-warning")) }) }) When("creating a deployment fails", func() { BeforeEach(func() { - fakeActor.CreateDeploymentByApplicationAndDropletReturns( + fakeActor.CreateDeploymentReturns( "", v7action.Warnings{"create-deployment-warning"}, errors.New("create-deployment-error"), @@ -449,7 +440,7 @@ var _ = Describe("app stager", func() { When("polling fails for a rolling restage", func() { BeforeEach(func() { - fakeActor.PollStartForRollingReturns( + fakeActor.PollStartForDeploymentReturns( v7action.Warnings{"poll-start-warning"}, errors.New("poll-start-error"), ) diff --git a/command/v7/shared/app_summary_displayer.go b/command/v7/shared/app_summary_displayer.go index 4800cfdd936..3d05941343f 100644 --- a/command/v7/shared/app_summary_displayer.go +++ b/command/v7/shared/app_summary_displayer.go @@ -181,9 +181,18 @@ func (display AppSummaryDisplayer) getDeploymentStatusText(summary v7action.Deta summary.Deployment.StatusReason, lastStatusChangeTime) } else { - return fmt.Sprintf("%s deployment currently %s", + var sb strings.Builder + sb.WriteString(fmt.Sprintf("%s deployment currently %s.", cases.Title(language.English, cases.NoLower).String(string(summary.Deployment.Strategy)), - summary.Deployment.StatusReason) + summary.Deployment.StatusReason)) + + if summary.Deployment.Strategy == constant.DeploymentStrategyCanary && summary.Deployment.StatusReason == constant.DeploymentStatusReasonPaused { + sb.WriteString("\n") + sb.WriteString(fmt.Sprintf( + "Please run `cf continue-deployment %s` to promote the canary deployment, or `cf cancel-deployment %s` to rollback to the previous version.", + summary.Application.Name, summary.Application.Name)) + } + return sb.String() } } diff --git a/command/v7/shared/app_summary_displayer_test.go b/command/v7/shared/app_summary_displayer_test.go index 8b42cb967dd..79f58fabaf7 100644 --- a/command/v7/shared/app_summary_displayer_test.go +++ b/command/v7/shared/app_summary_displayer_test.go @@ -693,7 +693,7 @@ var _ = Describe("app summary displayer", func() { }) It("displays the message", func() { - Expect(testUI.Out).To(Say(`Rolling deployment currently DEPLOYING\n`)) + Expect(testUI.Out).To(Say(`Rolling deployment currently DEPLOYING`)) Expect(testUI.Out).NotTo(Say(`\(since`)) }) }) @@ -780,6 +780,45 @@ var _ = Describe("app summary displayer", func() { }) }) }) + When("the deployment strategy is canary", func() { + When("the deployment is paused", func() { + BeforeEach(func() { + summary = v7action.DetailedApplicationSummary{ + ApplicationSummary: v7action.ApplicationSummary{ + Application: resources.Application{ + Name: "some-app", + }, + }, + Deployment: resources.Deployment{ + Strategy: constant.DeploymentStrategyCanary, + StatusValue: constant.DeploymentStatusValueActive, + StatusReason: constant.DeploymentStatusReasonPaused, + }, + } + }) + + It("displays the message", func() { + Expect(testUI.Out).To(Say("Canary deployment currently PAUSED.")) + Expect(testUI.Out).To(Say("Please run `cf continue-deployment some-app` to promote the canary deployment, or `cf cancel-deployment some-app` to rollback to the previous version.")) + }) + }) + + When("the deployment is cancelled", func() { + BeforeEach(func() { + summary = v7action.DetailedApplicationSummary{ + Deployment: resources.Deployment{ + Strategy: constant.DeploymentStrategyCanary, + StatusValue: constant.DeploymentStatusValueActive, + StatusReason: constant.DeploymentStatusReasonCanceling, + }, + } + }) + + It("displays the message", func() { + Expect(testUI.Out).To(Say("Canary deployment currently CANCELING.")) + }) + }) + }) }) When("there is no active deployment", func() { diff --git a/command/v7/shared/sharedfakes/fake_app_stager.go b/command/v7/shared/sharedfakes/fake_app_stager.go index 39ba63146d4..8c46eca4039 100644 --- a/command/v7/shared/sharedfakes/fake_app_stager.go +++ b/command/v7/shared/sharedfakes/fake_app_stager.go @@ -4,23 +4,20 @@ package sharedfakes import ( "sync" - "code.cloudfoundry.org/cli/api/cloudcontroller/ccv3/constant" "code.cloudfoundry.org/cli/command/v7/shared" "code.cloudfoundry.org/cli/resources" "code.cloudfoundry.org/cli/util/configv3" ) type FakeAppStager struct { - StageAndStartStub func(resources.Application, configv3.Space, configv3.Organization, string, constant.DeploymentStrategy, bool, constant.ApplicationAction) error + StageAndStartStub func(resources.Application, configv3.Space, configv3.Organization, string, shared.AppStartOpts) error stageAndStartMutex sync.RWMutex stageAndStartArgsForCall []struct { arg1 resources.Application arg2 configv3.Space arg3 configv3.Organization arg4 string - arg5 constant.DeploymentStrategy - arg6 bool - arg7 constant.ApplicationAction + arg5 shared.AppStartOpts } stageAndStartReturns struct { result1 error @@ -43,16 +40,14 @@ type FakeAppStager struct { result1 resources.Droplet result2 error } - StartAppStub func(resources.Application, string, constant.DeploymentStrategy, bool, configv3.Space, configv3.Organization, constant.ApplicationAction) error + StartAppStub func(resources.Application, configv3.Space, configv3.Organization, string, shared.AppStartOpts) error startAppMutex sync.RWMutex startAppArgsForCall []struct { arg1 resources.Application - arg2 string - arg3 constant.DeploymentStrategy - arg4 bool - arg5 configv3.Space - arg6 configv3.Organization - arg7 constant.ApplicationAction + arg2 configv3.Space + arg3 configv3.Organization + arg4 string + arg5 shared.AppStartOpts } startAppReturns struct { result1 error @@ -64,7 +59,7 @@ type FakeAppStager struct { invocationsMutex sync.RWMutex } -func (fake *FakeAppStager) StageAndStart(arg1 resources.Application, arg2 configv3.Space, arg3 configv3.Organization, arg4 string, arg5 constant.DeploymentStrategy, arg6 bool, arg7 constant.ApplicationAction) error { +func (fake *FakeAppStager) StageAndStart(arg1 resources.Application, arg2 configv3.Space, arg3 configv3.Organization, arg4 string, arg5 shared.AppStartOpts) error { fake.stageAndStartMutex.Lock() ret, specificReturn := fake.stageAndStartReturnsOnCall[len(fake.stageAndStartArgsForCall)] fake.stageAndStartArgsForCall = append(fake.stageAndStartArgsForCall, struct { @@ -72,19 +67,18 @@ func (fake *FakeAppStager) StageAndStart(arg1 resources.Application, arg2 config arg2 configv3.Space arg3 configv3.Organization arg4 string - arg5 constant.DeploymentStrategy - arg6 bool - arg7 constant.ApplicationAction - }{arg1, arg2, arg3, arg4, arg5, arg6, arg7}) - fake.recordInvocation("StageAndStart", []interface{}{arg1, arg2, arg3, arg4, arg5, arg6, arg7}) + arg5 shared.AppStartOpts + }{arg1, arg2, arg3, arg4, arg5}) + stub := fake.StageAndStartStub + fakeReturns := fake.stageAndStartReturns + fake.recordInvocation("StageAndStart", []interface{}{arg1, arg2, arg3, arg4, arg5}) fake.stageAndStartMutex.Unlock() - if fake.StageAndStartStub != nil { - return fake.StageAndStartStub(arg1, arg2, arg3, arg4, arg5, arg6, arg7) + if stub != nil { + return stub(arg1, arg2, arg3, arg4, arg5) } if specificReturn { return ret.result1 } - fakeReturns := fake.stageAndStartReturns return fakeReturns.result1 } @@ -94,17 +88,17 @@ func (fake *FakeAppStager) StageAndStartCallCount() int { return len(fake.stageAndStartArgsForCall) } -func (fake *FakeAppStager) StageAndStartCalls(stub func(resources.Application, configv3.Space, configv3.Organization, string, constant.DeploymentStrategy, bool, constant.ApplicationAction) error) { +func (fake *FakeAppStager) StageAndStartCalls(stub func(resources.Application, configv3.Space, configv3.Organization, string, shared.AppStartOpts) error) { fake.stageAndStartMutex.Lock() defer fake.stageAndStartMutex.Unlock() fake.StageAndStartStub = stub } -func (fake *FakeAppStager) StageAndStartArgsForCall(i int) (resources.Application, configv3.Space, configv3.Organization, string, constant.DeploymentStrategy, bool, constant.ApplicationAction) { +func (fake *FakeAppStager) StageAndStartArgsForCall(i int) (resources.Application, configv3.Space, configv3.Organization, string, shared.AppStartOpts) { fake.stageAndStartMutex.RLock() defer fake.stageAndStartMutex.RUnlock() argsForCall := fake.stageAndStartArgsForCall[i] - return argsForCall.arg1, argsForCall.arg2, argsForCall.arg3, argsForCall.arg4, argsForCall.arg5, argsForCall.arg6, argsForCall.arg7 + return argsForCall.arg1, argsForCall.arg2, argsForCall.arg3, argsForCall.arg4, argsForCall.arg5 } func (fake *FakeAppStager) StageAndStartReturns(result1 error) { @@ -138,15 +132,16 @@ func (fake *FakeAppStager) StageApp(arg1 resources.Application, arg2 string, arg arg2 string arg3 configv3.Space }{arg1, arg2, arg3}) + stub := fake.StageAppStub + fakeReturns := fake.stageAppReturns fake.recordInvocation("StageApp", []interface{}{arg1, arg2, arg3}) fake.stageAppMutex.Unlock() - if fake.StageAppStub != nil { - return fake.StageAppStub(arg1, arg2, arg3) + if stub != nil { + return stub(arg1, arg2, arg3) } if specificReturn { return ret.result1, ret.result2 } - fakeReturns := fake.stageAppReturns return fakeReturns.result1, fakeReturns.result2 } @@ -195,27 +190,26 @@ func (fake *FakeAppStager) StageAppReturnsOnCall(i int, result1 resources.Drople }{result1, result2} } -func (fake *FakeAppStager) StartApp(arg1 resources.Application, arg2 string, arg3 constant.DeploymentStrategy, arg4 bool, arg5 configv3.Space, arg6 configv3.Organization, arg7 constant.ApplicationAction) error { +func (fake *FakeAppStager) StartApp(arg1 resources.Application, arg2 configv3.Space, arg3 configv3.Organization, arg4 string, arg5 shared.AppStartOpts) error { fake.startAppMutex.Lock() ret, specificReturn := fake.startAppReturnsOnCall[len(fake.startAppArgsForCall)] fake.startAppArgsForCall = append(fake.startAppArgsForCall, struct { arg1 resources.Application - arg2 string - arg3 constant.DeploymentStrategy - arg4 bool - arg5 configv3.Space - arg6 configv3.Organization - arg7 constant.ApplicationAction - }{arg1, arg2, arg3, arg4, arg5, arg6, arg7}) - fake.recordInvocation("StartApp", []interface{}{arg1, arg2, arg3, arg4, arg5, arg6, arg7}) + arg2 configv3.Space + arg3 configv3.Organization + arg4 string + arg5 shared.AppStartOpts + }{arg1, arg2, arg3, arg4, arg5}) + stub := fake.StartAppStub + fakeReturns := fake.startAppReturns + fake.recordInvocation("StartApp", []interface{}{arg1, arg2, arg3, arg4, arg5}) fake.startAppMutex.Unlock() - if fake.StartAppStub != nil { - return fake.StartAppStub(arg1, arg2, arg3, arg4, arg5, arg6, arg7) + if stub != nil { + return stub(arg1, arg2, arg3, arg4, arg5) } if specificReturn { return ret.result1 } - fakeReturns := fake.startAppReturns return fakeReturns.result1 } @@ -225,17 +219,17 @@ func (fake *FakeAppStager) StartAppCallCount() int { return len(fake.startAppArgsForCall) } -func (fake *FakeAppStager) StartAppCalls(stub func(resources.Application, string, constant.DeploymentStrategy, bool, configv3.Space, configv3.Organization, constant.ApplicationAction) error) { +func (fake *FakeAppStager) StartAppCalls(stub func(resources.Application, configv3.Space, configv3.Organization, string, shared.AppStartOpts) error) { fake.startAppMutex.Lock() defer fake.startAppMutex.Unlock() fake.StartAppStub = stub } -func (fake *FakeAppStager) StartAppArgsForCall(i int) (resources.Application, string, constant.DeploymentStrategy, bool, configv3.Space, configv3.Organization, constant.ApplicationAction) { +func (fake *FakeAppStager) StartAppArgsForCall(i int) (resources.Application, configv3.Space, configv3.Organization, string, shared.AppStartOpts) { fake.startAppMutex.RLock() defer fake.startAppMutex.RUnlock() argsForCall := fake.startAppArgsForCall[i] - return argsForCall.arg1, argsForCall.arg2, argsForCall.arg3, argsForCall.arg4, argsForCall.arg5, argsForCall.arg6, argsForCall.arg7 + return argsForCall.arg1, argsForCall.arg2, argsForCall.arg3, argsForCall.arg4, argsForCall.arg5 } func (fake *FakeAppStager) StartAppReturns(result1 error) { diff --git a/command/v7/start_command.go b/command/v7/start_command.go index 823341ff29c..3316ab5474e 100644 --- a/command/v7/start_command.go +++ b/command/v7/start_command.go @@ -62,6 +62,12 @@ func (cmd StartCommand) Execute(args []string) error { return err } + opts := shared.AppStartOpts{ + Strategy: constant.DeploymentStrategyDefault, + NoWait: false, + AppAction: constant.ApplicationStarting, + } + if packageGUID != "" && app.Stopped() { cmd.UI.DisplayTextWithFlavor("Starting app {{.AppName}} in org {{.OrgName}} / space {{.SpaceName}} as {{.Username}}...", map[string]interface{}{ "AppName": cmd.RequiredArgs.AppName, @@ -71,17 +77,8 @@ func (cmd StartCommand) Execute(args []string) error { }) cmd.UI.DisplayNewline() - err = cmd.Stager.StageAndStart(app, cmd.Config.TargetedSpace(), cmd.Config.TargetedOrganization(), packageGUID, constant.DeploymentStrategyDefault, false, constant.ApplicationStarting) - if err != nil { - return err - } - } else { - err = cmd.Stager.StartApp(app, "", constant.DeploymentStrategyDefault, false, cmd.Config.TargetedSpace(), cmd.Config.TargetedOrganization(), constant.ApplicationStarting) - if err != nil { - return err - } + return cmd.Stager.StageAndStart(app, cmd.Config.TargetedSpace(), cmd.Config.TargetedOrganization(), packageGUID, opts) } - return nil - + return cmd.Stager.StartApp(app, cmd.Config.TargetedSpace(), cmd.Config.TargetedOrganization(), "", opts) } diff --git a/command/v7/start_command_test.go b/command/v7/start_command_test.go index 6575fcca8f7..bc8a1c2759d 100644 --- a/command/v7/start_command_test.go +++ b/command/v7/start_command_test.go @@ -140,14 +140,14 @@ var _ = Describe("start Command", func() { Expect(executeErr).ToNot(HaveOccurred()) Expect(fakeAppStager.StageAndStartCallCount()).To(Equal(1)) - inputApp, inputSpace, inputOrg, inputPkgGUID, inputStrategy, inputNoWait, inputAppAction := fakeAppStager.StageAndStartArgsForCall(0) + inputApp, inputSpace, inputOrg, inputPkgGUID, opts := fakeAppStager.StageAndStartArgsForCall(0) Expect(inputApp).To(Equal(app)) Expect(inputSpace).To(Equal(cmd.Config.TargetedSpace())) Expect(inputOrg).To(Equal(cmd.Config.TargetedOrganization())) Expect(inputPkgGUID).To(Equal("package-guid")) - Expect(inputStrategy).To(Equal(constant.DeploymentStrategyDefault)) - Expect(inputNoWait).To(Equal(false)) - Expect(inputAppAction).To(Equal(constant.ApplicationStarting)) + Expect(opts.Strategy).To(Equal(constant.DeploymentStrategyDefault)) + Expect(opts.NoWait).To(Equal(false)) + Expect(opts.AppAction).To(Equal(constant.ApplicationStarting)) }) When("staging and starting the app returns an error", func() { @@ -171,14 +171,14 @@ var _ = Describe("start Command", func() { Expect(executeErr).ToNot(HaveOccurred()) Expect(fakeAppStager.StartAppCallCount()).To(Equal(1)) - inputApp, inputDropletGuid, inputStrategy, inputNoWait, inputSpace, inputOrg, inputAppAction := fakeAppStager.StartAppArgsForCall(0) + inputApp, inputSpace, inputOrg, inputDropletGuid, opts := fakeAppStager.StartAppArgsForCall(0) Expect(inputApp).To(Equal(app)) Expect(inputDropletGuid).To(Equal("")) - Expect(inputStrategy).To(Equal(constant.DeploymentStrategyDefault)) - Expect(inputNoWait).To(Equal(false)) Expect(inputSpace).To(Equal(cmd.Config.TargetedSpace())) Expect(inputOrg).To(Equal(cmd.Config.TargetedOrganization())) - Expect(inputAppAction).To(Equal(constant.ApplicationStarting)) + Expect(opts.Strategy).To(Equal(constant.DeploymentStrategyDefault)) + Expect(opts.NoWait).To(Equal(false)) + Expect(opts.AppAction).To(Equal(constant.ApplicationStarting)) }) When("starting the app returns an error", func() { @@ -202,14 +202,14 @@ var _ = Describe("start Command", func() { Expect(executeErr).ToNot(HaveOccurred()) Expect(fakeAppStager.StartAppCallCount()).To(Equal(1)) - inputApp, inputDropletGuid, inputStrategy, inputNoWait, inputSpace, inputOrg, inputAppAction := fakeAppStager.StartAppArgsForCall(0) + inputApp, inputSpace, inputOrg, inputDropletGuid, opts := fakeAppStager.StartAppArgsForCall(0) Expect(inputApp).To(Equal(app)) Expect(inputDropletGuid).To(Equal("")) - Expect(inputStrategy).To(Equal(constant.DeploymentStrategyDefault)) - Expect(inputNoWait).To(Equal(false)) Expect(inputSpace).To(Equal(cmd.Config.TargetedSpace())) Expect(inputOrg).To(Equal(cmd.Config.TargetedOrganization())) - Expect(inputAppAction).To(Equal(constant.ApplicationStarting)) + Expect(opts.Strategy).To(Equal(constant.DeploymentStrategyDefault)) + Expect(opts.NoWait).To(Equal(false)) + Expect(opts.AppAction).To(Equal(constant.ApplicationStarting)) }) When("starting the app returns an error", func() { diff --git a/command/v7/v7fakes/fake_actor.go b/command/v7/v7fakes/fake_actor.go index 9307ec8da73..12df707c491 100644 --- a/command/v7/v7fakes/fake_actor.go +++ b/command/v7/v7fakes/fake_actor.go @@ -128,6 +128,19 @@ type FakeActor struct { clearTargetMutex sync.RWMutex clearTargetArgsForCall []struct { } + ContinueDeploymentStub func(string) (v7action.Warnings, error) + continueDeploymentMutex sync.RWMutex + continueDeploymentArgsForCall []struct { + arg1 string + } + continueDeploymentReturns struct { + result1 v7action.Warnings + result2 error + } + continueDeploymentReturnsOnCall map[int]struct { + result1 v7action.Warnings + result2 error + } CopyPackageStub func(resources.Application, resources.Application) (resources.Package, v7action.Warnings, error) copyPackageMutex sync.RWMutex copyPackageArgsForCall []struct { @@ -222,34 +235,17 @@ type FakeActor struct { result2 v7action.Warnings result3 error } - CreateDeploymentByApplicationAndDropletStub func(string, string) (string, v7action.Warnings, error) - createDeploymentByApplicationAndDropletMutex sync.RWMutex - createDeploymentByApplicationAndDropletArgsForCall []struct { - arg1 string - arg2 string + CreateDeploymentStub func(resources.Deployment) (string, v7action.Warnings, error) + createDeploymentMutex sync.RWMutex + createDeploymentArgsForCall []struct { + arg1 resources.Deployment } - createDeploymentByApplicationAndDropletReturns struct { + createDeploymentReturns struct { result1 string result2 v7action.Warnings result3 error } - createDeploymentByApplicationAndDropletReturnsOnCall map[int]struct { - result1 string - result2 v7action.Warnings - result3 error - } - CreateDeploymentByApplicationAndRevisionStub func(string, string) (string, v7action.Warnings, error) - createDeploymentByApplicationAndRevisionMutex sync.RWMutex - createDeploymentByApplicationAndRevisionArgsForCall []struct { - arg1 string - arg2 string - } - createDeploymentByApplicationAndRevisionReturns struct { - result1 string - result2 v7action.Warnings - result3 error - } - createDeploymentByApplicationAndRevisionReturnsOnCall map[int]struct { + createDeploymentReturnsOnCall map[int]struct { result1 string result2 v7action.Warnings result3 error @@ -2563,19 +2559,19 @@ type FakeActor struct { result1 v7action.Warnings result2 error } - PollStartForRollingStub func(resources.Application, string, bool, func(string)) (v7action.Warnings, error) - pollStartForRollingMutex sync.RWMutex - pollStartForRollingArgsForCall []struct { + PollStartForDeploymentStub func(resources.Application, string, bool, func(string)) (v7action.Warnings, error) + pollStartForDeploymentMutex sync.RWMutex + pollStartForDeploymentArgsForCall []struct { arg1 resources.Application arg2 string arg3 bool arg4 func(string) } - pollStartForRollingReturns struct { + pollStartForDeploymentReturns struct { result1 v7action.Warnings result2 error } - pollStartForRollingReturnsOnCall map[int]struct { + pollStartForDeploymentReturnsOnCall map[int]struct { result1 v7action.Warnings result2 error } @@ -4125,6 +4121,70 @@ func (fake *FakeActor) ClearTargetCalls(stub func()) { fake.ClearTargetStub = stub } +func (fake *FakeActor) ContinueDeployment(arg1 string) (v7action.Warnings, error) { + fake.continueDeploymentMutex.Lock() + ret, specificReturn := fake.continueDeploymentReturnsOnCall[len(fake.continueDeploymentArgsForCall)] + fake.continueDeploymentArgsForCall = append(fake.continueDeploymentArgsForCall, struct { + arg1 string + }{arg1}) + stub := fake.ContinueDeploymentStub + fakeReturns := fake.continueDeploymentReturns + fake.recordInvocation("ContinueDeployment", []interface{}{arg1}) + fake.continueDeploymentMutex.Unlock() + if stub != nil { + return stub(arg1) + } + if specificReturn { + return ret.result1, ret.result2 + } + return fakeReturns.result1, fakeReturns.result2 +} + +func (fake *FakeActor) ContinueDeploymentCallCount() int { + fake.continueDeploymentMutex.RLock() + defer fake.continueDeploymentMutex.RUnlock() + return len(fake.continueDeploymentArgsForCall) +} + +func (fake *FakeActor) ContinueDeploymentCalls(stub func(string) (v7action.Warnings, error)) { + fake.continueDeploymentMutex.Lock() + defer fake.continueDeploymentMutex.Unlock() + fake.ContinueDeploymentStub = stub +} + +func (fake *FakeActor) ContinueDeploymentArgsForCall(i int) string { + fake.continueDeploymentMutex.RLock() + defer fake.continueDeploymentMutex.RUnlock() + argsForCall := fake.continueDeploymentArgsForCall[i] + return argsForCall.arg1 +} + +func (fake *FakeActor) ContinueDeploymentReturns(result1 v7action.Warnings, result2 error) { + fake.continueDeploymentMutex.Lock() + defer fake.continueDeploymentMutex.Unlock() + fake.ContinueDeploymentStub = nil + fake.continueDeploymentReturns = struct { + result1 v7action.Warnings + result2 error + }{result1, result2} +} + +func (fake *FakeActor) ContinueDeploymentReturnsOnCall(i int, result1 v7action.Warnings, result2 error) { + fake.continueDeploymentMutex.Lock() + defer fake.continueDeploymentMutex.Unlock() + fake.ContinueDeploymentStub = nil + if fake.continueDeploymentReturnsOnCall == nil { + fake.continueDeploymentReturnsOnCall = make(map[int]struct { + result1 v7action.Warnings + result2 error + }) + } + fake.continueDeploymentReturnsOnCall[i] = struct { + result1 v7action.Warnings + result2 error + }{result1, result2} +} + func (fake *FakeActor) CopyPackage(arg1 resources.Application, arg2 resources.Application) (resources.Package, v7action.Warnings, error) { fake.copyPackageMutex.Lock() ret, specificReturn := fake.copyPackageReturnsOnCall[len(fake.copyPackageArgsForCall)] @@ -4531,87 +4591,18 @@ func (fake *FakeActor) CreateBuildpackReturnsOnCall(i int, result1 resources.Bui }{result1, result2, result3} } -func (fake *FakeActor) CreateDeploymentByApplicationAndDroplet(arg1 string, arg2 string) (string, v7action.Warnings, error) { - fake.createDeploymentByApplicationAndDropletMutex.Lock() - ret, specificReturn := fake.createDeploymentByApplicationAndDropletReturnsOnCall[len(fake.createDeploymentByApplicationAndDropletArgsForCall)] - fake.createDeploymentByApplicationAndDropletArgsForCall = append(fake.createDeploymentByApplicationAndDropletArgsForCall, struct { - arg1 string - arg2 string - }{arg1, arg2}) - stub := fake.CreateDeploymentByApplicationAndDropletStub - fakeReturns := fake.createDeploymentByApplicationAndDropletReturns - fake.recordInvocation("CreateDeploymentByApplicationAndDroplet", []interface{}{arg1, arg2}) - fake.createDeploymentByApplicationAndDropletMutex.Unlock() - if stub != nil { - return stub(arg1, arg2) - } - if specificReturn { - return ret.result1, ret.result2, ret.result3 - } - return fakeReturns.result1, fakeReturns.result2, fakeReturns.result3 -} - -func (fake *FakeActor) CreateDeploymentByApplicationAndDropletCallCount() int { - fake.createDeploymentByApplicationAndDropletMutex.RLock() - defer fake.createDeploymentByApplicationAndDropletMutex.RUnlock() - return len(fake.createDeploymentByApplicationAndDropletArgsForCall) -} - -func (fake *FakeActor) CreateDeploymentByApplicationAndDropletCalls(stub func(string, string) (string, v7action.Warnings, error)) { - fake.createDeploymentByApplicationAndDropletMutex.Lock() - defer fake.createDeploymentByApplicationAndDropletMutex.Unlock() - fake.CreateDeploymentByApplicationAndDropletStub = stub -} - -func (fake *FakeActor) CreateDeploymentByApplicationAndDropletArgsForCall(i int) (string, string) { - fake.createDeploymentByApplicationAndDropletMutex.RLock() - defer fake.createDeploymentByApplicationAndDropletMutex.RUnlock() - argsForCall := fake.createDeploymentByApplicationAndDropletArgsForCall[i] - return argsForCall.arg1, argsForCall.arg2 -} - -func (fake *FakeActor) CreateDeploymentByApplicationAndDropletReturns(result1 string, result2 v7action.Warnings, result3 error) { - fake.createDeploymentByApplicationAndDropletMutex.Lock() - defer fake.createDeploymentByApplicationAndDropletMutex.Unlock() - fake.CreateDeploymentByApplicationAndDropletStub = nil - fake.createDeploymentByApplicationAndDropletReturns = struct { - result1 string - result2 v7action.Warnings - result3 error - }{result1, result2, result3} -} - -func (fake *FakeActor) CreateDeploymentByApplicationAndDropletReturnsOnCall(i int, result1 string, result2 v7action.Warnings, result3 error) { - fake.createDeploymentByApplicationAndDropletMutex.Lock() - defer fake.createDeploymentByApplicationAndDropletMutex.Unlock() - fake.CreateDeploymentByApplicationAndDropletStub = nil - if fake.createDeploymentByApplicationAndDropletReturnsOnCall == nil { - fake.createDeploymentByApplicationAndDropletReturnsOnCall = make(map[int]struct { - result1 string - result2 v7action.Warnings - result3 error - }) - } - fake.createDeploymentByApplicationAndDropletReturnsOnCall[i] = struct { - result1 string - result2 v7action.Warnings - result3 error - }{result1, result2, result3} -} - -func (fake *FakeActor) CreateDeploymentByApplicationAndRevision(arg1 string, arg2 string) (string, v7action.Warnings, error) { - fake.createDeploymentByApplicationAndRevisionMutex.Lock() - ret, specificReturn := fake.createDeploymentByApplicationAndRevisionReturnsOnCall[len(fake.createDeploymentByApplicationAndRevisionArgsForCall)] - fake.createDeploymentByApplicationAndRevisionArgsForCall = append(fake.createDeploymentByApplicationAndRevisionArgsForCall, struct { - arg1 string - arg2 string - }{arg1, arg2}) - stub := fake.CreateDeploymentByApplicationAndRevisionStub - fakeReturns := fake.createDeploymentByApplicationAndRevisionReturns - fake.recordInvocation("CreateDeploymentByApplicationAndRevision", []interface{}{arg1, arg2}) - fake.createDeploymentByApplicationAndRevisionMutex.Unlock() +func (fake *FakeActor) CreateDeployment(arg1 resources.Deployment) (string, v7action.Warnings, error) { + fake.createDeploymentMutex.Lock() + ret, specificReturn := fake.createDeploymentReturnsOnCall[len(fake.createDeploymentArgsForCall)] + fake.createDeploymentArgsForCall = append(fake.createDeploymentArgsForCall, struct { + arg1 resources.Deployment + }{arg1}) + stub := fake.CreateDeploymentStub + fakeReturns := fake.createDeploymentReturns + fake.recordInvocation("CreateDeployment", []interface{}{arg1}) + fake.createDeploymentMutex.Unlock() if stub != nil { - return stub(arg1, arg2) + return stub(arg1) } if specificReturn { return ret.result1, ret.result2, ret.result3 @@ -4619,48 +4610,48 @@ func (fake *FakeActor) CreateDeploymentByApplicationAndRevision(arg1 string, arg return fakeReturns.result1, fakeReturns.result2, fakeReturns.result3 } -func (fake *FakeActor) CreateDeploymentByApplicationAndRevisionCallCount() int { - fake.createDeploymentByApplicationAndRevisionMutex.RLock() - defer fake.createDeploymentByApplicationAndRevisionMutex.RUnlock() - return len(fake.createDeploymentByApplicationAndRevisionArgsForCall) +func (fake *FakeActor) CreateDeploymentCallCount() int { + fake.createDeploymentMutex.RLock() + defer fake.createDeploymentMutex.RUnlock() + return len(fake.createDeploymentArgsForCall) } -func (fake *FakeActor) CreateDeploymentByApplicationAndRevisionCalls(stub func(string, string) (string, v7action.Warnings, error)) { - fake.createDeploymentByApplicationAndRevisionMutex.Lock() - defer fake.createDeploymentByApplicationAndRevisionMutex.Unlock() - fake.CreateDeploymentByApplicationAndRevisionStub = stub +func (fake *FakeActor) CreateDeploymentCalls(stub func(resources.Deployment) (string, v7action.Warnings, error)) { + fake.createDeploymentMutex.Lock() + defer fake.createDeploymentMutex.Unlock() + fake.CreateDeploymentStub = stub } -func (fake *FakeActor) CreateDeploymentByApplicationAndRevisionArgsForCall(i int) (string, string) { - fake.createDeploymentByApplicationAndRevisionMutex.RLock() - defer fake.createDeploymentByApplicationAndRevisionMutex.RUnlock() - argsForCall := fake.createDeploymentByApplicationAndRevisionArgsForCall[i] - return argsForCall.arg1, argsForCall.arg2 +func (fake *FakeActor) CreateDeploymentArgsForCall(i int) resources.Deployment { + fake.createDeploymentMutex.RLock() + defer fake.createDeploymentMutex.RUnlock() + argsForCall := fake.createDeploymentArgsForCall[i] + return argsForCall.arg1 } -func (fake *FakeActor) CreateDeploymentByApplicationAndRevisionReturns(result1 string, result2 v7action.Warnings, result3 error) { - fake.createDeploymentByApplicationAndRevisionMutex.Lock() - defer fake.createDeploymentByApplicationAndRevisionMutex.Unlock() - fake.CreateDeploymentByApplicationAndRevisionStub = nil - fake.createDeploymentByApplicationAndRevisionReturns = struct { +func (fake *FakeActor) CreateDeploymentReturns(result1 string, result2 v7action.Warnings, result3 error) { + fake.createDeploymentMutex.Lock() + defer fake.createDeploymentMutex.Unlock() + fake.CreateDeploymentStub = nil + fake.createDeploymentReturns = struct { result1 string result2 v7action.Warnings result3 error }{result1, result2, result3} } -func (fake *FakeActor) CreateDeploymentByApplicationAndRevisionReturnsOnCall(i int, result1 string, result2 v7action.Warnings, result3 error) { - fake.createDeploymentByApplicationAndRevisionMutex.Lock() - defer fake.createDeploymentByApplicationAndRevisionMutex.Unlock() - fake.CreateDeploymentByApplicationAndRevisionStub = nil - if fake.createDeploymentByApplicationAndRevisionReturnsOnCall == nil { - fake.createDeploymentByApplicationAndRevisionReturnsOnCall = make(map[int]struct { +func (fake *FakeActor) CreateDeploymentReturnsOnCall(i int, result1 string, result2 v7action.Warnings, result3 error) { + fake.createDeploymentMutex.Lock() + defer fake.createDeploymentMutex.Unlock() + fake.CreateDeploymentStub = nil + if fake.createDeploymentReturnsOnCall == nil { + fake.createDeploymentReturnsOnCall = make(map[int]struct { result1 string result2 v7action.Warnings result3 error }) } - fake.createDeploymentByApplicationAndRevisionReturnsOnCall[i] = struct { + fake.createDeploymentReturnsOnCall[i] = struct { result1 string result2 v7action.Warnings result3 error @@ -14719,19 +14710,19 @@ func (fake *FakeActor) PollStartReturnsOnCall(i int, result1 v7action.Warnings, }{result1, result2} } -func (fake *FakeActor) PollStartForRolling(arg1 resources.Application, arg2 string, arg3 bool, arg4 func(string)) (v7action.Warnings, error) { - fake.pollStartForRollingMutex.Lock() - ret, specificReturn := fake.pollStartForRollingReturnsOnCall[len(fake.pollStartForRollingArgsForCall)] - fake.pollStartForRollingArgsForCall = append(fake.pollStartForRollingArgsForCall, struct { +func (fake *FakeActor) PollStartForDeployment(arg1 resources.Application, arg2 string, arg3 bool, arg4 func(string)) (v7action.Warnings, error) { + fake.pollStartForDeploymentMutex.Lock() + ret, specificReturn := fake.pollStartForDeploymentReturnsOnCall[len(fake.pollStartForDeploymentArgsForCall)] + fake.pollStartForDeploymentArgsForCall = append(fake.pollStartForDeploymentArgsForCall, struct { arg1 resources.Application arg2 string arg3 bool arg4 func(string) }{arg1, arg2, arg3, arg4}) - stub := fake.PollStartForRollingStub - fakeReturns := fake.pollStartForRollingReturns - fake.recordInvocation("PollStartForRolling", []interface{}{arg1, arg2, arg3, arg4}) - fake.pollStartForRollingMutex.Unlock() + stub := fake.PollStartForDeploymentStub + fakeReturns := fake.pollStartForDeploymentReturns + fake.recordInvocation("PollStartForDeployment", []interface{}{arg1, arg2, arg3, arg4}) + fake.pollStartForDeploymentMutex.Unlock() if stub != nil { return stub(arg1, arg2, arg3, arg4) } @@ -14741,46 +14732,46 @@ func (fake *FakeActor) PollStartForRolling(arg1 resources.Application, arg2 stri return fakeReturns.result1, fakeReturns.result2 } -func (fake *FakeActor) PollStartForRollingCallCount() int { - fake.pollStartForRollingMutex.RLock() - defer fake.pollStartForRollingMutex.RUnlock() - return len(fake.pollStartForRollingArgsForCall) +func (fake *FakeActor) PollStartForDeploymentCallCount() int { + fake.pollStartForDeploymentMutex.RLock() + defer fake.pollStartForDeploymentMutex.RUnlock() + return len(fake.pollStartForDeploymentArgsForCall) } -func (fake *FakeActor) PollStartForRollingCalls(stub func(resources.Application, string, bool, func(string)) (v7action.Warnings, error)) { - fake.pollStartForRollingMutex.Lock() - defer fake.pollStartForRollingMutex.Unlock() - fake.PollStartForRollingStub = stub +func (fake *FakeActor) PollStartForDeploymentCalls(stub func(resources.Application, string, bool, func(string)) (v7action.Warnings, error)) { + fake.pollStartForDeploymentMutex.Lock() + defer fake.pollStartForDeploymentMutex.Unlock() + fake.PollStartForDeploymentStub = stub } -func (fake *FakeActor) PollStartForRollingArgsForCall(i int) (resources.Application, string, bool, func(string)) { - fake.pollStartForRollingMutex.RLock() - defer fake.pollStartForRollingMutex.RUnlock() - argsForCall := fake.pollStartForRollingArgsForCall[i] +func (fake *FakeActor) PollStartForDeploymentArgsForCall(i int) (resources.Application, string, bool, func(string)) { + fake.pollStartForDeploymentMutex.RLock() + defer fake.pollStartForDeploymentMutex.RUnlock() + argsForCall := fake.pollStartForDeploymentArgsForCall[i] return argsForCall.arg1, argsForCall.arg2, argsForCall.arg3, argsForCall.arg4 } -func (fake *FakeActor) PollStartForRollingReturns(result1 v7action.Warnings, result2 error) { - fake.pollStartForRollingMutex.Lock() - defer fake.pollStartForRollingMutex.Unlock() - fake.PollStartForRollingStub = nil - fake.pollStartForRollingReturns = struct { +func (fake *FakeActor) PollStartForDeploymentReturns(result1 v7action.Warnings, result2 error) { + fake.pollStartForDeploymentMutex.Lock() + defer fake.pollStartForDeploymentMutex.Unlock() + fake.PollStartForDeploymentStub = nil + fake.pollStartForDeploymentReturns = struct { result1 v7action.Warnings result2 error }{result1, result2} } -func (fake *FakeActor) PollStartForRollingReturnsOnCall(i int, result1 v7action.Warnings, result2 error) { - fake.pollStartForRollingMutex.Lock() - defer fake.pollStartForRollingMutex.Unlock() - fake.PollStartForRollingStub = nil - if fake.pollStartForRollingReturnsOnCall == nil { - fake.pollStartForRollingReturnsOnCall = make(map[int]struct { +func (fake *FakeActor) PollStartForDeploymentReturnsOnCall(i int, result1 v7action.Warnings, result2 error) { + fake.pollStartForDeploymentMutex.Lock() + defer fake.pollStartForDeploymentMutex.Unlock() + fake.PollStartForDeploymentStub = nil + if fake.pollStartForDeploymentReturnsOnCall == nil { + fake.pollStartForDeploymentReturnsOnCall = make(map[int]struct { result1 v7action.Warnings result2 error }) } - fake.pollStartForRollingReturnsOnCall[i] = struct { + fake.pollStartForDeploymentReturnsOnCall[i] = struct { result1 v7action.Warnings result2 error }{result1, result2} @@ -19501,6 +19492,8 @@ func (fake *FakeActor) Invocations() map[string][][]interface{} { defer fake.checkRouteMutex.RUnlock() fake.clearTargetMutex.RLock() defer fake.clearTargetMutex.RUnlock() + fake.continueDeploymentMutex.RLock() + defer fake.continueDeploymentMutex.RUnlock() fake.copyPackageMutex.RLock() defer fake.copyPackageMutex.RUnlock() fake.createAndUploadBitsPackageByApplicationNameAndSpaceMutex.RLock() @@ -19513,10 +19506,8 @@ func (fake *FakeActor) Invocations() map[string][][]interface{} { defer fake.createBitsPackageByApplicationMutex.RUnlock() fake.createBuildpackMutex.RLock() defer fake.createBuildpackMutex.RUnlock() - fake.createDeploymentByApplicationAndDropletMutex.RLock() - defer fake.createDeploymentByApplicationAndDropletMutex.RUnlock() - fake.createDeploymentByApplicationAndRevisionMutex.RLock() - defer fake.createDeploymentByApplicationAndRevisionMutex.RUnlock() + fake.createDeploymentMutex.RLock() + defer fake.createDeploymentMutex.RUnlock() fake.createDockerPackageByApplicationMutex.RLock() defer fake.createDockerPackageByApplicationMutex.RUnlock() fake.createDockerPackageByApplicationNameAndSpaceMutex.RLock() @@ -19819,8 +19810,8 @@ func (fake *FakeActor) Invocations() map[string][][]interface{} { defer fake.pollPackageMutex.RUnlock() fake.pollStartMutex.RLock() defer fake.pollStartMutex.RUnlock() - fake.pollStartForRollingMutex.RLock() - defer fake.pollStartForRollingMutex.RUnlock() + fake.pollStartForDeploymentMutex.RLock() + defer fake.pollStartForDeploymentMutex.RUnlock() fake.pollTaskMutex.RLock() defer fake.pollTaskMutex.RUnlock() fake.pollUploadBuildpackJobMutex.RLock() diff --git a/integration/v7/isolated/app_command_test.go b/integration/v7/isolated/app_command_test.go index b7e89fb1fad..8f62bc84672 100644 --- a/integration/v7/isolated/app_command_test.go +++ b/integration/v7/isolated/app_command_test.go @@ -285,6 +285,29 @@ applications: }) }) }) + + When("the deployment strategy is canary", func() { + When("the deployment is paused", func() { + It("displays the message", func() { + Eventually(helpers.CF("restart", appName, "--strategy", "canary")).Should(Exit(0)) + + session1 := helpers.CF("app", appName) + Eventually(session1).Should(Say("Canary deployment currently PAUSED.")) + Eventually(session1).Should(Exit(0)) + }) + }) + + When("the deployment is cancelled after it is paused", func() { + It("no deployment information is displayed", func() { + Eventually(helpers.CF("restart", appName, "--strategy", "canary")).Should(Exit(0)) + Eventually(helpers.CF("cancel-deployment", appName)).Should(Exit(0)) + + session2 := helpers.CF("app", appName) + Eventually(session2).ShouldNot(Say("Canary deployment currently CANCELING.")) + Eventually(session2).Should(Exit(0)) + }) + }) + }) }) When("there is no active deployment", func() { diff --git a/integration/v7/isolated/cancel_deployment_test.go b/integration/v7/isolated/cancel_deployment_test.go index 7b0d4dc01ec..7a2d1066a86 100644 --- a/integration/v7/isolated/cancel_deployment_test.go +++ b/integration/v7/isolated/cancel_deployment_test.go @@ -90,16 +90,32 @@ var _ = Describe("Cancel Deployment", func() { }) }) - It("succeeds", func() { - helpers.WithHelloWorldApp(func(appDir string) { - Eventually(helpers.CF("push", appName, "-p", appDir, "--strategy=rolling", "--no-wait")).Should(Exit(0)) + When("There is a rolling deployment", func() { + It("succeeds", func() { + helpers.WithHelloWorldApp(func(appDir string) { + Eventually(helpers.CF("push", appName, "-p", appDir, "--strategy=rolling", "--no-wait")).Should(Exit(0)) + }) + + session := helpers.CF("cancel-deployment", appName) + Eventually(session).Should(Say(fmt.Sprintf("Canceling deployment for app %s in org %s / space %s as %s...", appName, orgName, spaceName, userName))) + Eventually(session).Should(Say("OK")) + Eventually(session).Should(Say(fmt.Sprintf(`TIP: Run 'cf app %s' to view app status.`, appName))) + Eventually(session).Should(Exit(0)) }) + }) - session := helpers.CF("cancel-deployment", appName) - Eventually(session).Should(Say(fmt.Sprintf("Canceling deployment for app %s in org %s / space %s as %s...", appName, orgName, spaceName, userName))) - Eventually(session).Should(Say("OK")) - Eventually(session).Should(Say(fmt.Sprintf(`TIP: Run 'cf app %s' to view app status.`, appName))) - Eventually(session).Should(Exit(0)) + When("There is a canary deployment", func() { + It("succeeds", func() { + helpers.WithHelloWorldApp(func(appDir string) { + Eventually(helpers.CF("push", appName, "-p", appDir, "--strategy=canary", "--no-wait")).Should(Exit(0)) + }) + + session := helpers.CF("cancel-deployment", appName) + Eventually(session).Should(Say(fmt.Sprintf("Canceling deployment for app %s in org %s / space %s as %s...", appName, orgName, spaceName, userName))) + Eventually(session).Should(Say("OK")) + Eventually(session).Should(Say(fmt.Sprintf(`TIP: Run 'cf app %s' to view app status.`, appName))) + Eventually(session).Should(Exit(0)) + }) }) }) }) diff --git a/integration/v7/isolated/continue_deployment_test.go b/integration/v7/isolated/continue_deployment_test.go new file mode 100644 index 00000000000..18ea3dab317 --- /dev/null +++ b/integration/v7/isolated/continue_deployment_test.go @@ -0,0 +1,101 @@ +package isolated + +import ( + "fmt" + + "code.cloudfoundry.org/cli/integration/helpers" + + . "code.cloudfoundry.org/cli/cf/util/testhelpers/matchers" + + . "github.com/onsi/ginkgo/v2" + . "github.com/onsi/gomega" + . "github.com/onsi/gomega/gbytes" + . "github.com/onsi/gomega/gexec" +) + +var _ = Describe("Continue Deployment", func() { + Context("Help", func() { + It("appears in cf help -a", func() { + session := helpers.CF("help", "-a") + Eventually(session).Should(Exit(0)) + Expect(session).To(HaveCommandInCategoryWithDescription("continue-deployment", "APPS", "Continue the most recent deployment for an app.")) + }) + + It("displays the help information", func() { + session := helpers.CF("continue-deployment", "--help") + Eventually(session).Should(Say(`NAME:`)) + Eventually(session).Should(Say(`continue-deployment - Continue the most recent deployment for an app.\n`)) + Eventually(session).Should(Say(`\n`)) + + Eventually(session).Should(Say(`USAGE:`)) + Eventually(session).Should(Say(`cf continue-deployment APP_NAME\n`)) + Eventually(session).Should(Say(`\n`)) + + Eventually(session).Should(Say(`EXAMPLES:`)) + Eventually(session).Should(Say(`cf continue-deployment my-app\n`)) + Eventually(session).Should(Say(`\n`)) + + Eventually(session).Should(Say(`SEE ALSO:`)) + Eventually(session).Should(Say(`app, push`)) + + Eventually(session).Should(Exit(0)) + }) + }) + + Context("when the environment is not set up correctly", func() { + It("fails with the appropriate errors", func() { + helpers.CheckEnvironmentTargetedCorrectly(true, true, ReadOnlyOrg, "continue-deployment", "appName") + }) + }) + + Context("When the environment is set up correctly", func() { + var ( + orgName string + spaceName string + appName string + userName string + ) + + BeforeEach(func() { + appName = helpers.NewAppName() + orgName = helpers.NewOrgName() + spaceName = helpers.NewSpaceName() + + helpers.SetupCF(orgName, spaceName) + userName, _ = helpers.GetCredentials() + + helpers.WithHelloWorldApp(func(appDir string) { + Eventually(helpers.CF("push", appName, "-p", appDir, "-b", "staticfile_buildpack", "-i", "3", "--strategy", "canary")).Should(Exit(0)) + }) + }) + + AfterEach(func() { + Eventually(helpers.CF("delete", appName, "-f")).Should(Exit(0)) + }) + + Context("when there are no deployments", func() { + It("errors with a no deployments found error", func() { + session := helpers.CF("continue-deployment", appName) + Eventually(session).Should(Say(fmt.Sprintf("Continuing deployment for app %s in org %s / space %s as %s...", appName, orgName, spaceName, userName))) + Eventually(session.Err).Should(Say(`No active deployment found for app\.`)) + Eventually(session).Should(Say("FAILED")) + Eventually(session).Should(Exit(1)) + }) + }) + + Context("when the continue is successful", func() { + When("There is a canary deployment", func() { + It("succeeds", func() { + helpers.WithHelloWorldApp(func(appDir string) { + helpers.CF("push", appName, "-p", appDir, "--strategy=canary", "--no-wait").Wait() + }) + + session := helpers.CF("continue-deployment", appName) + Eventually(session).Should(Say(fmt.Sprintf("Continuing deployment for app %s in org %s / space %s as %s...", appName, orgName, spaceName, userName))) + Eventually(session).Should(Say(fmt.Sprintf(`TIP: Run 'cf app %s' to view app status.`, appName))) + Eventually(session).Should(Exit(0)) + }) + }) + }) + }) +}) diff --git a/integration/v7/isolated/copy_source_command_test.go b/integration/v7/isolated/copy_source_command_test.go index c44701a6090..83891422636 100644 --- a/integration/v7/isolated/copy_source_command_test.go +++ b/integration/v7/isolated/copy_source_command_test.go @@ -359,6 +359,47 @@ var _ = Describe("copy-source command", func() { }) }) + Describe("command behavior when the --strategy flag is set to canary", func() { + BeforeEach(func() { + orgName = helpers.NewOrgName() + spaceName = helpers.NewSpaceName() + + sourceAppName = helpers.PrefixedRandomName("hello") + targetAppName = helpers.PrefixedRandomName("banana") + + helpers.SetupCF(orgName, spaceName) + + helpers.WithHelloWorldApp(func(appDir string) { + Eventually(helpers.CF("push", sourceAppName, "--no-start", "-p", appDir, "-b", "staticfile_buildpack", "--no-route")).Should(Exit(0)) + }) + + helpers.WithBananaPantsApp(func(appDir string) { + Eventually(helpers.CF("push", targetAppName, "--no-start", "-p", appDir, "-b", "staticfile_buildpack")).Should(Exit(0)) + }) + }) + + AfterEach(func() { + helpers.QuickDeleteOrg(orgName) + }) + + It("copies the app to the provided space using a canary deploy", func() { + username, _ := helpers.GetCredentials() + session := helpers.CF("copy-source", sourceAppName, targetAppName, "--strategy", "canary") + Eventually(session).Should(Say("Copying source from app %s to target app %s in org %s / space %s as %s...", sourceAppName, targetAppName, orgName, spaceName, username)) + Eventually(session).Should(Say("Staging app %s in org %s / space %s as %s...", targetAppName, orgName, spaceName, username)) + Eventually(session).Should(Say("Waiting for app to deploy...")) + Eventually(session).Should(Exit(0)) + + Eventually(helpers.CF("start", targetAppName)).Should(Exit(0)) + resp, err := http.Get(fmt.Sprintf("http://%s.%s", targetAppName, helpers.DefaultSharedDomain())) + Expect(err).ToNot(HaveOccurred()) + defer resp.Body.Close() + body, err := io.ReadAll(resp.Body) + Expect(err).ToNot(HaveOccurred()) + Expect(string(body)).To(MatchRegexp("hello world")) + }) + }) + Describe("command behavior when the --no-wait flag is passed", func() { BeforeEach(func() { orgName = helpers.NewOrgName() @@ -407,7 +448,7 @@ func helpText(session *Session) { Eventually(session).Should(Say("USAGE:")) Eventually(session).Should(Say(`cf copy-source SOURCE_APP DESTINATION_APP \[-s TARGET_SPACE \[-o TARGET_ORG\]\] \[--no-restart\] \[--strategy STRATEGY\] \[--no-wait\]`)) Eventually(session).Should(Say("OPTIONS:")) - Eventually(session).Should(Say(`--strategy\s+Deployment strategy, either rolling or null`)) + Eventually(session).Should(Say(`--strategy\s+Deployment strategy can be canary, rolling or null`)) Eventually(session).Should(Say(`--no-wait\s+ Exit when the first instance of the web process is healthy`)) Eventually(session).Should(Say(`--no-restart\s+Do not restage the destination application`)) Eventually(session).Should(Say(`--organization, -o\s+Org that contains the destination application`)) diff --git a/integration/v7/isolated/restage_command_test.go b/integration/v7/isolated/restage_command_test.go index d70a8e11796..ee6ee8a10fe 100644 --- a/integration/v7/isolated/restage_command_test.go +++ b/integration/v7/isolated/restage_command_test.go @@ -23,15 +23,15 @@ var _ = Describe("restage command", func() { Eventually(session).ShouldNot(Say(`This action will cause app downtime.`)) Eventually(session).Should(Say("USAGE:")) Eventually(session).Should(Say("cf restage APP_NAME")) - Eventually(session).Should(Say("This command will cause downtime unless you use '--strategy rolling'.")) + Eventually(session).Should(Say("This command will cause downtime unless you use '--strategy")) Eventually(session).Should(Say("EXAMPLES:")) Eventually(session).Should(Say("cf restage APP_NAME")) Eventually(session).Should(Say("cf restage APP_NAME --strategy rolling")) - Eventually(session).Should(Say("cf restage APP_NAME --strategy rolling --no-wait")) + Eventually(session).Should(Say("cf restage APP_NAME --strategy canary --no-wait")) Eventually(session).Should(Say("ALIAS:")) Eventually(session).Should(Say("rg")) Eventually(session).Should(Say("OPTIONS:")) - Eventually(session).Should(Say("--strategy Deployment strategy, either rolling or null")) + Eventually(session).Should(Say("--strategy Deployment strategy can be canary, rolling or null")) Eventually(session).Should(Say("--no-wait Exit when the first instance of the web process is healthy")) Eventually(session).Should(Say("ENVIRONMENT:")) Eventually(session).Should(Say(`CF_STAGING_TIMEOUT=15\s+Max wait time for staging, in minutes`)) @@ -230,6 +230,19 @@ applications: }) }) + When("strategy canary is given", func() { + It("restages successfully", func() { + userName, _ := helpers.GetCredentials() + session := helpers.CF("restage", appName, "--strategy", "canary") + Consistently(session.Err).ShouldNot(Say(`This action will cause app downtime\.`)) + Eventually(session).Should(Say(`Restaging app %s in org %s / space %s as %s\.\.\.`, appName, orgName, spaceName, userName)) + Eventually(session).Should(Say(`Creating deployment for app %s\.\.\.`, appName)) + Eventually(session).Should(Say(`Waiting for app to deploy\.\.\.`)) + Eventually(session).Should(Say("Canary deployment currently PAUSED.")) + Eventually(session).Should(Exit(0)) + }) + }) + When("isolation segments are available", func() { BeforeEach(func() { Eventually(helpers.CF("create-isolation-segment", RealIsolationSegment)).Should(Exit(0)) diff --git a/integration/v7/isolated/restart_command_test.go b/integration/v7/isolated/restart_command_test.go index 87fd0d3d036..d98e00f0c52 100644 --- a/integration/v7/isolated/restart_command_test.go +++ b/integration/v7/isolated/restart_command_test.go @@ -45,13 +45,13 @@ var _ = Describe("restart command", func() { Eventually(session).Should(Say(`restart - Stop all instances of the app, then start them again\.`)) Eventually(session).Should(Say("USAGE:")) Eventually(session).Should(Say("cf restart APP_NAME")) - Eventually(session).Should(Say("This command will cause downtime unless you use '--strategy rolling'.")) + Eventually(session).Should(Say("This command will cause downtime unless you use '--strategy")) Eventually(session).Should(Say("If the app's most recent package is unstaged, restarting the app will stage and run that package.")) Eventually(session).Should(Say("Otherwise, the app's current droplet will be run.")) Eventually(session).Should(Say("ALIAS:")) Eventually(session).Should(Say("rs")) Eventually(session).Should(Say("OPTIONS:")) - Eventually(session).Should(Say("--strategy Deployment strategy, either rolling or null")) + Eventually(session).Should(Say("--strategy Deployment strategy can be canary, rolling or null.")) Eventually(session).Should(Say("--no-wait Exit when the first instance of the web process is healthy")) Eventually(session).Should(Say("ENVIRONMENT:")) Eventually(session).Should(Say(`CF_STAGING_TIMEOUT=15\s+Max wait time for staging, in minutes`)) @@ -116,6 +116,28 @@ var _ = Describe("restart command", func() { }) }) + When("strategy canary is given", func() { + BeforeEach(func() { + helpers.WithHelloWorldApp(func(appDir string) { + Eventually(helpers.CustomCF(helpers.CFEnv{WorkingDirectory: appDir}, "push", appName)).Should(Exit(0)) + }) + }) + It("creates a deploy", func() { + session := helpers.CF("restart", appName, "--strategy=canary") + Eventually(session).Should(Say(`Restarting app %s in org %s / space %s as %s\.\.\.`, appName, orgName, spaceName, userName)) + Eventually(session).Should(Say(`Creating deployment for app %s\.\.\.`, appName)) + Eventually(session).Should(Say(`Waiting for app to deploy\.\.\.`)) + Eventually(session).Should(Say(`name:\s+%s`, appName)) + Eventually(session).Should(Say(`requested state:\s+started`)) + Eventually(session).Should(Say(`routes:\s+%s.%s`, appName, helpers.DefaultSharedDomain())) + Eventually(session).Should(Say(`type:\s+web`)) + Eventually(session).Should(Say(`instances:\s+1/1`)) + Eventually(session).Should(Say(`memory usage:\s+\d+(M|G)`)) + Eventually(session).Should(Say(instanceStatsTitles)) + Eventually(session).Should(Say(instanceStatsValues)) + }) + }) + When("the app is running with no new packages", func() { BeforeEach(func() { helpers.WithHelloWorldApp(func(appDir string) { diff --git a/integration/v7/push/canary_push_test.go b/integration/v7/push/canary_push_test.go new file mode 100644 index 00000000000..4dd9a89adb7 --- /dev/null +++ b/integration/v7/push/canary_push_test.go @@ -0,0 +1,128 @@ +package push + +import ( + "fmt" + + "code.cloudfoundry.org/cli/integration/helpers" + . "github.com/onsi/ginkgo/v2" + . "github.com/onsi/gomega" + . "github.com/onsi/gomega/gbytes" + . "github.com/onsi/gomega/gexec" +) + +var _ = Describe("push with --strategy canary", func() { + var ( + appName string + userName string + ) + + BeforeEach(func() { + appName = helpers.PrefixedRandomName("app") + userName, _ = helpers.GetCredentials() + }) + + When("the app exists", func() { + BeforeEach(func() { + helpers.WithHelloWorldApp(func(appDir string) { + Eventually(helpers.CustomCF(helpers.CFEnv{WorkingDirectory: appDir}, + PushCommandName, appName, + )).Should(Exit(0)) + }) + }) + + It("pushes the app and creates a new deployment", func() { + helpers.WithHelloWorldApp(func(appDir string) { + session := helpers.CustomCF(helpers.CFEnv{WorkingDirectory: appDir}, + PushCommandName, appName, "--strategy", "canary", + ) + + Eventually(session).Should(Exit(0)) + Expect(session).To(Say(`Pushing app %s to org %s / space %s as %s\.\.\.`, appName, organization, space, userName)) + Expect(session).To(Say(`Packaging files to upload\.\.\.`)) + Expect(session).To(Say(`Uploading files\.\.\.`)) + Expect(session).To(Say(`100.00%`)) + Expect(session).To(Say(`Waiting for API to complete processing files\.\.\.`)) + Expect(session).To(Say(`Staging app and tracing logs\.\.\.`)) + Expect(session).To(Say(`Starting deployment for app %s\.\.\.`, appName)) + Expect(session).To(Say(`Waiting for app to deploy\.\.\.`)) + Expect(session).To(Say(`name:\s+%s`, appName)) + Expect(session).To(Say(`requested state:\s+started`)) + Expect(session).To(Say(`routes:\s+%s.%s`, appName, helpers.DefaultSharedDomain())) + Expect(session).To(Say(`type:\s+web`)) + Expect(session).To(Say(`start command:\s+%s`, helpers.StaticfileBuildpackStartCommand)) + Expect(session).To(Say(`#0\s+running`)) + Expect(session).To(Say(`Canary deployment currently PAUSED.`)) + }) + }) + }) + + When("canceling the deployment", func() { + BeforeEach(func() { + helpers.WithHelloWorldApp(func(appDir string) { + Eventually(helpers.CustomCF(helpers.CFEnv{WorkingDirectory: appDir}, + PushCommandName, appName, + )).Should(Exit(0)) + }) + }) + + It("displays the deployment cancellation message", func() { + helpers.WithHelloWorldApp(func(appDir string) { + session := helpers.CustomCF(helpers.CFEnv{WorkingDirectory: appDir}, + PushCommandName, appName, "--strategy", "canary", + ) + + Eventually(session).Should(Say(`Pushing app %s to org %s / space %s as %s\.\.\.`, appName, organization, space, userName)) + Eventually(session).Should(Say(`Packaging files to upload\.\.\.`)) + Eventually(session).Should(Say(`Uploading files\.\.\.`)) + Eventually(session).Should(Say(`100.00%`)) + Eventually(session).Should(Say(`Waiting for API to complete processing files\.\.\.`)) + Eventually(session).Should(Say(`Staging app and tracing logs\.\.\.`)) + Eventually(session).Should(Say(`Starting deployment for app %s\.\.\.`, appName)) + Eventually(session).Should(Say(`Waiting for app to deploy\.\.\.`)) + + Eventually(helpers.CF("cancel-deployment", appName)).Should(Exit(0)) + Eventually(session).Should(Say(`FAILED`)) + Eventually(session.Err).Should(Say(`Deployment has been canceled`)) + Eventually(session).Should(Exit(1)) + }) + }) + }) + + When("the app crashes", func() { + BeforeEach(func() { + helpers.WithHelloWorldApp(func(appDir string) { + Eventually(helpers.CustomCF(helpers.CFEnv{WorkingDirectory: appDir}, + PushCommandName, appName, + )).Should(Exit(0)) + }) + }) + + It("times out", func() { + helpers.WithCrashingApp(func(appDir string) { + session := helpers.CustomCF(helpers.CFEnv{ + WorkingDirectory: appDir, + EnvVars: map[string]string{"CF_STARTUP_TIMEOUT": "0.1"}, + }, PushCommandName, appName, "--strategy", "canary") + Eventually(session).Should(Exit(1)) + Expect(session).To(Say(`Pushing app %s to org %s / space %s as %s\.\.\.`, appName, organization, space, userName)) + Expect(session).To(Say(`Packaging files to upload\.\.\.`)) + Expect(session).To(Say(`Uploading files\.\.\.`)) + Expect(session).To(Say(`100.00%`)) + Expect(session).To(Say(`Waiting for API to complete processing files\.\.\.`)) + Expect(session).To(Say(`Staging app and tracing logs\.\.\.`)) + Expect(session).To(Say(`Starting deployment for app %s\.\.\.`, appName)) + Expect(session).To(Say(`Waiting for app to deploy\.\.\.`)) + Expect(session).To(Say(`FAILED`)) + Expect(session.Err).To(Say(`Start app timeout`)) + Expect(session.Err).To(Say(`TIP: Application must be listening on the right port\. Instead of hard coding the port, use the \$PORT environment variable\.`)) + Expect(session.Err).To(Say(`Use 'cf logs %s --recent' for more information`, appName)) + appGUID := helpers.AppGUID(appName) + Eventually(func() *Buffer { + session_deployment := helpers.CF("curl", fmt.Sprintf("/v3/deployments?app_guids=%s", appGUID)) + Eventually(session_deployment).Should(Exit(0)) + return session_deployment.Out + }).Should(Say(`"reason":\s*"CANCELED"`)) + }) + }) + }) +}) diff --git a/resources/deployment_resource.go b/resources/deployment_resource.go index d4528794dfb..aa342468d15 100644 --- a/resources/deployment_resource.go +++ b/resources/deployment_resource.go @@ -32,9 +32,10 @@ func (d Deployment) MarshalJSON() ([]byte, error) { } var ccDeployment struct { - Droplet *Droplet `json:"droplet,omitempty"` - Revision *Revision `json:"revision,omitempty"` - Relationships Relationships `json:"relationships,omitempty"` + Droplet *Droplet `json:"droplet,omitempty"` + Revision *Revision `json:"revision,omitempty"` + Strategy constant.DeploymentStrategy `json:"strategy,omitempty"` + Relationships Relationships `json:"relationships,omitempty"` } if d.DropletGUID != "" { @@ -45,6 +46,10 @@ func (d Deployment) MarshalJSON() ([]byte, error) { ccDeployment.Revision = &Revision{d.RevisionGUID} } + if d.Strategy != "" { + ccDeployment.Strategy = d.Strategy + } + ccDeployment.Relationships = d.Relationships return json.Marshal(ccDeployment)