summaryrefslogtreecommitdiffstats
path: root/tests/e2e
Commit message (Collapse)AuthorAgeFilesLines
* tests: e2e: add tests for more `repo init` optionsBrian Gan2026-10-263-4/+223
| | | | | | | | | | | | | | | | | Cover `--reference` from a local mirror (with & without `--dissociate`), `--standalone-manifest` with a manifest file served over HTTP, and `--manifest-depth`. Teach the server to serve static files (`GitHost.publish_file`), let `manifest_xml` take an absolute `fetch` URL, and add `move_aside` to make git dirs disappear mid-test (deleting them fails on Windows). Bug: 566270944 Change-Id: Id60a19613a627f76d8d9125570dd5ce0cdfff9aa Reviewed-on: https://gerrit-review.googlesource.com/c/git-repo/+/648549 Reviewed-by: Gavin Mak <gavinmak@google.com> Tested-by: Brian Gan <brgan@google.com> Commit-Queue: Brian Gan <brgan@google.com>
* tests: e2e: add tests for sync failuresBrian Gan2026-10-263-1/+200
| | | | | | | | | | | | | | | | | Cover projects missing on the server (incl. `--fail-fast`), missing project & manifest revisions, and local changes that conflict with an incoming change. The tests check that repo exits non-zero with a useful error, leaves the rest of the tree usable, and recovers once the problem is fixed. Let `RepoClient.init` return failures instead of raising. Bug: 566270944 Change-Id: I84e2b8c0bb6012678add77360b446d4bea010c78 Reviewed-on: https://gerrit-review.googlesource.com/c/git-repo/+/648548 Reviewed-by: Gavin Mak <gavinmak@google.com> Tested-by: Brian Gan <brgan@google.com> Commit-Queue: Brian Gan <brgan@google.com>
* tests: e2e: add tests for manifest groupsBrian Gan2026-10-263-3/+205
| | | | | | | | | | | | | | | Cover re-running `repo init -g` to add & remove projects, `<include groups=...>`, `platform-*` groups & `--platform`, and groups combined with a superproject. Let `RepoClient.list_projects` pass args to `repo list`. Bug: 566270944 Change-Id: Id333078fd18d38962d8b725ae9bd87f4976c3112 Reviewed-on: https://gerrit-review.googlesource.com/c/git-repo/+/648547 Tested-by: Brian Gan <brgan@google.com> Reviewed-by: Gavin Mak <gavinmak@google.com> Commit-Queue: Brian Gan <brgan@google.com>
* tests: e2e: add tests for partial clones & the Android setupBrian Gan2026-10-264-1/+430
| | | | | | | | | | | | | | | | | | | | | Cover the go/repo-init flags used across Android (superproject, `-c`, `--partial-clone`, `--partial-clone-exclude` & `--clone-filter`) followed by the go/sync flags, under Git 2 & Git 3 defaults: projects are pinned to the superproject, filtered blobs stay on the server, excluded projects are full clones, and incremental syncs skip projects whose pin didn't move. Also cover the default filter, and `sync -n` then `sync -l` with a partial clone (where `-l` has to fetch blobs on demand). Add harness helpers to read a checkout's git config, list the repos a client contacted, and create blobs that only exist in history. Bug: 566270944 Change-Id: I77d2cabc1d4f5db2ea139c7825ba87638c6db1e7 Reviewed-on: https://gerrit-review.googlesource.com/c/git-repo/+/648546 Commit-Queue: Brian Gan <brgan@google.com> Reviewed-by: Gavin Mak <gavinmak@google.com> Tested-by: Brian Gan <brgan@google.com>
* tests: e2e: add tests for network-only & local-only syncsBrian Gan2026-10-264-6/+442
| | | | | | | | | | | | | | | | | | | Cover `repo sync -n` & `-l` on existing checkouts (interleaved & phased), projects that were never fetched, and two-phase syncs with a superproject. `-l` must not touch the network, which the tests check by taking the server offline. Also cover tags (`--no-tags` & `sync-tags`), `--prune`, `--force-sync`, `--force-remove-dirty` & `-d`. Teach the harness to simulate outages (`GitHost.offline`) and to collect the requests made during a block (`GitHost.watch_requests`), and add a few `RepoClient` helpers. Bug: 566270944 Change-Id: I96b4729a7d4e5b58bc57fb46a060beda35549979 Reviewed-on: https://gerrit-review.googlesource.com/c/git-repo/+/648545 Tested-by: Brian Gan <brgan@google.com> Commit-Queue: Brian Gan <brgan@google.com> Reviewed-by: Gavin Mak <gavinmak@google.com>
* tests: e2e: add tests for init, sync & common workflowsBrian Gan2026-10-265-0/+901
| | | | | | | | | | | | | | | | | | | Cover the core `repo init` & `repo sync` options (current branch only, clone bundles, shallow clones, groups, local manifests & manifest names), multi-step workflows (two-phase syncs, mirrors, incremental syncs, local work, switching manifest branches, selfupdate, ...), and manifests that broke users in the past. Some tests also run under Git 3 defaults. Add `RepoClient` helpers to list remote-tracking branches & checkouts, and document the test layout in the README. Bug: 566270944 Change-Id: Iac333216e0f27e489e64f4eb853189f860a91f20 Reviewed-on: https://gerrit-review.googlesource.com/c/git-repo/+/648544 Tested-by: Brian Gan <brgan@google.com> Reviewed-by: Gavin Mak <gavinmak@google.com> Commit-Queue: Brian Gan <brgan@google.com>
* tests: e2e: fix harness on Windows, CI & inside git checkoutsBrian Gan2026-10-262-5/+48
| | | | | | | | | | | | | | | | | | | | | Normalize the `\r\n` that Python on Windows writes to pipes in repo's output so tests can match multi-line messages. Pass a str to `os.readlink`, which only accepts Path objects on Windows since Python 3.8. Set `GIT_CEILING_DIRECTORIES` for the client so git never finds a repo above the test dir (e.g. when running with `--basetemp=./tmp` from a checkout). Run the real git rather than a `git` wrapper that's first on PATH: the real git's exec dir (from `git --exec-path`) has a copy of git, so put it first on PATH. LUCI's wrapper, for one, retries server errors for minutes, which hangs tests that simulate them. Bug: 566270944 Change-Id: Ia0ed5285852638e533632a7272f154239f1e834f Reviewed-on: https://gerrit-review.googlesource.com/c/git-repo/+/648543 Reviewed-by: Gavin Mak <gavinmak@google.com> Tested-by: Brian Gan <brgan@google.com> Commit-Queue: Brian Gan <brgan@google.com>
* tests: e2e: add pytest fixtures & `e2e` markerBrian Gan2026-10-224-17/+158
| | | | | | | | | | | | | | | | | | | | Add tests/e2e/conftest.py with fixtures for writing end-to-end tests: a session-wide git server, the published code under test, a per-test namespace of server repos, and a repo client with an isolated HOME & git config. Parametrize `git_defaults` to emulate Git 3 defaults (reftable & `main` as the default branch) on older git. Tests under tests/e2e/ are marked `e2e` and run after the unit tests in `./run_tests`. Use `-m e2e` or `-m 'not e2e'` to select them. They're skipped when `git http-backend` is unavailable, git is older than 2.28, or not running from a git checkout. Bug: 566270944 Change-Id: Ib61e4dd7acc41a65beec4d74f1635a25dce4e3be Reviewed-on: https://gerrit-review.googlesource.com/c/git-repo/+/647643 Commit-Queue: Brian Gan <brgan@google.com> Tested-by: Brian Gan <brgan@google.com> Reviewed-by: Gavin Mak <gavinmak@google.com>
* tests: e2e: add a client to run repo against the local serverBrian Gan2026-10-222-1/+280
| | | | | | | | | | | | | | | | | | | Add `RepoClient`, which runs a standalone copy of the `repo` launcher as a subprocess the same way end users do, and `publish_repo_source`, which publishes the code under test (the current checkout, including uncommitted changes) as a repo on the server so `repo init` installs it into .repo/repo/ over HTTP. Also add `GIT_DEFAULTS` so tests can emulate Git 3 defaults (reftable & `main` as the default branch) on older git. Bug: 566270944 Change-Id: I01ef53362b7812f4cb3e012509350980413cf0a8 Reviewed-on: https://gerrit-review.googlesource.com/c/git-repo/+/647505 Tested-by: Brian Gan <brgan@google.com> Commit-Queue: Brian Gan <brgan@google.com> Reviewed-by: Gavin Mak <gavinmak@google.com>
* tests: e2e: add a local smart HTTP git serverBrian Gan2026-10-222-7/+445
| | | | | | | | | | | | | | | | | | | Add `GitHttpServer`, which serves the bare repositories under a directory over smart HTTP by running `git http-backend` behind a small threaded HTTP server on 127.0.0.1. Like Gerrit/GoB, it also serves static `<repo>/clone.bundle` files. It records the requests it receives so tests can check what clients fetched. Add `GitHost`, which gives each test its own namespace of repos on a shared server, with helpers to create & update a manifest repo. Bug: 566270944 Change-Id: I35ff0b9ae743ed7a8d3c775525986e662ef03de0 Reviewed-on: https://gerrit-review.googlesource.com/c/git-repo/+/647504 Reviewed-by: Gavin Mak <gavinmak@google.com> Tested-by: Brian Gan <brgan@google.com> Commit-Queue: Brian Gan <brgan@google.com>
* tests: e2e: add helpers to create bare git reposBrian Gan2026-10-222-0/+359
This is the first piece of a hermetic end-to-end test harness for running the real `repo` against a local git server. Add tests/e2e/harness.py with `ServerRepo`, which creates bare repositories, commits (including gitlinks for superprojects), branches, tags & clone bundles without needing a worktree. Commits are written with `git fast-import` using a fixed identity & a monotonic fake clock so they're cheap & strictly ordered. Also add helpers to run git with the user's git environment stripped & to write git config files directly. Bug: 566270944 Change-Id: Ifa9cf84529a699987bf6b21bbe94bd43483d1e73 Reviewed-on: https://gerrit-review.googlesource.com/c/git-repo/+/647503 Reviewed-by: Gavin Mak <gavinmak@google.com> Commit-Queue: Brian Gan <brgan@google.com> Tested-by: Brian Gan <brgan@google.com>