Conversation
0b7516f to
ec56d8a
Compare
| def _on_leader_elected(self, _) -> None: | ||
| self._update_unit_address_if_changed() | ||
|
|
||
| def stop_services(self) -> None: |
There was a problem hiding this comment.
Have to stop all running services before the refresh.
| raft_controller = RaftController(self.charm, f"rel{relation.id}") | ||
| raft_controller.remove_service() | ||
|
|
||
| def start_services(self) -> None: |
There was a problem hiding this comment.
Have to start all the services after the refresh.
| # Compatibility with storage refactoring | ||
| _change_owner(Substrates.VM, SNAP_COMMON_PATH) |
There was a problem hiding this comment.
Snap refresh hooks will try to move/create dirs, since the snap is shared with the PG charm.
| return | ||
| self.unit.status = status | ||
|
|
||
| def set_app_status(self) -> None: |
There was a problem hiding this comment.
Cleans up the upgrade status.
| await ops_test.model.deploy( | ||
| DATABASE_APP_NAME, | ||
| application_name=SECOND_PG_APP_NAME, | ||
| num_units=2, | ||
| series="noble", | ||
| channel="16/edge", | ||
| config={"profile": "testing", "synchronous-mode-strict": False}, |
There was a problem hiding this comment.
Deploy the second cluster in advance so we don't have to wait.
| # Wait for watcher to join Raft cluster | ||
| await ops_test.model.wait_for_idle( | ||
| apps=[DATABASE_APP_NAME, WATCHER_APP_NAME], | ||
| status="active", | ||
| timeout=600, | ||
| ) | ||
|
|
There was a problem hiding this comment.
Relate directly after deploy instead of waiting for deploy idleness and relate idleness.
| idle_period=30, | ||
| raise_on_error=False, # Old primary may be in error while rejoining | ||
| ) | ||
| async with ops_test.fast_forward(fast_interval="60s"): |
There was a problem hiding this comment.
Copying behaviour of https://github.com/canonical/postgresql-operator/blob/9af7093661e2e5fcf012456f6943cbcc53178e69/tests/integration/ha_tests/test_self_healing_3.py#L226
Faster update status to update all the IPs.
| logger.info(f"Shutting down replica: {replica}") | ||
|
|
||
| # Shutdown the replica | ||
| await stop_machine(ops_test, await get_machine_from_unit(ops_test, replica)) |
There was a problem hiding this comment.
Force destroying the unit doesn't seem to immediately stop the machine.
| return revealed_secret.content.get(f"{user}-password") | ||
|
|
||
|
|
||
| def verify_raft_cluster_health( |
There was a problem hiding this comment.
Ported for jubilant, to reuse the refresh tests from PG.
| AWS_ACCESS_KEY: '$(HOST: echo $AWS_ACCESS_KEY)' | ||
| AWS_SECRET_KEY: '$(HOST: echo $AWS_SECRET_KEY)' | ||
| GCP_ACCESS_KEY: '$(HOST: echo $GCP_ACCESS_KEY)' | ||
| GCP_SECRET_KEY: '$(HOST: echo $GCP_SECRET_KEY)' | ||
| UBUNTU_PRO_TOKEN: '$(HOST: echo $UBUNTU_PRO_TOKEN)' | ||
| LANDSCAPE_ACCOUNT_NAME: '$(HOST: echo $LANDSCAPE_ACCOUNT_NAME)' | ||
| LANDSCAPE_REGISTRATION_KEY: '$(HOST: echo $LANDSCAPE_REGISTRATION_KEY)' |
There was a problem hiding this comment.
Not needed by the watcher.
Uh oh!
There was an error while loading. Please reload this page.