Skip to content

[MISC] Fix refresh and add refresh test#26

Open
dragomirp wants to merge 10 commits into
16/edgefrom
tests
Open

[MISC] Fix refresh and add refresh test#26
dragomirp wants to merge 10 commits into
16/edgefrom
tests

Conversation

@dragomirp
Copy link
Copy Markdown
Contributor

@dragomirp dragomirp commented May 29, 2026

  • Fix happy refresh scenario
  • Add refresh test
  • Tweak the stereo mode test
  • Switch to noble runners
  • Update snap revisions

@dragomirp dragomirp force-pushed the tests branch 2 times, most recently from 0b7516f to ec56d8a Compare May 30, 2026 00:05
Comment thread tests/integration/conftest.py Fixed
Comment thread tests/integration/high_availability/high_availability_helpers_new.py Dismissed
@dragomirp dragomirp changed the title [MISC] Tests [MISC] Fix refresh and add refresh test May 30, 2026
def _on_leader_elected(self, _) -> None:
self._update_unit_address_if_changed()

def stop_services(self) -> None:
Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

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:
Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Have to start all the services after the refresh.

Comment thread src/charm.py
Comment on lines +90 to +91
# Compatibility with storage refactoring
_change_owner(Substrates.VM, SNAP_COMMON_PATH)
Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Snap refresh hooks will try to move/create dirs, since the snap is shared with the PG charm.

Comment thread src/charm.py
return
self.unit.status = status

def set_app_status(self) -> None:
Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Comment on lines +196 to +202
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},
Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Deploy the second cluster in advance so we don't have to wait.

Comment on lines -213 to -219
# 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,
)

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

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"):
Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

logger.info(f"Shutting down replica: {replica}")

# Shutdown the replica
await stop_machine(ops_test, await get_machine_from_unit(ops_test, replica))
Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

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(
Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Ported for jubilant, to reuse the refresh tests from PG.

Comment thread spread.yaml
Comment on lines -92 to -98
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)'
Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Not needed by the watcher.

@dragomirp dragomirp marked this pull request as ready for review May 30, 2026 23:14
@dragomirp dragomirp requested a review from a team as a code owner May 30, 2026 23:14
@dragomirp dragomirp requested review from carlcsaposs-canonical, juju-charm-bot, marceloneppel and taurus-forever and removed request for a team May 30, 2026 23:14
@dragomirp dragomirp added the bug Something isn't working label May 30, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

bug Something isn't working Libraries: OK

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant