Skip to content

Commit

Permalink
fix(application): caas model application status to respect equivalent…
Browse files Browse the repository at this point in the history
… severity

When selecting between operator and application statuses with the same severity level (e.g. both
waiting) on a caas model Juju selects the operator status instead of the application status, which
is likely more relevant, as reported by https://bugs.launchpad.net/juju/+bug/2038833/comments/2

Builds on the changes in PR juju#17572
  • Loading branch information
carlcsaposs-canonical committed Sep 18, 2024
1 parent 5f11a3e commit 93b6436
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 3 deletions.
7 changes: 4 additions & 3 deletions core/status/caas.go
Original file line number Diff line number Diff line change
Expand Up @@ -76,9 +76,10 @@ func ApplicationDisplayStatus(applicationStatus, operatorStatus StatusInfo, expe
return operatorStatus
}

// Check if the application status has been set to a higher severity status
// than the operator status (e.g. set to maintenance by the charm)
if statusSeverities[appStatus] > statusSeverities[opStatus] {
// Check if the application status has been set to an equivalent or higher
// severity status than the operator status (e.g. set to waiting by the
// charm)
if statusSeverities[appStatus] >= statusSeverities[opStatus] {
return applicationStatus
}

Expand Down
12 changes: 12 additions & 0 deletions core/status/caas_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -280,6 +280,18 @@ func (s *UnitCloudStatusSuite) TestApplicatoinOpeartorStatusChoice(c *gc.C) {
Status: status.Waiting,
Message: "unit",
},
expectWorkload: true,
messageCheck: "unit",
},
{
operatorStatus: status.StatusInfo{
Status: status.Waiting,
Message: "operator",
},
appStatus: status.StatusInfo{
Status: status.Active,
Message: "unit",
},
expectWorkload: false,
messageCheck: "installing agent",
},
Expand Down

0 comments on commit 93b6436

Please sign in to comment.