Open hyperfocus1338 opened 9 years ago
For now Rolespec expects that you setup a separate repository which contain the tests for 1 or more roles. You can name it whatever you want, but test-suite
seemed like a reasonable way to describe it.
You can view a test suite that has over 60 Rolespec driven tests here to see how to configure it: https://github.com/debops/test-suite
That concept is covered briefly in the readme here: https://github.com/nickjj/rolespec/#ways-to-organize-your-tests
In the future there may be a second option which allows you to put your tests inside of your role but atm you can't do that.
As for authentication on private repos, if travis can reach the repo then rolespec should have no problem working because the travis script is what kicks everything off.
Lastly you can remove this line from your test script . "${ROLESPEC_TEST}/../defaults.conf"
. The defaults.conf
file is something custom to DebOps' test-suite, it contains stuff that we wanted all role tests to be able to access to without modifying Rolespec because a lot of it is specific to DebOps only.
You should also remove ansible_plugins
because that is part of what defaults.conf
supplies.
You can check what's natively supplied by Rolespec by looking at its API docs here: https://github.com/nickjj/rolespec/#test-api
+1 for test inside the role support. Another issue which would help with private repositories is to officially support multiple playbooks in 1 repository. It doesn't make much sense to keep every playbook in a separate repository when you are on the paid tier of GitHub ;).
I imagine you would be able to set a variable in your test which would indicate where the playbook is located inside the repository.
What kind of URL should I place in the installation script? Can't get it to work in this part:
When I analyze the following debops Travis run: https://travis-ci.org/debops/ansible-role-ansible
I see that it uses the whole repository:
But before that it clones the repository with the playbook:
git://github.com/debops/ansible-role-ansible.git
which is not mentioned in the install file.However my playbook is build up in this format (the format Ansible recommends), I don't know how to make a 'test suite' of this.
What would be the best way to build a test suite with a complete playbook build up from the above format?
I have made a test file which looks like this:
Tried serveral things but I can't make it run due to several errors:
Basically I have two issues:
I'm not sure if the way my playbook is build up is correct for using Rolespec, and I'm not sure if I can use it with private github/travis and if I need extra settings to make it work.
How should I authenticate using rolespec? Can I use this in the installation?
http://docs.travis-ci.com/user/private-dependencies/