Skip to content

Conversation

marceloneppel
Copy link
Member

@marceloneppel marceloneppel commented Sep 24, 2025

Issue

The backups, smoke, and restore cluster tests started to fail with the following error at https://github.com/canonical/postgresql-operator/actions/runs/17796882879 because we incorrectly compare values in two different formats.

unit-postgresql-ceph-0: 10:09:12 ERROR unit.postgresql-ceph/0.juju-log __main__:
Traceback (most recent call last):
  File "/var/lib/juju/agents/unit-postgresql-ceph-0/charm/venv/lib/python3.12/site-packages/single_kernel_postgresql/utils/postgresql.py", line 1106, in set_up_database
    cursor.execute(f"CREATE TABLESPACE temp LOCATION '{temp_location}';")
psycopg2.errors.ObjectInUse: directory "/var/snap/charmed-postgresql/common/data/temp/PG_16_202307071" already in use as a tablespace

temp_location_stats.st_mode returns 16832 and POSTGRESQL_STORAGE_PERMISSIONS returns 448 when the permissions of both are 0o700, which triggers a tablespace rename every time, even when the directory permissions are correct, leading to the above error.

Solution

Convert the output from the st_mode attribute to the same format that we retrieve from the POSTGRESQL_STORAGE_PERMISSIONS constant.

Also, I added the missing unit test (test_set_up_database_owner_and_permissions_match_no_rename_or_fix) to validate this conversion.

Checklist

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

Signed-off-by: Marcelo Henrique Neppel <marcelo.neppel@canonical.com>
Copy link

codecov bot commented Sep 24, 2025

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 46.32%. Comparing base (3ebd14c) to head (a8a9cda).
⚠️ Report is 3 commits behind head on 16/edge.

❌ Your project status has failed because the head coverage (46.32%) is below the target coverage (70.00%). You can increase the head coverage or adjust the target coverage.

Additional details and impacted files
@@             Coverage Diff             @@
##           16/edge      #17      +/-   ##
===========================================
+ Coverage    46.07%   46.32%   +0.24%     
===========================================
  Files            4        4              
  Lines          803      803              
  Branches        94       94              
===========================================
+ Hits           370      372       +2     
  Misses         414      414              
+ Partials        19       17       -2     

☔ 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 merged commit c7b0383 into 16/edge Sep 27, 2025
7 of 8 checks passed
@marceloneppel marceloneppel deleted the fix-permissions-comparison branch September 27, 2025 00:28
@marceloneppel marceloneppel mentioned this pull request Sep 29, 2025
2 tasks
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants