Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add docs for setting up ansible-test #83034

Open
1 task done
TheFriendlyCoder opened this issue Apr 14, 2024 · 1 comment
Open
1 task done

Add docs for setting up ansible-test #83034

TheFriendlyCoder opened this issue Apr 14, 2024 · 1 comment
Labels
affects_2.16 docs This issue/PR relates to or includes documentation. P3 Priority 3 - Approved, No Time Limitation

Comments

@TheFriendlyCoder
Copy link

Summary

The current docs that describe how to use ansible-test for unit testing collections, assumes that the user will/can use Docker for delegating the test behaviour to. This can not always be done (ie: in the case of a limited build environment without direct access to a Docker daemon). Further, it is not clear from the docs how to set up your build environment to work WITHOUT Docker. For example, when I ran ansible-test for the first time on a simple hello-world collection I created, I first got errors complaining about pytest package being missing. Then, after installing that package, I ended up with a cryptic error which looked like this:

ERROR: usage: __main__.py [options] [file_or_dir] [file_or_dir] [...]
__main__.py: error: unrecognized arguments: -n tests/unit/plugins/action/test_thing.py
  inifile: /Users/myname/src/ansible/ansible_collections/local/fubar/venv/lib/python3.12/site-packages/ansible_test/_data/pytest/config/default.ini
  rootdir: /Users/myname/src/ansible/ansible_collections/local/fubar

FATAL: Command "pytest -r a -n auto --color yes -p no:cacheprovider -c /Users/myname/src/ansible/ansible_collections/local/fubar/venv/lib/python3.12/site-packages/ansible_test/_data/pytest/config/default.ini --junit-xml /Users/myname/src/ansible/ansible_collections/local/fubar/tests/output/junit/python3.12-controller-units.xml --strict-markers --rootdir /Users/myname/src/ansible/ansible_collections/local/fubar --confcutdir /Users/myname/src/ansible/ansible_collections/local/fubar -vvv tests/unit/plugins/action/test_thing.py" returned exit status 4.

this error didn't provide sufficient information for me to deduce how to proceed next. After I did some considerable digging was able to discover that I needed several additional Python packages installed (ie: pytest-xdist and pytest-mock) to get the simple test suite working. It would have saved me considerable time and effort if this information was just provided in the docs somewhere.

Issue Type

Documentation Report

Component Name

ansible-test

Ansible Version

ansible [core 2.16.5]

Configuration

na

OS / Environment

na

Additional Information

na

Code of Conduct

  • I agree to follow the Ansible Code of Conduct
@ansibot
Copy link
Contributor

ansibot commented Apr 14, 2024

Files identified in the description:

If these files are incorrect, please update the component name section of the description or use the component bot command.

@ansibot ansibot added needs_triage Needs a first human triage before being processed. affects_2.16 labels Apr 14, 2024
@Akasurde Akasurde added docs This issue/PR relates to or includes documentation. P3 Priority 3 - Approved, No Time Limitation and removed needs_triage Needs a first human triage before being processed. labels Apr 16, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
affects_2.16 docs This issue/PR relates to or includes documentation. P3 Priority 3 - Approved, No Time Limitation
Projects
None yet
Development

No branches or pull requests

3 participants