sapling/tests/integration
Stanislau Hlebik 3874bb6de0 mononoke: support stacks in sync job bundle generator
Summary:
Previously it was possible to sync just a single commit - this diff adds
support for generating bundle with stacks of commits.

It uses DifferenceOfUnionsOfAncestorsNodeStream which is exactly the same
stream we use in Mononoke to serve `hg pull` requests.

Reviewed By: krallin

Differential Revision: D17498873

fbshipit-source-id: d94066ad0f0cbdd44fd958c57739de1e070eec9f
2019-09-24 05:29:42 -07:00
..
commitsyncmap.toml mononoke: migrate megarepotool move subcommand to core mononoke movers 2019-09-19 03:33:53 -07:00
dummyssh.sh mononoke: rebuild test framework 2019-06-25 08:41:31 -07:00
generate_manifest.py autoformat all of fbcode/scm with black 2019-07-30 08:19:24 -07:00
integration_runner_real.py mononoke/dbbookmarks: finally use >list for allowed bookmark updates 2019-09-11 01:40:11 -07:00
integration_runner.sh mononoke: suggest not using buck run scm/mononoke/tests/integration:integration_runner -- TEST 2019-06-25 08:41:31 -07:00
lib_buck.py autoformat all of fbcode/scm with black 2019-07-30 08:19:24 -07:00
library.sh mononoke: first diff for the sync job that generates bundles (only single commit) 2019-09-24 05:29:42 -07:00
pushrebase_replay.bundle mononoke: add tests for pushrebase replay 2019-02-05 15:08:29 -08:00
README.md mononoke: suggest not using buck run scm/mononoke/tests/integration:integration_runner -- TEST 2019-06-25 08:41:31 -07:00
test-admin-hg-sync-bundle-last-processed.t mononoke: allow tests to work with multiple mononoke repos 2019-09-23 07:16:15 -07:00
test-admin-hg-sync-bundle-remains.t mononoke: allow tests to work with multiple mononoke repos 2019-09-23 07:16:15 -07:00
test-admin-hg-sync-bundle-verify.t mononoke: allow tests to work with multiple mononoke repos 2019-09-23 07:16:15 -07:00
test-alias-verify.t mononoke/filestore: incorporate in Mononoke 2019-07-31 05:19:40 -07:00
test-allowed-users.t mononoke: Prevent humans from moving specific bookmarks in fbsource 2019-08-22 07:10:37 -07:00
test-apiserver-edenapi.t mononoke: rebuild test framework 2019-06-25 08:41:31 -07:00
test-apiserver.t mononoke/apiserver: remove LFS implementation 2019-09-10 06:39:54 -07:00
test-blobimport-bookmarks.t mononoke: allow tests to work with multiple mononoke repos 2019-09-23 07:16:15 -07:00
test-blobimport-inline.t mononoke: rebuild test framework 2019-06-25 08:41:31 -07:00
test-blobimport-lfs.t mononoke: add lfs_import command 2019-08-21 02:33:31 -07:00
test-blobimport-return-error.t mononoke: rebuild test framework 2019-06-25 08:41:31 -07:00
test-blobimport.t mononoke: rebuild test framework 2019-06-25 08:41:31 -07:00
test-bonsai-verify.t mononoke: connect stdlog and slog 2019-09-12 04:13:11 -07:00
test-bookmark-hg-kind.t mononoke: allow tests to work with multiple mononoke repos 2019-09-23 07:16:15 -07:00
test-bookmark-race.t mononoke: rebuild test framework 2019-06-25 08:41:31 -07:00
test-bookmarks-filler.t mononoke: connect stdlog and slog 2019-09-12 04:13:11 -07:00
test-bundle2-preservation.t mononoke: rebuild test framework 2019-06-25 08:41:31 -07:00
test-cache-warmup.t mononoke: rebuild test framework 2019-06-25 08:41:31 -07:00
test-clienttelemetry.t mononoke: rebuild test framework 2019-06-25 08:41:31 -07:00
test-commitcloud.t mononoke: expose option to disable infinitepush server write support 2019-07-02 10:39:52 -07:00
test-copyrename.t mononoke: rebuild test framework 2019-06-25 08:41:31 -07:00
test-getpackv1.t mononoke: getpackv2 LFS support (+ getfiles / getpack / eden_get_data refactor) 2019-08-14 08:48:35 -07:00
test-getpackv2.t mononoke: getpackv2 LFS support (+ getfiles / getpack / eden_get_data refactor) 2019-08-14 08:48:35 -07:00
test-gettreepack.t mononoke: rebuild test framework 2019-06-25 08:41:31 -07:00
test-hash-validation.t mononoke: getpackv2 LFS support (+ getfiles / getpack / eden_get_data refactor) 2019-08-14 08:48:35 -07:00
test-hooks.t mononoke: rebuild test framework 2019-06-25 08:41:31 -07:00
test-inconsistent-hash.t mononoke: corrupt packs, not loose files 2019-09-11 05:40:56 -07:00
test-infinitepush-bookmarks-disabled.t mononoke: allow tests to work with multiple mononoke repos 2019-09-23 07:16:15 -07:00
test-infinitepush-commits-disabled.t mononoke: allow tests to work with multiple mononoke repos 2019-09-23 07:16:15 -07:00
test-infinitepush-namespace.t mononoke: expose option to disable infinitepush server write support 2019-07-02 10:39:52 -07:00
test-infinitepush.t mononoke: allow tests to work with multiple mononoke repos 2019-09-23 07:16:15 -07:00
test-init.t mononoke: allow tests to work with multiple mononoke repos 2019-09-23 07:16:15 -07:00
test-large-path-and-content.t mononoke: rebuild test framework 2019-06-25 08:41:31 -07:00
test-lfs-copytracing.t mononoke: update LFS tests to use new LFS server 2019-09-10 06:39:53 -07:00
test-lfs-import.t mononoke: connect stdlog and slog 2019-09-12 04:13:11 -07:00
test-lfs-server-https.t mononoke: allow tests to work with multiple mononoke repos 2019-09-23 07:16:15 -07:00
test-lfs-server-proxy.t mononoke: allow tests to work with multiple mononoke repos 2019-09-23 07:16:15 -07:00
test-lfs-server.t mononoke: allow tests to work with multiple mononoke repos 2019-09-23 07:16:15 -07:00
test-lfs-to-mononoke.t mononoke: corrupt packs, not loose files 2019-09-11 05:40:56 -07:00
test-lfs-upload-alias-on-fetch.t mononoke: update LFS tests to use new LFS server 2019-09-10 06:39:53 -07:00
test-lfs.t mononoke: update LFS tests to use new LFS server 2019-09-10 06:39:53 -07:00
test-linknodes.t mononoke: expose option to disable infinitepush server write support 2019-07-02 10:39:52 -07:00
test-listkeyspatterns.t mononoke: rebuild test framework 2019-06-25 08:41:31 -07:00
test-lookup.t mononoke: rebuild test framework 2019-06-25 08:41:31 -07:00
test-megarepo-tool.t mononoke: make megarepotool capable of pushsing to bookmarks 2019-09-19 03:33:54 -07:00
test-mononoke-admin.t mononoke: rebuild test framework 2019-06-25 08:41:31 -07:00
test-mononoke-hg-sync-job-generate-bundles.t mononoke: support stacks in sync job bundle generator 2019-09-24 05:29:42 -07:00
test-mononoke-hg-sync-job-with-copies.t mononoke: rebuild test framework 2019-06-25 08:41:31 -07:00
test-mononoke-hg-sync-job.t mononoke: allow tests to work with multiple mononoke repos 2019-09-23 07:16:15 -07:00
test-multiplexed-blobstore.t mononoke: allow tests to work with multiple mononoke repos 2019-09-23 07:16:15 -07:00
test-push-bookmarks.t mononoke: rebuild test framework 2019-06-25 08:41:31 -07:00
test-push-disallowed.t mononoke: rebuild test framework 2019-06-25 08:41:31 -07:00
test-push-newblobimport.t mononoke: rebuild test framework 2019-06-25 08:41:31 -07:00
test-push-protocol.t mononoke: rebuild test framework 2019-06-25 08:41:31 -07:00
test-push-readonly.t mononoke: rebuild test framework 2019-06-25 08:41:31 -07:00
test-pushrebase-block-merges.t mononoke: rebuild test framework 2019-06-25 08:41:31 -07:00
test-pushrebase-copy-src-changed.t mononoke: rebuild test framework 2019-06-25 08:41:31 -07:00
test-pushrebase-discovery.t mononoke: expose option to disable infinitepush server write support 2019-07-02 10:39:52 -07:00
test-pushrebase-emit-obsmarkers.t mononoke: rebuild test framework 2019-06-25 08:41:31 -07:00
test-pushrebase-empty.t mononoke: rebuild test framework 2019-06-25 08:41:31 -07:00
test-pushrebase-file-list.t mononoke: rebuild test framework 2019-06-25 08:41:31 -07:00
test-pushrebase-mutation.t debugmutation: improve format and render successors 2019-09-06 00:42:03 -07:00
test-pushrebase-per-head-config.t mononoke: rebuild test framework 2019-06-25 08:41:31 -07:00
test-pushrebase.t Forbid forced pushrebase where the commit contains mutation markers 2019-09-17 09:09:20 -07:00
test-rechunker.t mononoke: connect stdlog and slog 2019-09-12 04:13:11 -07:00
test-redaction-admin.t mononoke: allow tests to work with multiple mononoke repos 2019-09-23 07:16:15 -07:00
test-redaction-config.t mononoke: connect stdlog and slog 2019-09-12 04:13:11 -07:00
test-redaction.t redaction: rename relevant constants into their desired names 2019-08-20 04:01:00 -07:00
test-rename-in-merge.t mononoke: rebuild test framework 2019-06-25 08:41:31 -07:00
test-server.t mononoke: rebuild test framework 2019-06-25 08:41:31 -07:00
test-sqlblob.t mononoke: allow tests to work with multiple mononoke repos 2019-09-23 07:16:15 -07:00

Mononoke Integration Tests

Mononoke's integration tests run using Mercurial's run-tests test framework, which is orchestrated using a wrapper to make it more friendly to TestPilot and provide some added functionality, such as wiring up dependencies and / or setting up an ephemeral MySQL shard.

TL;DR: Running one test

Use:

buck run scm/mononoke/tests/integration:integration_runner -- TEST

But! Keep reading: there are faster ways to run the tests if you're going to be iterating on something. You might as well read on while you wait for that build to complete.

Running Tests Incrementally: a better way

To run tests locally, a better way is to run the integration runner directly. This allows you to skip most build steps, and rebuild only what you need to re-run your test (e.g. if you're iterating on Mononoke server, then you won't need to rebuild blobimport more than once).

To do this, you should start by building everything once:

buck build scm/mononoke/tests/integration

Then, run the tests by executing the integration runner directly. The integration runner relies on a manifest to find all the binaries it needs to run (the ones you built earlier), so you need to point it there:

~/fbcode/buck-out/dev/gen/scm/mononoke/tests/integration/integration_runner_real.par \
  ~/fbcode/buck-out/gen/scm/mononoke/tests/integration/manifest/manifest.json \
  test1.t test2.t test3.t

If you don't have ~/fbcode symlink, create it, or update the instructions as needed. Note that you can run this from anywhere in fbsource tree (so you can run it from the actual tests directory to get autocompletion or globbing on test names).

Every time you make changes to your code, buck build whatever you changed, then re-run.

Use --interactive when running your tests in order to accept (or reject) changes to your .t files.

Adding new tests:

Add your new test in this directory (or under facebook/) if it's not relevant to open-source.

If your test needs assets to work, then you'll need to:

  • Put the asset somewhere under this directory.
  • In tests, your asset can be found at ${TEST_FIXTURES}/relative/path, where relative/path is the path to your asset relative from .../mononoke/tests/integration.
  • Add your asset to the test_fixtures Buck rule in this directory's TARGETS file. If you don't do this, then running tests using the runner directly will work (read on to understand why), but it won't work when running through Buck / TestPilot.

Exposing a new binary

Add it to MANIFEST_DEPS in the TARGETS file in this directory. The key is an environment variable that will be set to the path to this binary when the tests execute (if you need to customize the environment variable a bit, you can do so in generate_manifest.py).

How it works

To avoid full rebuilds whenever you make a change, the test runner takes a few shortcuts to avoid relying on the Buck dependency graph (that is because Buck doesn't see each individual test's dependencies: it only knows that all the tests depend on everything).

Notably, it:

  • Uses the actual test source files (and assets) from your fbcode working directory when running the runner directly (as documented above). This allows --interactive to work seamlessly.
  • Stores the paths to all its dependencies in a manifest file (which is generated from Buck).

However, when you're running tests using Buck, then the test runner will not use source files, and will instead expect files to be managed using Buck. The main result of this is that while you might have a bunch of files jumbled together in this directory, when running tests using Buck, they will not.

Normally, this should all be transparent if you're adding a new test and using ${TEST_FIXTURES} to reference it.