nickjj / rolespec

A test library for testing Ansible roles
GNU General Public License v3.0
232 stars 17 forks source link

Addition of ROLESPEC_ANSIBLE_OPTS variable and bugfix for test names #3

Closed asmartin closed 10 years ago

asmartin commented 10 years ago

Hello,

This pull request makes the following changes:

Thanks,

Andrew

nickjj commented 10 years ago

@asmartin, you should be able to add options to ansible-playbook already. For example: assert_playbook_runs -t foo. That happily passes along any arguments to ansible-playbook.

Can you provide me with a full example of the second issue? Exact role names and a sample test script if needed, also how you're running it would be a plus too. Thanks.

asmartin commented 10 years ago

Thanks, I did not know about that functionality with assert_playbook_runs.

Regarding the multiple tests issue, I have my tests structured like this:

rootdir/
         roles/ - all roles inside of here
         tests/ - all tests inside of here

I then run rolespec -r <role> from within the rootdir. I have several different roles for nginx:

Thus if I want to create a test for the nginx role, the grep change in 97cd2d0 prevents it from matching nginx, nginx-php, and nginx-ssl when running rolespec. Without this change, I get this error:

# rolespec -r nginx
Test script not found:
/root/tests/nginx
nginx-php
nginx-ssl/test
nickjj commented 10 years ago

Hmm, interesting. We have a few roles with a similar naming convention in DebOps and I haven't ran into that issue.

Can you submit a new PR with just the regex fix? Going to close this one, and I'll merge in your upcoming PR. Thanks for fixing it.

asmartin commented 10 years ago

Done: https://github.com/nickjj/rolespec/pull/5