Open
Conversation
This commit rewrites the GitHub backup application from Ruby to Golang. The core functionality of backing up repositories, including handling Git LFS, remains the same. Key changes include: - Replaced `ghbackup.rb` with `main.go`. - Updated `Dockerfile` to use a Go build environment, compile the Go application, and include necessary tools (git, git-lfs). - The `entrypoint.sh` script remains largely unchanged, now executing the compiled Go binary. - Introduced an `App` struct in `main.go` to manage dependencies like the GitHub client, command runner, and filesystem operations, improving testability. - Added a comprehensive suite of unit tests in `main_test.go` using mocking for external dependencies (GitHub API, git commands, filesystem). This covers various scenarios including initial clone, repository updates, and error handling. - Removed Ruby-specific files (`.ruby-version`, `ghbackup.rb`). - Updated `README.md` to reflect the language change.
This commit addresses issues in `main_test.go` that caused tests to fail:
1. The unused variable `authenticatedCloneURLRepo2` in the
`TestAppRun_CloneErrorSkipsRepo` test was commented out to resolve
a build error.
2. The mock function `mockCmd.RunAndOutputFunc` within
`TestAppRun_CloneErrorSkipsRepo` was updated. It was previously
using an incorrect argument index (`args[3]`) to identify the
repository URL for simulating a clone failure. This has been
corrected to use the proper index (`args[4]`), allowing the test
to accurately simulate the intended scenario and pass.
All tests now pass after these changes.
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.
Test the use of Google Jules to rewrite the application from Ruby to Go and introduce tests.