pcuzner / ansible-runner-service

Python project that wraps the ansible_runner 'engine' inside a RESTful API
Other
16 stars 9 forks source link

Change coverage call #68

Closed pcuzner closed 6 years ago

codecov-io commented 6 years ago

Codecov Report

:exclamation: No coverage uploaded for pull request base (master@9bd062d). Click here to learn what that means. The diff coverage is n/a.

Impacted file tree graph

@@            Coverage Diff            @@
##             master      #68   +/-   ##
=========================================
  Coverage          ?   51.95%           
=========================================
  Files             ?       30           
  Lines             ?     1534           
  Branches          ?        0           
=========================================
  Hits              ?      797           
  Misses            ?      737           
  Partials          ?        0

Continue to review full report at Codecov.

Legend - Click here to learn more Δ = absolute <relative> (impact), ø = not affected, ? = missing data Powered by Codecov. Last update 9bd062d...ee05805. Read the comment docs.

jmolmo commented 6 years ago

It is weird.... i have seen that the code coverage was incremented to 50%: (although i think it should be more than 0%) see: https://codecov.io/gh/pcuzner/ansible-runner-service/commits

Most of the source code files are not affected,however all the tests are covered!! :-O

Investigating and doing changes

jmolmo commented 6 years ago

A suspicion.... I think that the problem is in the way in what testapi* test are being executed. The process created to answer the test request make that "coverage" tools do not be able to trace the code behind these requests. Flask provides a test client that probably doesn't have that problem... i will try to prepare a couple of tests using this approach to see if i'm right.

jmolmo commented 6 years ago

My suspicion is true, I have created an alternative set of tests (test2_*.py) but using the flask test client instead of the test server used in the class "APITestCase". I have implemented a "replica" of the tests in "test_api_login.py" using the flask test client, and now i can see that we are covering the right parts of the code.

I think that this way of implement the functional tests for the API is more easy and straight forward, so if you want i can "translate" all the current "api" tests to the new approach. using the flask test client, neither we need to copy the tests to other folder.

Other possibility is investigate why the "current test server" makes that coverage won't be able to get the data. (probably ... "coverage deems the test server as external service"

Take a look to this PR in my repo: https://github.com/jmolmo/ansible-runner-service/pull/2

And to the coverage results of the commit: https://codecov.io/gh/jmolmo/ansible-runner-service/commit/e1d749d5d5df8b6ce75e4111054c4c8b36a0e626/graphs/sunburst

and especifically over "controller/login.py" https://codecov.io/gh/jmolmo/ansible-runner-service/src/e1d749d5d5df8b6ce75e4111054c4c8b36a0e626/runner_service/controllers/login.py

pcuzner commented 6 years ago

Closing PR - will restructure existing tests to align with Juan'f approach