From bca46e01e3416f7f4e32096af2533db81a706ef2 Mon Sep 17 00:00:00 2001 From: Heather Lanigan Date: Wed, 15 May 2024 14:49:51 +0200 Subject: [PATCH] Add an 3.4.3 upgrade step. 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 --- upgrades/operations.go | 1 + upgrades/steps_343.go | 16 ++++++++++++++++ upgrades/steps_343_test.go | 26 ++++++++++++++++++++++++++ upgrades/upgrade_test.go | 1 + 4 files changed, 44 insertions(+) create mode 100644 upgrades/steps_343.go create mode 100644 upgrades/steps_343_test.go diff --git a/upgrades/operations.go b/upgrades/operations.go index 3d758d08abd..20f7d642fc5 100644 --- a/upgrades/operations.go +++ b/upgrades/operations.go @@ -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 } diff --git a/upgrades/steps_343.go b/upgrades/steps_343.go new file mode 100644 index 00000000000..0442aaa5939 --- /dev/null +++ b/upgrades/steps_343.go @@ -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() + }, + }, + } +} diff --git a/upgrades/steps_343_test.go b/upgrades/steps_343_test.go new file mode 100644 index 00000000000..f8c860bf486 --- /dev/null +++ b/upgrades/steps_343_test.go @@ -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}) +} diff --git a/upgrades/upgrade_test.go b/upgrades/upgrade_test.go index 52b25eaf94a..5e0059da9a7 100644 --- a/upgrades/upgrade_test.go +++ b/upgrades/upgrade_test.go @@ -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", }) }