Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions test/INTEGRATION_TESTING.md
Original file line number Diff line number Diff line change
Expand Up @@ -18,27 +18,31 @@ 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

1. Create a [personal access token](https://gitlab.com/-/user_settings/personal_access_tokens) with `read_api` scope
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

1. Create an [API token](https://bitbucket.org/account/settings/app-passwords/) with `read:user:bitbucket`, `read:workspace:bitbucket`, and `read:repository:bitbucket` scopes
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)

1. Create an [access token](https://codeberg.org/user/settings/applications) with `read:repository` permission
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

Expand Down
50 changes: 50 additions & 0 deletions test/integration-test.sh
Original file line number Diff line number Diff line change
Expand Up @@ -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
}
Expand Down
Loading