Skip to content

fix: address panic in response handling and better handling for ModelStatus api method#1895

Merged
kian99 merged 2 commits intocanonical:v3from
kian99:fix-secret-backend-info-panic
Mar 6, 2026
Merged

fix: address panic in response handling and better handling for ModelStatus api method#1895
kian99 merged 2 commits intocanonical:v3from
kian99:fix-secret-backend-info-panic

Conversation

@kian99
Copy link
Contributor

@kian99 kian99 commented Mar 6, 2026

Description

This PR fixes two issues that are causing test failures between the Terraform provider and the latest version of JIMM.

  1. JIMM would panic in the toFullModelInfo because we were not checking if the Error field was nil before using it.
  2. The client method ModelStatus returns the status of a single model but the underlying API request is a bulk one, so any errors are not surfaced in the err value and instead captured as a field on the list of responses.

To test the fix for the latter I've added an integration style test in the testing package. Ideally we would have the dial_test.go file inside of the jujuclient package and allow integration style tests from any package but our CI is currently setup to only run integration tests from the testing package. So this will need some further thought and work.

Engineering checklist

  • Documentation updated
  • Covered by unit tests
  • Covered by integration tests

Error: &jujuparams.Error{
}
if sb.Error != nil {
res.Error = &jujuparams.Error{
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We always get caught by this (Incoming AI prompt: "create me a linter that verifies all nested errors in Juju responses are properly handled") 😆

@kian99 kian99 merged commit 8476c60 into canonical:v3 Mar 6, 2026
7 of 9 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants