Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Use more descriptive error messages in model proxy #1320

Merged
merged 2 commits into from
Aug 22, 2024

Conversation

kian99
Copy link
Contributor

@kian99 kian99 commented Aug 21, 2024

Description

This PR fixes an issue in tests that were checking the error from ProxySockets.

The model proxy returns an error once the proxy is completed but there are actually 2 errors emitted, 1 from the client side connection and 1 from the controller side connection, because only the first of the two errors is returned there is a sort of race in which message the calling function sees.

We fix this by using more descriptive error messages in the model proxy and then using an appropriate regex in tests.

Debugging the race condition was made easy by running the tests with a high count, so running the following:
go test -timeout 30s -run ^TestProxySocketsAuditLogs$ github.com/canonical/jimm/v3/internal/rpc -count=1000
surfaced the issue consistently

Engineering checklist

Check only items that apply

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

@kian99 kian99 requested a review from a team as a code owner August 21, 2024 11:24
Copy link
Contributor

@ale8k ale8k left a comment

Choose a reason for hiding this comment

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

abnormal closures aren't normal, this just masks an actual issue

@kian99
Copy link
Contributor Author

kian99 commented Aug 21, 2024

abnormal closures aren't normal, this just masks an actual issue

@ale8k I think that's a separate matter we can look into and address. For this PR giving the different errors that come out of the model proxy their own unique messages highlights the problem and the tests have been accordingly. Let's fix any issues with abnormal closure messages separately.

@kian99 kian99 requested a review from ale8k August 21, 2024 13:49
Copy link
Contributor

@ale8k ale8k left a comment

Choose a reason for hiding this comment

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

Approving but plz plz can we fix abnormal closures asap? If there are any issues?

@kian99 kian99 merged commit 8480f90 into canonical:v3 Aug 22, 2024
4 checks passed
kian99 added a commit to kian99/jimm that referenced this pull request Sep 3, 2024
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