-
Notifications
You must be signed in to change notification settings - Fork 27
[DPE-8747] Add integration test for persistent temp tablespace handling #1347
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
[DPE-8747] Add integration test for persistent temp tablespace handling #1347
Conversation
Add integration test to validate the fix from postgresql-single-kernel-library PR #54, which correctly handles persistent storage for PostgreSQL temp tablespaces to prevent "ObjectInUse" errors after container restarts. The test performs a leader election followed by a restart to trigger the library's set_up_database() method, which detects persistent temp storage and logs the appropriate message confirming the fix is working. Test helper functions (get_lxd_machine_name, verify_leader_active, verify_temp_table_creation, force_leader_election, check_for_fix_log_message) are added to jubilant_helpers.py for reusability. - Add test_persistent_temp_storage_restart.py with 2 tests: - test_deploy_with_persistent_temp_storage: Deploy 3-unit cluster - test_leader_change_and_restart: Force leader election and restart - Add corresponding spread test configuration - Update pyproject.toml to use library commit 7014727 from PR #54 Signed-off-by: Marcelo Henrique Neppel <marcelo.neppel@canonical.com>
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## 16/edge #1347 +/- ##
========================================
Coverage 70.60% 70.60%
========================================
Files 16 16
Lines 4276 4276
Branches 689 689
========================================
Hits 3019 3019
Misses 1047 1047
Partials 210 210 ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
taurus-forever
left a comment
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.
Thank you!
onkolahmet
left a comment
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.
LGTM! Just added some small comments
…tablespace-management Signed-off-by: Marcelo Henrique Neppel <marcelo.neppel@canonical.com>
Add 5-second delay after stopping juju agent service to allow shutdown to propagate before polling for new leader. This prevents early polling iterations from seeing stale status and improves test reliability. Addresses review comment from onkolahmet in discussion_r2619221774. Signed-off-by: Marcelo Henrique Neppel <marcelo.neppel@canonical.com>
Signed-off-by: Marcelo Henrique Neppel <marcelo.neppel@canonical.com>
Update check_for_fix_log_message() to check for the correct log message that includes the full path: "at /var/snap/charmed-postgresql/common/data/temp" Add assertion to ensure the test fails explicitly if the expected log message is not found, rather than silently passing. Signed-off-by: Marcelo Henrique Neppel <marcelo.neppel@canonical.com>
…tablespace-management Signed-off-by: Marcelo Henrique Neppel <marcelo.neppel@canonical.com>
onkolahmet
left a comment
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.
LGTM thanks Marcelo!
Issue
There is no integration test to validate the fix from postgresql-single-kernel-library PR canonical/postgresql-single-kernel-library#54, which correctly handles persistent storage for PostgreSQL temp tablespaces to prevent "ObjectInUse" errors after container restarts.
Solution
The test performs a leader election followed by a restart to trigger the library's set_up_database() method, which detects persistent temp storage and logs the appropriate message confirming the fix is working. Test helper functions (get_lxd_machine_name, verify_leader_active, verify_temp_table_creation, force_leader_election, check_for_fix_log_message) are added to jubilant_helpers.py for reusability.
Depends on canonical/postgresql-single-kernel-library#54.
Checklist