-
Notifications
You must be signed in to change notification settings - Fork 15
Mock ansible invocation in unit test #123
Comments
Are tests in ansible_manager_test.go really unit tests and not integrations tests?
What do you think? |
You're right: they are integration tests. The goals of the issue is to move them in the integration test section (maybe we can reword the issue description). Regarding implementation I think @machacekondra can help :) |
Ok so the goal of this issue is to create a new folder test/integration and to move the ansible tests in it, correct? |
The For this issue we should mock ansible invocation and refactor the current unit tests to be "proper" unit test (https://issues.redhat.com/browse/ECOPROJECT-691). We also planned to add e2e CI test but, I think, It can be another issue/PR . |
There is no e2e folder in the device-worker project in the main branch at least and the JIRA ticket has "flotta operator" as component :) |
AFAIK, the e2e test should be part of the operator. The folder
Fixed! Thanks :)
Actual test needs to be part of e2e: I've no good suggestion on the implementation for you but I think they should be part of the operator, so we need to wait for the implementation step (we are still defining the CRDs). IMO, for this specific issue the goal is to mock ansible invocation in the current available tests. This step it's necessary to make unit test independent from the availability of Having said that, if anyone has different opinions on this issue I'd like to hear them! :) |
Yes, integrations tests should be in e2e folder, I agree. But in the device-worker project, such folder does not exists that why I suggested to create one in the project to put the current ansible tests that are integration tests in it. As for mocking the AnsiblePlaybookCmd (as , from my understanding this is the playbookCmd that is used to used to execute the ansible playbook) in the dispatcher I agree that mocking it would be useful Maybe we could discuss this at tomorrow team meeting if that is fine with you and if it fits in the agenda |
At the moment
ansible
must be installed to successfully run unit tests ofpackage ansible
because they rely on real invocations ofansible-playbook
command (viago-ansible
library).Unit-test shouldn't depend on external resources.
We need to mock them or to present an API that will encapsulate the actual call to the external service.
The text was updated successfully, but these errors were encountered: