diff --git a/test/INTEGRATION_TESTING.md b/test/INTEGRATION_TESTING.md index 7520a0d..922624e 100644 --- a/test/INTEGRATION_TESTING.md +++ b/test/INTEGRATION_TESTING.md @@ -18,6 +18,7 @@ Each contributor creates their own test accounts. The script expects a standard 2. Create two repositories: - `gitbackup-test-public` (public) - `gitbackup-test-private` (private) +3. Fork any public repo and rename it to `gitbackup-test-ignore-fork` (for testing `-ignore-fork`) ### GitLab @@ -25,6 +26,7 @@ Each contributor creates their own test accounts. The script expects a standard 2. Create two projects: - `gitbackup-test-public` (public) - `gitbackup-test-private` (private) +3. Fork any public project and rename it to `gitbackup-test-ignore-fork` (for testing `-ignore-fork`) ### Bitbucket @@ -32,6 +34,7 @@ Each contributor creates their own test accounts. The script expects a standard 2. Create a workspace and two repositories: - `gitbackup-test-public` (public) - `gitbackup-test-private` (private) +3. Fork any public repo into your workspace and rename it to `gitbackup-test-ignore-fork` (for testing `-ignore-fork`) ### Forgejo (Codeberg) @@ -39,6 +42,7 @@ Each contributor creates their own test accounts. The script expects a standard 2. Create two repositories: - `gitbackup-test-public` (public) - `gitbackup-test-private` (private) +3. Fork any public repo and rename it to `gitbackup-test-ignore-fork` (for testing `-ignore-fork`) ## Environment Setup diff --git a/test/integration-test.sh b/test/integration-test.sh index b95a351..f263280 100755 --- a/test/integration-test.sh +++ b/test/integration-test.sh @@ -192,6 +192,56 @@ run_service_tests() { fail "$service ($label): ignore-private — gitbackup exited with error" fi + rm -rf "$tmpdir" + + # Test 5: Ignore fork + tmpdir=$(mktemp -d) + + echo " Running clone without -ignore-fork (fork should be present)..." + if run_gitbackup -service "$service" -backupdir "$tmpdir" $extra_flags; then + if check_repo_exists "$tmpdir" "gitbackup-test-ignore-fork"; then + echo " Found gitbackup-test-ignore-fork (forked repo)" + pass "$service ($label): fork present without -ignore-fork" + else + echo " Missing gitbackup-test-ignore-fork (forked repo)" + fail "$service ($label): fork present without -ignore-fork — gitbackup-test-ignore-fork not found" + fi + else + fail "$service ($label): fork present without -ignore-fork — gitbackup exited with error" + fi + + rm -rf "$tmpdir" + + # Test 6: Ignore fork (with flag) + tmpdir=$(mktemp -d) + + echo " Running clone with -ignore-fork..." + if run_gitbackup -service "$service" -backupdir "$tmpdir" -ignore-fork $extra_flags; then + if check_repo_exists "$tmpdir" "gitbackup-test-ignore-fork"; then + echo " Found gitbackup-test-ignore-fork (unexpected — should be skipped)" + fail "$service ($label): ignore-fork — forked repo should have been skipped" + else + echo " Correctly skipped gitbackup-test-ignore-fork" + # Verify non-fork repos are still present + all_found=true + for repo_name in $EXPECTED_REPOS; do + if check_repo_exists "$tmpdir" "$repo_name"; then + echo " Found $repo_name" + else + echo " Missing $repo_name" + all_found=false + fi + done + if $all_found; then + pass "$service ($label): ignore-fork" + else + fail "$service ($label): ignore-fork — non-fork repos missing" + fi + fi + else + fail "$service ($label): ignore-fork — gitbackup exited with error" + fi + rm -rf "$tmpdir" trap - RETURN }