Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Improve code coverage generation in API and CLI tests #2016

Closed
acelaya opened this issue Feb 20, 2024 · 0 comments · Fixed by #2017
Closed

Improve code coverage generation in API and CLI tests #2016

acelaya opened this issue Feb 20, 2024 · 0 comments · Fixed by #2017
Milestone

Comments

@acelaya
Copy link
Member

acelaya commented Feb 20, 2024

Code coverage in these tests is generated manually, since the code under test is run in a different process than PHPUnit itself.

For API tests it's not too bad, as the whole server runs in one process, dumping coverage at the end.

However, it requires running tests with just one web worker, and code executed in job workers, is not considered covered.

For CLI tests, the problem is slightly different. In those, every test spins a new process to run a specific command.

That means every command needs to read the coverage generated so far, merge it to the one generated during that command, and persist it for the next command.

That has a big performance impact, and has the implication that commands cannot be run in parallel.

Both problems could be solved by letting every process generate its own coverage report in PHP format, in isolation, whether it is a command, a web worker or a job worker.

Then, if all tests pass, we separately merge all reports, generating the final one in the requested format.

@acelaya acelaya added this to the 4.0.0 milestone Feb 20, 2024
@acelaya acelaya moved this to Todo in Shlink Feb 20, 2024
@acelaya acelaya moved this from Todo to In Progress in Shlink Feb 20, 2024
@acelaya acelaya moved this from In Progress to In review in Shlink Feb 20, 2024
@github-project-automation github-project-automation bot moved this from In review to Done in Shlink Feb 20, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
Archived in project
Development

Successfully merging a pull request may close this issue.

1 participant