diff options
| author | Colin Wilk <colin@wilk.cx> | 2026-06-29 20:56:50 +0200 |
|---|---|---|
| committer | Colin Wilk <colin@wilk.cx> | 2026-06-29 20:56:50 +0200 |
| commit | 66e46df3d2a840bf62ef8084ad171041772db65e (patch) | |
| tree | a06192c5689ebf70e739941c1608c406b4b7ee2f /molecule/default | |
| parent | a0432093db76d7bb462f113d4bbeca0a8f376e95 (diff) | |
| download | ansible-role-borgbackup-66e46df3d2a840bf62ef8084ad171041772db65e.tar.gz ansible-role-borgbackup-66e46df3d2a840bf62ef8084ad171041772db65e.zip | |
Support custom arguments for borg create
Diffstat (limited to 'molecule/default')
| -rw-r--r-- | molecule/default/converge.yml | 6 | ||||
| -rw-r--r-- | molecule/default/tests/test_client_setup.py | 27 |
2 files changed, 33 insertions, 0 deletions
diff --git a/molecule/default/converge.yml b/molecule/default/converge.yml index 21d4899..504758d 100644 --- a/molecule/default/converge.yml +++ b/molecule/default/converge.yml @@ -94,6 +94,8 @@ - 1 - TEMPFAIL borg_compression: lz4 + borg_create_additional_arguments: >- + -C zlib,6 borg_systemd_oncalendar: "*-*-* 03:00:00" borg_included_dirs: - /etc @@ -176,6 +178,8 @@ borg_mode_append_only: true borg_storage_quota: 10G borg_compression: zstd + borg_create_additional_arguments: >- + --stats --list --filter=AME borg_included_dirs: - /etc borg_excluded_dirs: [] @@ -190,6 +194,8 @@ borg_mode_append_only: false borg_storage_quota: 50G borg_compression: lz4 + borg_create_additional_arguments: >- + --one-file-system --exclude-caches borg_included_dirs: - /home borg_excluded_dirs: diff --git a/molecule/default/tests/test_client_setup.py b/molecule/default/tests/test_client_setup.py index f59c6db..78e751a 100644 --- a/molecule/default/tests/test_client_setup.py +++ b/molecule/default/tests/test_client_setup.py @@ -301,6 +301,33 @@ class TestBackupScript: else: pytest.fail(f"Unexpected hostname: {hostname}") + def test_backup_script_contains_additional_arguments(self, host): + hostname = host.backend.get_hostname() + + if hostname == "borg-client-multi-keys": + script1 = host.file("/usr/local/bin/run_borg_backup@configs-keys") + script2 = host.file("/usr/local/bin/run_borg_backup@home-data-keys") + assert "--stats" in script1.content_string + assert "--list" in script1.content_string + assert "--filter=AME" in script1.content_string + assert "--one-file-system" in script2.content_string + assert "--exclude-caches" in script2.content_string + elif hostname == "borg-client-2": + script = host.file("/usr/local/bin/run_borg_backup") + content = script.content_string + assert "-C zlib,6" in content + + def test_backup_script_compression_override(self, host): + hostname = host.backend.get_hostname() + if hostname != "borg-client-2": + return + + script = host.file("/usr/local/bin/run_borg_backup") + content = script.content_string + + assert "-C lz4" in content + assert "-C zlib,6" in content + def test_backup_script_contains_borg_rsh_when_per_repo(self, host): hostname = host.backend.get_hostname() per_repo = get_client_ssh_key_per_repo(host) |