Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix failing unit test timezone bug [v8] #3071

Merged
merged 1 commit into from
Aug 2, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
28 changes: 18 additions & 10 deletions command/v7/shared/app_summary_displayer_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -657,6 +657,9 @@ var _ = Describe("app summary displayer", func() {
})

When("there is an active deployment", func() {
var LastStatusChangeTimeString = "2024-07-29T17:32:29Z"
var dateTimeRegexPattern = `[a-zA-Z]{3}\s\d{2}\s[a-zA-Z]{3}\s\d{2}\:\d{2}\:\d{2}\s[A-Z]{3}\s\d{4}`

When("the deployment strategy is rolling", func() {
When("the deployment is in progress", func() {
When("last status change has a timestamp", func() {
Expand All @@ -666,13 +669,14 @@ var _ = Describe("app summary displayer", func() {
Strategy: constant.DeploymentStrategyRolling,
StatusValue: constant.DeploymentStatusValueActive,
StatusReason: constant.DeploymentStatusReasonDeploying,
LastStatusChange: "2024-07-29T17:32:29Z",
LastStatusChange: LastStatusChangeTimeString,
},
}
})

It("displays the message", func() {
Expect(testUI.Out).To(Say(`Rolling deployment currently DEPLOYING \(since Mon 29 Jul 13:32:29 EDT 2024\)`))
var actualOut = fmt.Sprintf("%s", testUI.Out)
Expect(actualOut).To(MatchRegexp(`Rolling deployment currently DEPLOYING \(since %s\)`, dateTimeRegexPattern))
})
})

Expand Down Expand Up @@ -702,13 +706,14 @@ var _ = Describe("app summary displayer", func() {
Strategy: constant.DeploymentStrategyRolling,
StatusValue: constant.DeploymentStatusValueActive,
StatusReason: constant.DeploymentStatusReasonCanceling,
LastStatusChange: "2024-07-29T17:32:29Z",
LastStatusChange: LastStatusChangeTimeString,
},
}
})

It("displays the message", func() {
Expect(testUI.Out).To(Say(`Rolling deployment currently CANCELING \(since Mon 29 Jul 13:32:29 EDT 2024\)`))
var actualOut = fmt.Sprintf("%s", testUI.Out)
Expect(actualOut).To(MatchRegexp(`Rolling deployment currently CANCELING \(since %s\)`, dateTimeRegexPattern))
})
})
})
Expand All @@ -720,13 +725,14 @@ var _ = Describe("app summary displayer", func() {
Strategy: constant.DeploymentStrategyCanary,
StatusValue: constant.DeploymentStatusValueActive,
StatusReason: constant.DeploymentStatusReasonDeploying,
LastStatusChange: "2024-07-29T17:32:29Z",
LastStatusChange: LastStatusChangeTimeString,
},
}
})

It("displays the message", func() {
Expect(testUI.Out).To(Say(`Canary deployment currently DEPLOYING \(since Mon 29 Jul 13:32:29 EDT 2024\)`))
var actualOut = fmt.Sprintf("%s", testUI.Out)
Expect(actualOut).To(MatchRegexp(`Canary deployment currently DEPLOYING \(since %s\)`, dateTimeRegexPattern))
Expect(testUI.Out).NotTo(Say(`promote the canary deployment`))
})
})
Expand All @@ -743,13 +749,14 @@ var _ = Describe("app summary displayer", func() {
Strategy: constant.DeploymentStrategyCanary,
StatusValue: constant.DeploymentStatusValueActive,
StatusReason: constant.DeploymentStatusReasonPaused,
LastStatusChange: "2024-07-29T17:32:29Z",
LastStatusChange: LastStatusChangeTimeString,
},
}
})

It("displays the message", func() {
Expect(testUI.Out).To(Say(`Canary deployment currently PAUSED \(since Mon 29 Jul 13:32:29 EDT 2024\)`))
var actualOut = fmt.Sprintf("%s", testUI.Out)
Expect(actualOut).To(MatchRegexp(`Canary deployment currently PAUSED \(since %s\)`, dateTimeRegexPattern))
Expect(testUI.Out).To(Say("Please run `cf continue-deployment foobar` to promote the canary deployment, or `cf cancel-deployment foobar` to rollback to the previous version."))
})
})
Expand All @@ -761,13 +768,14 @@ var _ = Describe("app summary displayer", func() {
Strategy: constant.DeploymentStrategyCanary,
StatusValue: constant.DeploymentStatusValueActive,
StatusReason: constant.DeploymentStatusReasonCanceling,
LastStatusChange: "2024-07-29T17:32:29Z",
LastStatusChange: LastStatusChangeTimeString,
},
}
})

It("displays the message", func() {
Expect(testUI.Out).To(Say(`Canary deployment currently CANCELING \(since Mon 29 Jul 13:32:29 EDT 2024\)`))
var actualOut = fmt.Sprintf("%s", testUI.Out)
Expect(actualOut).To(MatchRegexp(`Canary deployment currently CANCELING \(since %s\)`, dateTimeRegexPattern))
Expect(testUI.Out).NotTo(Say(`promote the canary deployment`))
})
})
Expand Down
Loading