Closed sunilk747 closed 6 years ago
@tisnik - I figured out that importing pycrypto indirectly via conftest.py results in failure since gcc is needed to build pycrypto and we do not have one in runtests.sh. Can you tell me why is the code coverage not measured for other tests if rest_api is written differently? And can you please help here based on your experience with previous repos? I will revert the commits since then.
And we are back to normal. @tisnik it will be really helpful if you could provide some insights into this test cases failure. cc @sunilk747
Separate API endpont for license service with auth implementation.
If the intention is to make this service publicly available for OSIO users, and thus authentication is required, then I agree with @humaton that we should move the auth code to a common library and use the library in both API server and here. Authentication is a sensitive business and there is no room for mistakes. Better keep the code in one place.
Sure @miteshvp.
If use the flask client in test_rest_api.py, then all the code (tests+license analysis sources) are actually run in one Python virtual machine. It means that:
1) pycov is able to check what statements are 'hits' by tests 2) we can use mocks where appropriate 3) all exceptions etc. are displayed on CI and usually catch by tests as well (no false positives)
In the second approach, ie. when the service runs separately, the coverage is not measured at all and mocks wont work.
But actually I see your point: you want to test the service as is (ie as black box). This makes perfect sense, but please let's do it differently. Let's create new script called run_integration_tests.sh
that will run only selected (properly tagged) tests that really check the REST API. You can then copy your variant of test_rest_api.py
into new module and call the API, check the response
object etc. etc.
I'll gladly help you with that setup. WDYT?
@tisnik - Thanks for the detailed explanation. It was really useful. And I totally like your idea of separating unit-tests with integration-tests. @sunilk747 can you please take this forward.
[test]
@sara-02 could you please copy&paste log here? @all do we really going to support Python 2?
Any idea why that can be so?
I don't think making it Python 2 compatible is worth the effort ;-) https://pythonclock.org
@tisnik we are fixing this in #83 . Please wait for few minutes. We are very close as it seems :)
This issue is not related to Py-2, Py-3.
Please check #83
@sunilk747 Your image is available in the registry: docker pull registry.devshift.net/fabric8-analytics/license-analysis:SNAPSHOT-PR-80
@sunilk747 Your image is available in the registry: docker pull registry.devshift.net/fabric8-analytics/license-analysis:SNAPSHOT-PR-80
@sunilk747 Your image is available in the registry: docker pull registry.devshift.net/fabric8-analytics/license-analysis:SNAPSHOT-PR-80
@ravsa this should not be merged:
1) @humaton requested changes 2) there are no tests for the new code (and the code coverage drops far below the threshold!!!) 3) there are no documentation
2+3 -> this PR won't pass DoD
Thanks Pavel for your comments, btw, what is DoD? @sunilk747 - Please make sure that we include tests for the new functionality and improve on the test coverage. @humaton - I see you created https://github.com/openshiftio/openshift.io/issues/2676. I will ask Sunil to create a new PR to accommodate common library changes. If you're ok, and once we increase the test coverage, we can let it merge. WDYT?
@miteshvp Definition of Done: https://docs.google.com/document/d/1S5Z7tPZutOTJEKyYuJCRcKgFkrK2l5mG0HSghTV_ZlY/edit?usp=sharing
this is the 1st version, so please make changes or suggestions to this document
Separate API endpont for license service with auth implementation.