-
Notifications
You must be signed in to change notification settings - Fork 566
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Run all non-k8s go tests with bazel (#9626)
This runs all of the Go non-k8s tests with Bazel. Our whole test suite runs in 5 minutes now, and faster if you didn't edit something that makes a lot of tests run. (Pretty much every test depends on everything, though, because of how realenv works.) If you run the tests, notice a test fail, and fix the test, it should be less than two minutes to get CI green now. Everything is now hermetic; tests that depend on `match` and `pachctl` get a binary injected into the test runfiles and the tests use that. You don't need to "go install" either of those while running the test suite locally. I fixed a bug where `pachctl diff file` hangs forever if `less` is not installed. It happens to not be installed in the CI image, and so I fixed that bug. (If $PAGER can't run, then we just fall back to io.Copy.) I dramatically sped up the tests by running the postgres container with fsync off. With it on, tests running in parallel take more than a minute to create test database. With it off, it takes a few hundred milliseconds. This allows all the tests to run in parallel on a 32 core machine in less than 5 minutes. (Previously, 20 minutes * 6 machines.) There are two configurations being added here; one Docker-based CI run for most of the tests, and then a machine-based run for the fuse tests, which require privileges not available on CircleCI's docker instances. Both test runners run under Docker, however, so changing the `/etc/ci-image` image will affect both tests in the same way. I noticed a lot of contention for creating the Postgres database container at the start of testing, so I split that code out into a separate binary, `//src/testing/cmd/dockertestenv`, so that can run contention-free. This greatly improves the reliability of the tests; in my various runs I haven't seen any flakes. I did some test refactoring to split unrelated tests into separate test files, so that gazelle can generate separate test targets for each, and they can run in parallel. I've also added some `shard_count` to larger test packages so that tests inside the suite can run in parallel. This mostly affects reruns during flakes; only 1/shard_count tests need to be rerun. I'm targeting each test running in about 60 seconds. There are some tests that can't be parallelized; mostly src/server/pfs/fuse, because of the design of the mount server. We need to go fix those. I have tested this on Linux and ARM64 Mac OS. On OS X, all the tests pass now, but not necessarily the first time with a "go test ..." invocation. Too CPU constrained; things time out if they run on the efficiency cores, I think. I think everyone has a faster Mac than my first-gen M1, though, so they probably won't have any problems. Because of test caching, the second Bazel invocation gets the stragglers. (We probably want `--local_test_jobs=4` on that machine. Haven't tried yet.) One thing that's missing is sending test results to our Pachyderm instance. There is some Bazel flag I need to get it to download the test XML results for cached tests so they can be analyzed on the CI machine and sent away. We might not need the analysis anymore, though... buildbuddy tracks test time and flakiness for us. Test coverage still works; there are some missing lines in the coverage report below because `pachctl`-only code doesn't get covered (never did, but we should do it!), and we don't run `dockertestenv` code during the tests very much anymore (because it runs in the cmd before the tests, and that's not contributing to coverage). Notes to reviewers: @pachyderm/pfs I split up some of your tests into multiple files. @pachyderm/int Not sure why you're required for this review ;) @djanicekpach Let me know which stuff in the commented-out test-go you want me to preserve in addition to what's here now. Part of CORE-2080
- Loading branch information
Showing
124 changed files
with
1,052 additions
and
523 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.