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

COM-7477 | feat: show state description for HCP upgrade policies #1945

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
4 changes: 3 additions & 1 deletion cmd/describe/upgrade/cmd.go
Expand Up @@ -133,12 +133,14 @@ func formatHypershiftUpgrade(upgrade ocm.HypershiftUpgrader) string {
%-35s%s
%-35s%s
%-35s%s
%-35s%s
`,
"ID:", upgrade.ID(),
"Cluster ID:", upgrade.ClusterID(),
"Schedule Type:", upgrade.ScheduleType(),
"Next Run:", upgrade.NextRun().Format("2006-01-02 15:04 MST"),
"Upgrade State:", upgrade.State().Value()))
"Upgrade State:", upgrade.State().Value(),
"State Message:", upgrade.State().Description()))
if upgrade.Schedule() != "" {
builder = append(builder, fmt.Sprintf(`
%-35s%s
Expand Down
6 changes: 4 additions & 2 deletions cmd/describe/upgrade/cmd_test.go
Expand Up @@ -18,7 +18,7 @@ var _ = Describe("Describe upgrade", func() {
Context("Format Hypershift upgrade", func() {
It("Node pool upgrade is scheduled", func() {
nowUTC := time.Now().UTC()
upgradeState := cmv1.NewUpgradePolicyState().Value("scheduled")
upgradeState := cmv1.NewUpgradePolicyState().Value("scheduled").Description("Upgrade scheduled.")
npUpgradePolicy, err := cmv1.NewNodePoolUpgradePolicy().ID("id1").Version("4.12.19").
State(upgradeState).NextRun(nowUTC).Build()
Expect(err).To(BeNil())
Expand All @@ -31,14 +31,15 @@ Cluster ID:
Schedule Type:
Next Run: %s
Upgrade State: scheduled
State Message: Upgrade scheduled.

Version: 4.12.19
`, nowUTC.Format("2006-01-02 15:04 MST"))))
})
It("Node pool upgrade is scheduled with a date", func() {
format.TruncatedDiff = false
nowUTC := time.Now().UTC()
upgradeState := cmv1.NewUpgradePolicyState().Value("scheduled")
upgradeState := cmv1.NewUpgradePolicyState().Value("scheduled").Description("Upgrade scheduled.")
npUpgradePolicy, err := cmv1.NewNodePoolUpgradePolicy().ID("id1").Version("4.12.19").
State(upgradeState).NextRun(nowUTC).Schedule(nowUTC.Format("2006-01-02 15:04 MST")).
EnableMinorVersionUpgrades(true).Build()
Expand All @@ -52,6 +53,7 @@ Cluster ID:
Schedule Type:
Next Run: %s
Upgrade State: scheduled
State Message: Upgrade scheduled.

Schedule At: %s

Expand Down