-
Notifications
You must be signed in to change notification settings - Fork 23
[MISC] Set Pgbackrest spool dir to archive mount #1025
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
base: 16/edge
Are you sure you want to change the base?
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,7 +1,6 @@ | ||
# Copyright 2023 Canonical Ltd. | ||
# See LICENSE file for licensing details. | ||
import datetime | ||
from os import cpu_count | ||
from unittest.mock import MagicMock, PropertyMock, call, mock_open, patch | ||
|
||
import pytest | ||
|
@@ -14,7 +13,7 @@ | |
from tenacity import RetryError, wait_fixed | ||
|
||
from charm import PostgresqlOperatorCharm | ||
from constants import PEER | ||
from constants import PEER, POSTGRESQL_ARCHIVE_PATH | ||
from tests.unit.helpers import _FakeApiError | ||
|
||
ANOTHER_CLUSTER_REPOSITORY_ERROR_MESSAGE = "the S3 repository has backups from another cluster" | ||
|
@@ -1762,6 +1761,7 @@ def test_render_pgbackrest_conf_file(harness, tls_ca_chain_filename): | |
new_callable=PropertyMock(return_value=tls_ca_chain_filename), | ||
) as _tls_ca_chain_filename, | ||
patch("charm.PostgreSQLBackups._retrieve_s3_parameters") as _retrieve_s3_parameters, | ||
patch("charm.PostgresqlOperatorCharm.get_available_resources", return_value=(4, 1024)), | ||
): | ||
# Set up a mock for the `open` method, set returned data to postgresql.conf template. | ||
with open("templates/pgbackrest.conf.j2") as f: | ||
|
@@ -1813,7 +1813,8 @@ def test_render_pgbackrest_conf_file(harness, tls_ca_chain_filename): | |
storage_path=harness.charm._storage_path, | ||
user="backup", | ||
retention_full=30, | ||
process_max=max(cpu_count() - 2, 1), | ||
process_max=2, | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. why hardcoded 2? There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. We should be getting the number of available cores from |
||
archive_path=POSTGRESQL_ARCHIVE_PATH, | ||
) | ||
|
||
# Patch the `open` method with our mock. | ||
|
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.
Get CPU from the helper to manage fractional limits.