---
# System prepended metadata

title: Functional Tests within pulp_ansible

---

# Functional Tests within pulp_ansible

* Where do tests live?
* What types of tests do we have?
* how do you run the tests
* Look at some tests
    * CLI tests
    * Asserting correctness around syncing from galaxy.ansible.com and cloud.redhat.com
    * Galaxy V2 and V3 API tests (pulp_ansible implementation)


## Where do tests live?

https://github.com/pulp/pulp_ansible/tree/master/pulp_ansible/tests

* functional - API, CLI
* unit - we have almost 0 unit tests
* performance - tooling for scale testing
* upgrade


## Running Tests in CI

https://github.com/pulp/pulp_ansible/actions
https://github.com/pulp/pulp_ansible/runs/2948470456?check_suite_focus=true#step:11:730
https://github.com/pulp/pulp_ansible/actions/runs/950846204


## When are tests run

* At pre-merge time
* Nightly
* For every release


## Tests use bindings, build + install bindings

https://github.com/pulp/pulp_ansible/blob/ca0c6080e1072718d23d39eab66b7b708863d2e2/pulp_ansible/tests/upgrade/pre/test_collection_install.py#L7

`pbindings pulp_ansible python`



## Running Tests Locally

Install the bindings
Install the requirements https://github.com/pulp/pulp_ansible/blob/master/test_requirements.txt

`pytest -v -r sx --color=yes --pyargs pulp_ansible.tests.functional -x`


## CLI tests

https://github.com/pulp/pulp_ansible/tree/master/pulp_ansible/tests/functional/cli


## Tests Syncing galaxy.ansible.com (V2)

https://github.com/pulp/pulp_ansible/tree/master/pulp_ansible/tests/functional/api/collection/v2


## Tests Syncing cloud.redhat.com (V3)

https://github.com/pulp/pulp_ansible/blob/master/pulp_ansible/tests/functional/api/collection/v3/test_sync.py#L161-L197
https://github.com/pulp/pulp_ansible/blob/master/pulp_ansible/tests/functional/api/collection/v3/test_sync.py#L200-L285


## Tests asserting correctness for Pulp's implementation of the Galaxy V2 API

https://github.com/pulp/pulp_ansible/blob/master/pulp_ansible/tests/functional/api/collection/v2/test_sync.py


## Tests asserting correctness for Pulp's implementation of the Galaxy V3 API

https://github.com/pulp/pulp_ansible/blob/master/pulp_ansible/tests/functional/api/collection/v3/test_sync.py
