-
Notifications
You must be signed in to change notification settings - Fork 37
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
Update retry to improve machine placement on read and introduce internal/juju unit tests with mocking #433
Conversation
It's a known issue what not all machines may be noted in placement when an application is created, juju#376. This change will fix the test failures surfaced with an update to the framework v 1.5 and this bug. However the bug still exists due to ordering of the Placement vales in the string. A hole exists for subordinate applications as noted in the code.
The data is include in ApplicationInfo results.
Setup to all for local units tests using mocks, but adding interfaces and wrapping the juju api clients.
cce2550
to
18dc1bd
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Good amount of testing!
return nil | ||
} | ||
if output.Placement == "" { | ||
return fmt.Errorf("ReadApplicationWithRetryOnNotFound: no machines found in output") |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This error message could be a bit confusing to a user, does "output" mean something to them?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is an amazing start for the unit tests! Code looks good, QA went well 👍
The first unit tests using gomock and stretchr. Testing the Retry logic of ReadApplicationWithRetryOnNotFound. Return ApplicationMinimal Import test
c546a3a
to
0e9402f
Compare
Fixed a test and squashed in the lint change with the major commit - required a force. |
Description
Resolves TODO from #359 where minimal application import test was failing by improving retry on ReadApplication to wait for machines to exists when required. Does not apply to CAAS models, not subordinate applications.
Adds unit tests for internal/juju utilizing the stretchr test package. Currently there is coverage for ReadApplicationWithRetryOnNotFound. More can be added as we go. A new make target has been added to run them.
This involved refactoring parts of internal/juju to allow for mocks to be used by introducing new local interfaces and wrappers on the api clients to talk to juju.
Stretchr has some notable differences with the way tests are written in github.com/juju/juju. Notably: suite.Required() is equivalent to Assert() and suite.Assert() is equivalent to Check().
Type of change
QA steps
Additional notes
JUJU-5427