Skip to content

Add integration test script and fix Forgejo clone auth#208

Merged
amitsaha merged 2 commits intoamitsaha:masterfrom
rdowavic:feat/integration-test-script
Feb 25, 2026
Merged

Add integration test script and fix Forgejo clone auth#208
amitsaha merged 2 commits intoamitsaha:masterfrom
rdowavic:feat/integration-test-script

Conversation

@rdowavic
Copy link
Contributor

@rdowavic rdowavic commented Feb 25, 2026

Sorry, as I wrote this I may have fixed a couple of things here and there and probably should have done it in a separate commit but kind of wanted to get it over with. The maint gist of this script is that I wanted to test all services with both https and ssh by creating two repos gitbackup-test-private and gitbackup-test-public in each of the services and then testing they were properly found. You can run the command and specify the service you want to test or you can just test all of them and whatever credentials are found test/.env are run. If something's missing, it's skipped. You can output in verbose mode which includes the command's output or you can just print pass/fails.

This is a preview of what the integration script looks like:

Building gitbackup...
=== forgejo (SSH) ===
  Running fresh clone...
    Found gitbackup-test-public
    Found gitbackup-test-private
  PASS: forgejo (SSH): fresh clone
  Running update...
  PASS: forgejo (SSH): update
  Running bare clone...
    Found gitbackup-test-public.git (bare)
    Found gitbackup-test-private.git (bare)
  PASS: forgejo (SSH): bare clone

=== forgejo (HTTPS) ===
  Running fresh clone...
    Found gitbackup-test-public
    Found gitbackup-test-private
  PASS: forgejo (HTTPS): fresh clone
  Running update...
  PASS: forgejo (HTTPS): update
  Running bare clone...
    Found gitbackup-test-public.git (bare)
    Found gitbackup-test-private.git (bare)
  PASS: forgejo (HTTPS): bare clone

Summary

  • I've added a manual integration test script (test/integration-test.sh) for verifying gitbackup works against GitHub, GitLab, Bitbucket, and Forgejo (you can pass the names of the ones you want to test in)
  • There was a problem I came across with ForgeJo HTTPS clone authentication (the credentials weren't being passed in) and also the SSH was doing HTTPS cloning (I realised when I inspected the URL)
  • Tests cover fresh clone, update, bare clone, and ignore-private across both SSH and HTTPS for each service
  • -v/--verbose flag for full gitbackup output + summary, quiet mode by default
  • ignore-private test verifies private repos are correctly skipped
  • Docs and .env.example included

Forgejo clone auth fix:

  • client.go: Set gitHostToken in newForgejoClient() so HTTPS clone URLs get credentials
  • helpers.go: Add "forgejo" case to getUsername() via GetMyUserInfo()
  • forgejo.go: Use getCloneURL(repo.CloneURL, repo.SSHURL) instead of hardcoded repo.CloneURL
  • repositories_test.go: Update test fixtures with separate clone_url and ssh_url fields

Test plan

  • go test ./... passes
  • bash test/integration-test.sh bitbucket — 6/6 pass
  • bash test/integration-test.sh forgejo — SSH and HTTPS both pass
  • bash test/integration-test.sh github
  • bash test/integration-test.sh gitlab

Rachel Dowavic and others added 2 commits February 25, 2026 22:16
- Add integration test script (test/integration-test.sh) that tests
  fresh clone, update, bare clone, and ignore-private across all
  services (GitHub, GitLab, Bitbucket, Forgejo) for both SSH and HTTPS
- Add -v/--verbose flag to control output verbosity
- Fix Forgejo HTTPS clone auth: set gitHostToken, add getUsername()
  support, and use getCloneURL() to respect SSH/HTTPS flag
- Update Forgejo test fixtures with separate clone_url and ssh_url fields
- Update Bitbucket scope docs in INTEGRATION_TESTING.md
@amitsaha amitsaha merged commit ad68a14 into amitsaha:master Feb 25, 2026
6 checks passed
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