Skip to content

tests: speed up the prune tests (1.4-maint) - #10543

Merged
ThomasWaldmann merged 2 commits into
borgbackup:1.4-maintfrom
ThomasWaldmann:faster-prune-tests-1.4
Oct 24, 2026
Merged

ThomasWaldmann merged 2 commits into
borgbackup:1.4-maintfrom
ThomasWaldmann:faster-prune-tests-1.4

Conversation

@ThomasWaldmann

Copy link
Copy Markdown
Member

Description

The prune tests in archiver.py were the slowest tests in the suite. They spent their time on things prune does not care about:

  • Every create backed up src_dir, the whole src/borg package, although prune only looks at archive names and timestamps. They now back up a single 1 KiB file.
  • RemoteArchiverTestCase ran every prune test again through borg serve, which costs a subprocess start per command (~75 commands in test_prune_retain_and_expire_oldest). The prune rules are evaluated client-side, so the tests that only check the rules (example, quarterly, retain_and_expire_oldest, prefix, glob) are skipped for remote. test_prune_repository and the stats tests still run against a remote repository.

master already does both (the backup_files fixture and kinds="local,binary" in prune_cmd_test.py).

src/borg/testsuite/archiver.py, macOS, 18 xdist workers, on a RAM disk:

before after
wall time 40.0 s 28.1 s
slowest test 19.1 s (remote test_prune_retain_and_expire_oldest) 5.5 s (remote test_benchmark_crud)

Test-only change.

Checklist

  • PR is against master (or maintenance branch if only applicable there)
  • New code has tests and docs where appropriate
  • Tests pass (run tox or the relevant test subset)
  • Commit messages are clean and reference related issues

🤖 Generated with Claude Code

ThomasWaldmann and others added 2 commits October 24, 2026 13:17
The prune tests backed up the whole borg package (src_dir) for every
archive they create, although prune only looks at archive names and
timestamps. Back up a single small file instead.

The prune rules are evaluated client-side, so do not run the tests that
only check them again against a remote repository. test_prune_repository
and the stats tests still run against a remote repository.

archiver.py on 18 workers: 40s -> 28s; the slowest prune test went
from 19s to below 2s.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
The FreeBSD package repository does not have python310 / py310-sqlite3
anymore, so pkg install failed and the job aborted before running any
tests. The job uses Python 3.11 for the venv and tox, so 3.10 was not
used anyway.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@codecov

codecov Bot commented Oct 24, 2026 •

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 82.22%. Comparing base (c13c9ee) to head (9554348).
⚠️ Report is 3 commits behind head on 1.4-maint.

Additional details and impacted files
@@              Coverage Diff              @@
##           1.4-maint   #10543      +/-   ##
=============================================
+ Coverage      82.10%   82.22%   +0.12%     
=============================================
  Files             38       38              
  Lines          11480    11480              
  Branches        1808     1808              
=============================================
+ Hits            9426     9440      +14     
+ Misses          1468     1457      -11     
+ Partials         586      583       -3     

☔ View full report in Codecov by Harness.
📢 Have feedback on the report? Share it here.

@ThomasWaldmann
ThomasWaldmann merged commit f5254cb into borgbackup:1.4-maint Oct 24, 2026
15 checks passed
@ThomasWaldmann
ThomasWaldmann deleted the faster-prune-tests-1.4 branch October 24, 2026 11:56
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.

1 participant