-
Notifications
You must be signed in to change notification settings - Fork 497
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #17652 from Aflynn50/use-sqlair-in-upgrade-domain
#17652 This commit changes the upgrade domain to use SQLair, but some other issues were also found with it while changing. For one, database errors were escaping from state and being caught at the service layer. It makes a lot more sense to catch these errors next to the queries that caused them, especially when the function has multiple queries in it. I have moved all of the catching of these errors onto the actual state. There were also some comments that didn't match the error that was given out. I have reworked the errors to match what I believe to be the intended behaviour and fixed the callers of the function. The generic `NotFound` error was also used here. I have changed that to a specific `upgradeerorros.NotFound`. There were also some tests for `SetControllerDone` that appeared incomplete. I have fixed these and made behaviour expectations consistent across the comments. <!-- Why this change is needed and what it does. --> ## Checklist <!-- If an item is not applicable, use `~strikethrough~`. --> - [x] Code style: imports ordered, good names, simple structure, etc - [x] Comments saying why design decisions were made - [x] Go unit tests, with comments saying what you're testing - [x] [Integration tests](https://github.com/juju/juju/tree/main/tests), with comments saying what you're testing - [ ] [doc.go](https://discourse.charmhub.io/t/readme-in-packages/451) added or updated in changed packages ## QA steps ### Unit tests ``` go test -v -tags=libsqlite3,dqlite ./domain/upgrade/... -check.v -check.f Suite go test -v -tags=libsqlite3,dqlite ./internal/worker/upgradedatabase/... -check.v -check.f Suite go test -v -tags=libsqlite3,dqlite ./internal/worker/upgradesteps/... -check.v -check.f Suite ``` ### Integration tests First apply this diff to allow the upgrade: ```diff diff --git a/environs/sync/sync.go b/environs/sync/sync.go index fa63d84426..f536f5e434 100644 --- a/environs/sync/sync.go +++ b/environs/sync/sync.go @@ -316,12 +316,12 @@ func buildAgentTarball( builtVersion.Build = 0 clientVersion := jujuversion.Current clientVersion.Build = 0 - if builtVersion.Number.Compare(clientVersion) != 0 { - return nil, errors.Errorf( - "agent binary %v not compatible with bootstrap client %v", - toolsVersion.Number, jujuversion.Current, - ) - } + // if builtVersion.Number.Compare(clientVersion) != 0 { + // return nil, errors.Errorf( + // "agent binary %v not compatible with bootstrap client %v", + // toolsVersion.Number, jujuversion.Current, + // ) + // } fileInfo, err := f.Stat() if err != nil { return nil, errors.Errorf("cannot stat newly made agent binary archive: %v", err) ``` Then update the patch version in `version/version.go` ```diff diff --git a/version/version.go b/version/version.go index 33b01db1af..3f599876ed 100644 --- a/version/version.go +++ b/version/version.go @@ -18,7 +18,7 @@ import ( // The presence and format of this constant is very important. // The debian/rules build recipe uses this value for the version // number of the release package. -const version = "4.0-beta4" +const version = "4.0-beta5" // UserAgentVersion defines a user agent version used for communication for // outside resources. ``` ```sh $ juju bootstrap lxd test --build-agent $ juju add-model default $ juju upgrade-controller --build-agent ``` <!-- Describe steps to verify that the change works. --> ## Documentation changes <!-- How it affects user workflow (CLI or API). --> ## Links <!-- Link to all relevant specification, documentation, bug, issue or JIRA card. --> **Jira card:** [JUJU-6274](https://warthogs.atlassian.net/browse/JUJU-6274) [JUJU-6274]: https://warthogs.atlassian.net/browse/JUJU-6274?atlOrigin=eyJpIjoiNWRkNTljNzYxNjVmNDY3MDlhMDU5Y2ZhYzA5YTRkZjUiLCJwIjoiZ2l0aHViLWNvbS1KU1cifQ
- Loading branch information
Showing
9 changed files
with
353 additions
and
335 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
Oops, something went wrong.