Skip to content

Commit

Permalink
Merge pull request #1945 from philipwu08/upgrade-state-description
Browse files Browse the repository at this point in the history
COM-7477 | feat: show state description for HCP upgrade policies
  • Loading branch information
davidleerh authored Jun 25, 2024
2 parents 6aca08a + 4cf8f81 commit 9cd807c
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 3 deletions.
4 changes: 3 additions & 1 deletion cmd/describe/upgrade/cmd.go
Original file line number Diff line number Diff line change
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
Original file line number Diff line number Diff line change
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

0 comments on commit 9cd807c

Please sign in to comment.