forked from juju/juju
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Upgrades: Ensure we have an empty manifest from state
In order to have better determination of when a charm meta data format is either v1 or v2, it helps if we don't have charms that have empty manifests. Empty manifests with empty bases means the logic for determine if it's a format v2 now has to check for the presence of values rather than checking for nil. Lots of code to just say `version: 2` in a metadata.
- Loading branch information
1 parent
c53038c
commit fe61f9e
Showing
7 changed files
with
167 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
// Copyright 2021 Canonical Ltd. | ||
// Licensed under the AGPLv3, see LICENCE file for details. | ||
|
||
package upgrades | ||
|
||
// stateStepsFor2910 returns upgrade steps for juju 2.9.10 | ||
func stateStepsFor2910() []Step { | ||
return []Step{ | ||
&upgradeStep{ | ||
description: `transform empty manifests to nil`, | ||
targets: []Target{DatabaseMaster}, | ||
run: func(context Context) error { | ||
return context.State().TransformEmptyManifestsToNil() | ||
}, | ||
}, | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,26 @@ | ||
// Copyright 2021 Canonical Ltd. | ||
// Licensed under the AGPLv3, see LICENCE file for details. | ||
|
||
package upgrades_test | ||
|
||
import ( | ||
jc "github.com/juju/testing/checkers" | ||
"github.com/juju/version/v2" | ||
gc "gopkg.in/check.v1" | ||
|
||
"github.com/juju/juju/testing" | ||
"github.com/juju/juju/upgrades" | ||
) | ||
|
||
var v2910 = version.MustParse("2.9.10") | ||
|
||
type steps2910Suite struct { | ||
testing.BaseSuite | ||
} | ||
|
||
var _ = gc.Suite(&steps2910Suite{}) | ||
|
||
func (s *steps2910Suite) TestTransformEmptyManifestsToNil(c *gc.C) { | ||
step := findStateStep(c, v2910, `transform empty manifests to nil`) | ||
c.Assert(step.Targets(), jc.DeepEquals, []upgrades.Target{upgrades.DatabaseMaster}) | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters