From de13c02d905a9f61306f9890514da8baf9cf113a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Cristhian=20Pe=C3=B1a?= <42382354+ccjaimes@users.noreply.github.com> Date: Mon, 20 Nov 2023 09:57:44 -0500 Subject: [PATCH] Change status query into a information message when finishing a rolling restage - main (#2666) * Change status print to a info message when finishing a rolling deployment with --no-wait * Added test block for new message when restage with rolling strategy and --no-wait Co-authored-by: George Gelashvili --------- Co-authored-by: George Gelashvili --- command/v7/shared/app_stager.go | 4 ++++ command/v7/shared/app_stager_test.go | 28 ++++++++++++++++++++++++++++ 2 files changed, 32 insertions(+) diff --git a/command/v7/shared/app_stager.go b/command/v7/shared/app_stager.go index a94f168a9ae..5399d6f5575 100644 --- a/command/v7/shared/app_stager.go +++ b/command/v7/shared/app_stager.go @@ -172,6 +172,10 @@ func (stager *Stager) StartApp( if err != nil { return err } + if noWait == true { + stager.UI.DisplayText("First instance restaged correctly, restaging remaining in the background") + return nil + } } else { user, err := stager.Actor.GetCurrentUser() if err != nil { diff --git a/command/v7/shared/app_stager_test.go b/command/v7/shared/app_stager_test.go index 0650715bbea..58e371b16ef 100644 --- a/command/v7/shared/app_stager_test.go +++ b/command/v7/shared/app_stager_test.go @@ -125,6 +125,7 @@ var _ = Describe("app stager", func() { Expect(err).NotTo(HaveOccurred()) Expect(testUI.Out).To(Say(`Restarting app %s in org %s / space %s as %s\.\.\.`, app.Name, organization.Name, space.Name, user.Name)) Expect(testUI.Out).To(Say("Waiting for app to start...")) + }) When("staging fails", func() { @@ -170,6 +171,32 @@ var _ = Describe("app stager", func() { Expect(executeErr).To(MatchError("start-app-error")) }) }) + + When("The deployment strategy is rolling with nowait", func() { + BeforeEach(func() { + strategy = constant.DeploymentStrategyRolling + noWait = true + appStager = shared.NewAppStager(fakeActor, testUI, fakeConfig, fakeLogCacheClient) + executeErr = appStager.StageAndStart( + app, + space, + organization, + pkgGUID, + strategy, + noWait, + appAction, + ) + }) + + It("Restages and starts the app", func() { + Expect(executeErr).NotTo(HaveOccurred()) + + Expect(testUI.Out).To(Say("Creating deployment for app %s...", app.Name)) + Expect(testUI.Out).To(Say("Waiting for app to deploy...")) + + Expect(testUI.Out).To(Say("First instance restaged correctly, restaging remaining in the background")) + }) + }) }) Context("StageApp", func() { @@ -609,4 +636,5 @@ var _ = Describe("app stager", func() { Expect(executeErr).To(Not(HaveOccurred())) }) }) + })