Add offline unit tests for BackupService - #30
Merged
Merged
Conversation
Clone and fetch now run against a local source repository instead of github.com, and the status output, failure summary and directory creation error are asserted rather than only checked for no exception. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Member
Author
|
Self-review rubric (head CI:
Observations (no change applied):
Summary: test-only change that removes the last live network call from This review comment was drafted during a Gardener session (https://github.com/Stephenson-Software/gardener). drafted by Claude on behalf of Daniel Stephenson |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Stage B (unit-test expansion) cycle targeting
BackupService. No production code is changed.testBackupUserRepositories_WithRepositoriespreviously attempted a real clone fromhttps://github.com/testuser/repo1.git; the failure was swallowed, so the test passed without exercising a successful clone. It now clones from a local JGit repository (afile://URI) and asserts the.gitdirectory was created.testBackupUserRepositories_ExistingRepositoryIsFetched: a second run against an existing backup takes the update path, prints the "updating"/"Updated successfully" lines, and movesrefs/remotes/origin/<branch>to the new source commit.testBackupUserRepositories_FailedRepositoryIsSummarizedAndOthersContinue: a repository whose clone fails is listed in the⚠ Warning: 1 repository(ies) failed to backup:summary while the remaining repository is still cloned.testBackupUserRepositories_BackupDirectoryCannotBeCreated: when the backup directory path is a regular file, the "Failed to create backup directory ''"IOExceptionis raised and no clone is attempted.testGetBackupStatusData_IgnoresFilesAndFormatsLastModified: plain files at either level are not counted, andlastUpdateduses theyyyy-MM-dd HH:mm:sssystem-zone format.showBackupStatustests assert the actual stdout for the missing-directory, empty-directory, and populated cases (previously onlyassertDoesNotThrow).CHANGELOG.md[Unreleased]entry added.All tests are offline: no network access, filesystem confined to
@TempDir,GitHubService/GHRepositorymocked, following the existing@Mock+MockitoAnnotations.openMocks(this)pattern. No apparent bugs were surfaced; every assertion characterizes current behavior.Test plan
mvn test -Dtest=BackupServiceTest— 16 tests run, 0 failuresmvn test— 125 tests run, 0 failures, 1 skipped (pre-existing)Buildworkflow green on the PR headDeferred issues
No tracking issue — gap found during triage (the clone test reached out to
github.com, and the status tests asserted nothing about output).This PR description was drafted during a Gardener session (https://github.com/Stephenson-Software/gardener).
🤖 Generated with Claude Code
drafted by Claude on behalf of Daniel Stephenson