Skip to content

testsuite: add Archives and LegacyArchives unit tests, refs #9556#9648

Open
mr-raj12 wants to merge 2 commits into
borgbackup:masterfrom
mr-raj12:testsuite-legacy-archives
Open

testsuite: add Archives and LegacyArchives unit tests, refs #9556#9648
mr-raj12 wants to merge 2 commits into
borgbackup:masterfrom
mr-raj12:testsuite-legacy-archives

Conversation

@mr-raj12
Copy link
Copy Markdown
Contributor

@mr-raj12 mr-raj12 commented May 15, 2026

Description

Adds unit tests for Archives and LegacyArchives, refs #9556.

Phase 3 (#9644) merged without test coverage for the new Archives-only code paths and without any tests for LegacyArchives. This PR adds both.

src/borg/testsuite/archives_test.py — 70+ tests for Archives (Borg 2.x, manifest.py):

  • init, raw-dict round-trip (_set_raw_dict / _get_raw_dict)
  • ids, count, names, exists, exists_id, exists_name_and_id, exists_name_and_ts
  • create (str ts, datetime ts, duplicate guard, overwrite=True)
  • get / get_by_id (happy path, missing → None, raw=True)
  • delete_by_id, undelete_by_id, nuke_by_id
  • _get_archive_meta (ObjectNotFound path, success path, bad version)
  • list() — sort, reverse, first/last pagination, date filters (older/newer/oldest/newest), all match prefixes (name:, user:, host:, tags:, aid:, ambiguous aid:)
  • get_one (exact match, zero matches, multiple matches)
  • list_considering (name-conflict guard, full delegation)
  • regression: _matching_info_tuples must materialise _info_tuples() via list() before returning — if removed, the raw generator reaches .sort() and raises AttributeError

src/borg/testsuite/legacy_archives_test.py — 50+ tests for LegacyArchives (legacy/archives.py), same coverage plus:

  • prepare / finish round-trip
  • NotImplementedError stubs (exists_id, exists_name_and_id, exists_name_and_ts, delete_by_id, undelete_by_id, nuke_by_id)
  • protocol check: isinstance(la, ArchivesInterface)
  • integration smoke: Manifest picks LegacyArchives for a LegacyRepository

No production code changes.

Refs #9556

Checklist

  • PR is against master
  • New code has tests (this PR is the tests)
  • Tests pass
  • Commit message references related issue

@codecov
Copy link
Copy Markdown

codecov Bot commented May 15, 2026

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 83.84%. Comparing base (6659bd9) to head (fdc00d9).
⚠️ Report is 16 commits behind head on master.
✅ All tests successful. No failed tests found.

Additional details and impacted files
@@            Coverage Diff             @@
##           master    #9648      +/-   ##
==========================================
+ Coverage   83.08%   83.84%   +0.76%     
==========================================
  Files          90       90              
  Lines       15653    15653              
  Branches     2356     2356              
==========================================
+ Hits        13006    13125     +119     
+ Misses       1887     1788      -99     
+ Partials      760      740      -20     

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

@mr-raj12 mr-raj12 force-pushed the testsuite-legacy-archives branch from ca6ff9b to dad3f58 Compare May 16, 2026 01:53
@mr-raj12 mr-raj12 force-pushed the testsuite-legacy-archives branch from dad3f58 to fdc00d9 Compare May 16, 2026 03:25
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