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

pip install testinfra #4

Closed
nickjj opened this issue Oct 19, 2018 · 8 comments
Closed

pip install testinfra #4

nickjj opened this issue Oct 19, 2018 · 8 comments

Comments

@nickjj
Copy link

nickjj commented Oct 19, 2018

I'd like to be able to run TestInfra tests inside of your Docker test shim to test roles but that would require TestInfra to be installed in this image.

I've done some local tests and this approach is so much faster than Molecule (20 seconds to molecule verify vs 5 seconds by running testinfra directly). I also have some tricks up my sleeve to turn that 5 seconds to half a second for a lot of tests.

If you agree with this, please make the change to all of your base Docker images!

@geerlingguy
Copy link
Owner

@nickjj - I'm a bit mixed on this:

  • These images are meant to have ansible... and maybe some related dependencies like python; but they're not used explicitly/only for testing Ansible roles (I use them in a lot of different scenarios).
  • If I make the change here I would want to change it across all my 8+ OS images, so I would need to do it across the board (not a big deal though).
  • In the spirit of keeping things as trim and Docker-y as possible, I'd rather have a ubuntu1804-ansible-testing image maybe instead, which would build on top of this image and have molecule, testinfra, ansible-lint, etc. (any testing-related stuff) on top of it.

But then again, that would be two sets of projects to maintain.

Another option: each of these images could have a latest tag, and a testing tag, or something like that. That might be way easier to maintain, since it could be one project per OS, with multiple tags managed on Docker Hub via branches on GitHub.

@nickjj
Copy link
Author

nickjj commented Oct 19, 2018

I like the idea of having a testing tag. Should we start with testinfra, yamllint, ansible-lint and flake8, or do you feel molecule is important to have too?

@geerlingguy
Copy link
Owner

@nickjj - Molecule will be more and more important, especially for role testing since it will be adopted as an official Ansible project, so I'd definitely want it in there :)

@nickjj
Copy link
Author

nickjj commented Oct 20, 2018

Yep, but I don't think I'll be using it. It's waaaaaay too slow on a Windows / WSL / Docker box. Luckily your base Docker image, test shim and about 50 lines of Bash was enough to put together a proof of concept CLI that is up to 40x faster than Molecule for testing with testinfra.

Anyways, happy to see you're opening to doing something like the testing tags.

Do you want me to send a PR for the ubuntu 18/16 + debian 9/8 images?

@geerlingguy
Copy link
Owner

I got a working build on Docker Hub: https://hub.docker.com/r/geerlingguy/docker-ubuntu1804-ansible/tags/

Can you see if that branch works for you?

@geerlingguy
Copy link
Owner

@nickjj ^^ forgot to add a mention :)

@nickjj
Copy link
Author

nickjj commented Oct 20, 2018

Yep it works (all of the binaries are accessible), but I might end up forking it still to remove Molecule.

@geerlingguy
Copy link
Owner

Sounds good! Closing this issue, will clone it over into the other repos.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants