Skip to content

Conversation

@marceloneppel
Copy link
Member

@marceloneppel marceloneppel commented Dec 11, 2025

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

  • I have added or updated any relevant documentation.
  • I have cleaned any remaining cloud resources from my accounts.

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>
@github-actions github-actions bot added the Libraries: Out of sync The charm libs used are out-of-sync label Dec 11, 2025
@codecov
Copy link

codecov bot commented Dec 11, 2025

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 70.60%. Comparing base (dad1b02) to head (f81a994).
⚠️ Report is 1 commits behind head on 16/edge.

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.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

@marceloneppel marceloneppel added the bug Something isn't working as expected label Dec 11, 2025
@marceloneppel marceloneppel changed the title Add integration test for persistent temp tablespace handling [DPE-8747] Add integration test for persistent temp tablespace handling Dec 12, 2025
@marceloneppel marceloneppel marked this pull request as ready for review December 12, 2025 19:35
taurus-forever
taurus-forever previously approved these changes Dec 15, 2025
Copy link
Contributor

@taurus-forever taurus-forever left a comment

Choose a reason for hiding this comment

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

Thank you!

Copy link
Contributor

@onkolahmet onkolahmet left a 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>
Copy link
Contributor

@onkolahmet onkolahmet left a comment

Choose a reason for hiding this comment

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

LGTM thanks Marcelo!

@marceloneppel marceloneppel merged commit c2c7d81 into 16/edge Dec 18, 2025
171 of 175 checks passed
@marceloneppel marceloneppel deleted the dpe-8747-fix-temp-tablespace-management branch December 18, 2025 10:58
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

bug Something isn't working as expected Libraries: Out of sync The charm libs used are out-of-sync

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants