Page MenuHomePhabricator

Investigate Code Coverage with tests for all the code
Closed, ResolvedPublic

Description

There are still some areas of code that weren't covered.
As a first step we could investigate these areas and then by investigation result, start working on tests to cover it.

Event Timeline

roman-stolar raised the priority of this task from Medium to High.Aug 17 2022, 12:18 PM
roman-stolar moved this task from Backlog to To Do on the Thumbor Migration board.
roman-stolar raised the priority of this task from High to Needs Triage.Aug 17 2022, 12:24 PM

@pwangai and I have been reviewing the code coverage. We found we could run coverage run -m pytest || coverage html where you can see line-by-line code coverage.

The areas we seem to be missing code coverage:

  • PoolCounter (https://wikitech.wikimedia.org/wiki/Thumbor#Poolcounter-based; code wikimedia_thumbor/poolcounter/__init__.py)
  • Swift (code wikimedia_thumbor/loader/swift/__init__.py, wikimedia_thumbor/result_storage/swift/swift.py)
  • Error/exception handling
  • Several files in wikimedia_thumbor/logging/
  • Several files in wikimedia_thumbor/error_handlers/
  • wikimedia_thumbor/storage/request/request.py (not sure what this does)
  • wikimedia_thumbor/core/importer.py (not sure what this does)
  • wikimedia_thumbor/core/context_importer.py (not sure what this does)

Testing PoolCounter and Swift might not be possible without getting these services running locally. This might be hard, particularly with Swift.

Change 833426 had a related patch set uploaded (by Vlad.shapik; author: Vlad.shapik):

[operations/software/thumbor-plugins@master] Add configurations to get an HTML test coverage report

https://gerrit.wikimedia.org/r/833426

@pwangai and I have been reviewing the code coverage. We found we could run coverage run -m pytest || coverage html where you can see line-by-line code coverage.

The areas we seem to be missing code coverage:

  • PoolCounter (https://wikitech.wikimedia.org/wiki/Thumbor#Poolcounter-based; code wikimedia_thumbor/poolcounter/__init__.py)
  • Swift (code wikimedia_thumbor/loader/swift/__init__.py, wikimedia_thumbor/result_storage/swift/swift.py)
  • Error/exception handling
  • Several files in wikimedia_thumbor/logging/
  • Several files in wikimedia_thumbor/error_handlers/
  • wikimedia_thumbor/storage/request/request.py (not sure what this does)
  • wikimedia_thumbor/core/importer.py (not sure what this does)
  • wikimedia_thumbor/core/context_importer.py (not sure what this does)

Testing PoolCounter and Swift might not be possible without getting these services running locally. This might be hard, particularly with Swift.

Thanks @dom_walden and @pwangai for your research.
In addition, I want to say that 75% of the code is covered by tests. Since the building of a Docker image is based on Blubber, now it works a bit different than before. That's why I updated the instruction which helps to run checking of code coverage. Here is the patch.

Change 833426 merged by jenkins-bot:

[operations/software/thumbor-plugins@master] Update the logic to run code coverage

https://gerrit.wikimedia.org/r/833426