Skip to content

Commit

Permalink
Add an 3.4.3 upgrade step.
Browse files Browse the repository at this point in the history
Using the AssignArchToContainers method to fix the instance data of
containers. The method was merged forward from 3.3.5. However we need a
different upgrade step in 3.4
  • Loading branch information
hmlanigan committed May 16, 2024
1 parent b5a70db commit bca46e0
Show file tree
Hide file tree
Showing 4 changed files with 44 additions and 0 deletions.
1 change: 1 addition & 0 deletions upgrades/operations.go
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@ import (
var stateUpgradeOperations = func() []Operation {
steps := []Operation{
upgradeToVersion{version.MustParse("3.4.1"), stateStepsFor341()},
upgradeToVersion{version.MustParse("3.4.3"), stateStepsFor343()},
}
return steps
}
Expand Down
16 changes: 16 additions & 0 deletions upgrades/steps_343.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
// Copyright 2024 Canonical Ltd.
// Licensed under the AGPLv3, see LICENCE file for details.

package upgrades

func stateStepsFor343() []Step {
return []Step{
&upgradeStep{
description: "assign architectures to container's instance data",
targets: []Target{DatabaseMaster},
run: func(context Context) error {
return context.State().AssignArchToContainers()
},
},
}
}
26 changes: 26 additions & 0 deletions upgrades/steps_343_test.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
// Copyright 2024 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 v343 = version.MustParse("3.4.3")

type steps342Suite struct {
testing.BaseSuite
}

var _ = gc.Suite(&steps342Suite{})

func (s *steps342Suite) TestAssignArchToContainers(c *gc.C) {
step := findStateStep(c, v343, "assign architectures to container's instance data")
c.Assert(step.Targets(), jc.DeepEquals, []upgrades.Target{upgrades.DatabaseMaster})
}
1 change: 1 addition & 0 deletions upgrades/upgrade_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -598,6 +598,7 @@ func (s *upgradeSuite) TestStateUpgradeOperationsVersions(c *gc.C) {
versions := extractUpgradeVersions(c, (*upgrades.StateUpgradeOperations)())
c.Assert(versions, gc.DeepEquals, []string{
"3.4.1",
"3.4.3",
})
}

Expand Down

0 comments on commit bca46e0

Please sign in to comment.