rspec-openapi
rspec-openapi copied to clipboard
Support Minitest's parallel execution
This morning, We encountered a strange issue when integrating this gem with our Minitest test suite. Sometimes, the OpenAPI schema was generated, sometimes not. In the end, we discovered that no schema was generated when running all tests simultaneously, but it worked fine when only running a specific controller test.
Rails offers a helper named "parallelize" to run multiple tests simultaneously. However, this only comes into effect when running a more considerable amount of tests. Single tests are still executed in one process.
My assumption right now, which explains the phenomenon explained earlier, is when Rails starts parallelizing the tests, each process has its copy of RSpec::OpenAPI.path_records
. The primary process does not execute any tests, and therefore, its version of the path records remains empty, and no OpenAPI schema is generated.
Parallel test execution is a native feature of Minitest. It would be nice if RSpec OpenAPI could support it.
I will not work on this since I do not use minitest. PR welcome.