Skip to content

test and fixes for rsync_tmbackup importer#80

Closed
hiijoshi wants to merge 2 commits intoborgbackup:masterfrom
hiijoshi:add-rsync-tmbackup-test
Closed

test and fixes for rsync_tmbackup importer#80
hiijoshi wants to merge 2 commits intoborgbackup:masterfrom
hiijoshi:add-rsync-tmbackup-test

Conversation

@hiijoshi
Copy link
Copy Markdown
Contributor

@hiijoshi hiijoshi commented Mar 21, 2026

Summary

Added a test for the rsync_tmbackup importer.

Changes

  • Added a test that simulates rsync-time-backup style folders
  • Verifies archives can be imported into the target repository
  • Improves test coverage for the rsync_tmbackup importer

Reason

This extends importer test coverage using the same integration-style approach already used in the existing test suite.

Copy link
Copy Markdown
Member

@ThomasWaldmann ThomasWaldmann left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for the PR!

@hiijoshi
Copy link
Copy Markdown
Contributor Author

Thanks for the review!

I’ve updated the PR by:

  • moving the rsync_tmbackup test into a separate test module (test_tmbackup.py)
  • improving assertions to check archive names and extracted file contents
  • aligning the test structure with existing integration-style tests

All tests are passing locally.

Please let me know if anything else should be improved.

@ThomasWaldmann ThomasWaldmann marked this pull request as draft March 24, 2026 13:42
@hiijoshi hiijoshi marked this pull request as ready for review March 24, 2026 16:36
@hiijoshi hiijoshi force-pushed the add-rsync-tmbackup-test branch 5 times, most recently from e41ecd8 to 764d2dc Compare March 24, 2026 17:20
@hiijoshi hiijoshi force-pushed the add-rsync-tmbackup-test branch from 764d2dc to a6b838d Compare March 24, 2026 17:22
Copy link
Copy Markdown
Member

@ThomasWaldmann ThomasWaldmann left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

some stuff i found.


def test_rsync_tmbackup_import(tmpdir, monkeypatch):
"""Test importing rsync-time-backup style snapshots into a borg repo."""
src = Path(str(tmpdir.mkdir("tmbackup")))
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why is that Path(str(...)) needed?


# Create archives in the source repository
subprocess.check_call(["borg", "create", f"{source_repo}::archive1", "."], cwd=str(archive1_data))

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

this PR is not about test_borg, so you should revert all changes to that file.

snap2.mkdir()
(snap2 / "file1.txt").write_text("This is file 1 in snap2")

target_repo = Path(str(tmpdir.mkdir("target_repo")))
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

same here.

assert any("2023-01-02" in a for a in archives)

# Extract and verify file contents
extract_dir = Path(str(tmpdir.mkdir("extracted")))
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

same here.

Comment on lines +40 to +41
assert any("2023-01-01" in a for a in archives)
assert any("2023-01-02" in a for a in archives)
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

why so complicated?

archives is a list of str, so you can just assert "2023-01-01" in archives.

@ThomasWaldmann
Copy link
Copy Markdown
Member

Also, if there is anything rsync_tmbackup specific you need from the other 3 PRs you opened, apply it to this one and close the other PRs.

@ThomasWaldmann ThomasWaldmann changed the title Add test for rsync_tmbackup importer test and fixes for rsync_tmbackup importer Mar 25, 2026
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.

2 participants