-
Notifications
You must be signed in to change notification settings - Fork 102
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
Consistently getting a unit's public address #573
Conversation
channel='stable', | ||
) | ||
|
||
for unit in app.units: |
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.
Can we assert we got at least one unit, otherwise we skip the assertions
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.
Not sure what you mean, are you saying that getting the public_address of one the units is enough?
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.
You need to ensure that units is >= 1, otherwise the test will pass and you won't know it's failed as the for loop looks for units. What happens if units is zero for example?
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.
Yeah I'm dumb, you're right I should probably use num_units=2
or something with the deploy
and then wait until the units are up, that way it's ensured we'll have some units.
An assertion about units afterwards certainly wouldn't hurt, though might be redundant, because if we have no units after using num_units
, then we have much bigger problems, so some other test (prob. about deploy) should already be failing. I'll make the changes 👍
!!build!! |
29b5482
to
53f2914
Compare
e74f56e
to
c1d2fae
Compare
|
We should potentially revert this. The fix is not in pylibjuju but in juju AllWatcher implementation. |
#599 2.9.5 ^^^^^ Friday December 3 2021 * remove the event loop arguments by @cderici in #560 * add debug-log by @cderici in #562 * Model status by @juanmanuel-tirado in #563 * Pin cffi version to 1.14.6 for Python 3.5 by @cderici in #570 * Wait for applications to terminate on model reset by @balbirthomas in #572 * Babysitting python3.5 by @cderici in #571 * Deploy charmhub bundles by @cderici in #569 * Facade schemas for 2.9.17 by @SimonRichardson in #579 * Bundles with overlays by @cderici in #566 * Consistently getting a unit's public address by @cderici in #573 * [JUJU-158] Add python3.9 to setup.py by @cderici in #585 * [JUJU-157] Add note for removing services by @cderici in #583 * Added boolean entries to normalize values. by @juanmanuel-tirado in #582 * [JUJU-138] Streamlining asyncio tasks/events by @cderici in #580 * [JUJU-234] Fix for small bug in task handling by @cderici in #589 * Ensure all watchers validate for the Id by @SimonRichardson in #592 * [JUJU-276] Facade schemas for 2.9.19 by @cderici in #594 * [JUJU-238] Small bug fix for old ClientFacade support by @cderici in #593 * [JUJU-239] Debug-log parameters by @cderici in #595 * [JUJU-213] Local type `file` resource support by @cderici in #590 * [JUJU-289] Use provided series in deploy if supported by @jack-w-shaw in #596 * [JUJU-292] Update the charms in the tests to use Charmhub by @cderici in #597 * Legacy "services" for describing "applications" within bundles are no longer supported. "applications" can be used as a direct replacement for "services" in bundles.yaml. * The websocket (ws) in a Connection object became a read-only property. [JUJU-293] [JUJU-158]: https://warthogs.atlassian.net/browse/JUJU-158?atlOrigin=eyJpIjoiNWRkNTljNzYxNjVmNDY3MDlhMDU5Y2ZhYzA5YTRkZjUiLCJwIjoiZ2l0aHViLWNvbS1KU1cifQ
Description
Assigning a unit's public address may take a little time, which makes the result of
unit.public_address
depend on when it's called, thereby creating inconsistency. This PR adds a method, namelyget_public_address
, that waits (with a timeout) until the unit is assigned an address and returns the address when it's assigned.Fixes #551
Jira card #141
QA Steps
Notes & Discussion
A minor design decision: is that in the case of a timeout,
get_public_address
returns aNone
, rather than aTimeoutError
.