-
Notifications
You must be signed in to change notification settings - Fork 3
[MISC] Fix wrong waiting logic in self-healing test, fix misuses of wait_for_unit_status
#264
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
base: 8.4/edge
Are you sure you want to change the base?
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -14,6 +14,7 @@ | |
| load_mysql_test_data, | ||
| update_interval, | ||
| wait_for_apps_status, | ||
| wait_for_unit_status, | ||
| ) | ||
|
|
||
| MYSQL_APP_NAME = "mysql-k8s" | ||
|
|
@@ -30,6 +31,7 @@ def test_deploy_single_unit_cluster(juju: Juju, charm: str) -> None: | |
| config={"profile": "testing"}, | ||
| resources={"mysql-image": CHARM_METADATA["resources"]["mysql-image"]["upstream-source"]}, | ||
| num_units=1, | ||
| trust=True, | ||
| ) | ||
|
|
||
| logging.info("Wait for applications to become active") | ||
|
|
@@ -51,12 +53,21 @@ def test_crash_during_cluster_setup(juju: Juju, charm: str) -> None: | |
| """ | ||
| mysql_primary = get_mysql_primary_unit(juju, MYSQL_APP_NAME) | ||
|
|
||
| # NOTE: This is prone to race conditions: | ||
| # if the units clear the "waiting" phase too quickly, | ||
| # this status function will never activate | ||
| logging.info("Scaling to 3 units") | ||
| juju.add_unit(MYSQL_APP_NAME, num_units=2) | ||
| juju.wait( | ||
| ready=wait_for_apps_status(jubilant.any_waiting, MYSQL_APP_NAME), | ||
| ready=lambda status: any(( | ||
| *( | ||
| wait_for_unit_status(MYSQL_APP_NAME, unit_name, "waiting")(status) | ||
| for unit_name in status.get_units(MYSQL_APP_NAME) | ||
| ), | ||
| )), | ||
|
Comment on lines
+62
to
+67
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I am not sure having any unit in the Therefore, I think there are 3 possible ways to achieve this:
Given how brief (+ juju-controller dependent) the |
||
| error=jubilant.any_blocked, | ||
| timeout=20 * MINUTE_SECS, | ||
| successes=1, | ||
| ) | ||
|
|
||
| logging.info("Deleting pod") | ||
|
|
||
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.
No need to leave a comment if we are going to fix the problem here and now.