mirror of
https://github.com/open-policy-agent/opa.git
synced 2026-08-13 03:42:35 -06:00
d2c0459cc4
* test: Parallelize package level tests in high-cost packages. This commit adds `t.Parallel()` calls to the beginning of many tests across several Go packages in OPA. The slowest packages (taking ~10s or more) have been instrumented where possible as a proof-of-concept. On a machine with many cores, the tests now will complete as fast as the slowest test per package, instead of the sum of all the tests in a particular package. * server/server_test: Remove 3x tests from parallel set. This commit fixes a data race that could occur in the `server` package tests, because 3x tests were modifying package variables under `internal/version`. These tests now run sequentially, and are not included in the parallel test set. * plugins/bundle/plugin_test: Remove 2x tests from the parallel set. Two tests in this package modified a package variable directly, and as such cannot be safely run in parallel with each other or any other tests in the package. * topdown/*_test: t.Parallel refactors. This commit wraps up a large batch of fairly mechanical refactorings to add t.Parallel() annotations to almost every test under `topdown`. The tests that could not be safely parallelized now have explicit warning comments on them describing why they are not safe to run in parallel. * storage/disk: t.Parallel refactors. This commit bundles up test parallelization changes for the `storage/disk` package, dramatically reducing its execution time. * topdown/net_test: Remove sub-test parallelization. * rego: t.Parallel refactors. This commit includes a bundle of t.Parallel refactoring changes for the `rego` package, including a timer-related bugfix, and a slight change on a cancellation test to reduce its overall cost during test runs (the logic is preserved, but the mandatory timeouts are lower now). * test: Fixes for sporadic test breakages. --------- Signed-off-by: Philip Conrad <philip@chariot-chaser.net>