|
1 | 1 | Testing |
2 | 2 | ======= |
3 | 3 |
|
4 | | -Tests on the puppet-puppet module can be run via `rake`. |
| 4 | +Puppet-puppet is tested via beaker and rspec-puppet. Rspec-puppet tests are run |
| 5 | +automatically for pull requests via travis-ci, or can be triggered manually |
| 6 | +by running `rake spec` after doing a `bundle install`. |
5 | 7 |
|
6 | | -#### Beaker acceptance tests |
7 | | -``` |
8 | | -BEAKER_destroy=no BEAKER_provision=onpass rake acceptance |
| 8 | +Beaker tests are run slightly differently for puppet-puppet than for other |
| 9 | +beaker-tested projects because the test suite should be run independently for |
| 10 | +each test case to prevent contamination between environments. For example, |
| 11 | +running the apache-passenger based puppet master test case will cause obvious |
| 12 | +conflicts if the nginx-unicorn puppet master is subsequently built on the same |
| 13 | +virtual machine. Rspec tags are used to accomplish this in the test cases. |
| 14 | + |
| 15 | +Running beaker tests for unicorn puppetmaster on the default nodeset (debian 7): |
| 16 | +```bash |
| 17 | +rspec . --tag servertype:unicorn --pattern "spec/acceptance/**/*_spec.rb" |
9 | 18 | ``` |
10 | 19 |
|
11 | | -Run beaker acceptance tests on debian 7: |
| 20 | +Same as above, but only only destroying the VM if the build is successful, to |
| 21 | +help troubleshooting: |
12 | 22 | ``` |
13 | | -BEAKER_set=debian-73-x64 BEAKER_destroy=onpass BEAKER_provision=no rake acceptance |
| 23 | +BEAKER_destroy=onpass BEAKER_provision=yes rspec . --tag servertype:unicorn --pattern "spec/acceptance/**/*_spec.rb" |
14 | 24 | ``` |
15 | | -See spec/acceptance/nodesets for a list of possible node names; use the filename without .yml. |
| 25 | + |
| 26 | +Same as above, but on a different nodeset (see `spec/acceptance/nodesets` for |
| 27 | +options): |
| 28 | +```bash |
| 29 | +BEAKER_set=sles-11sp1-x64 BEAKER_destroy=onpass BEAKER_provision=yes rspec . --tag servertype:unicorn --pattern "spec/acceptance/**/*_spec.rb" |
| 30 | +``` |
| 31 | + |
| 32 | +The presence of an OS/distro in the nodeset list does not imply support. The |
| 33 | +SLES example above is expected to fail most test cases but is included to lower |
| 34 | +the bar for future contributors who want to add support for additional distros. |
| 35 | + |
| 36 | +The rake command includes acceptance testing tasks, but these should not be |
| 37 | +used because they will run all of the acceptance tests on the same VM, which |
| 38 | +is expected to fail. |
16 | 39 |
|
17 | 40 | If a beaker test fails, you can SSH into the environment if you use BEAKER_PROVISION=onpass. |
18 | 41 | The path of the vagrantfile will be `.vagrant/beaker_vagrant_files/debian-73-x64.yml` |
19 | 42 | if you followed the above instructions, and slightly different if you used a |
20 | 43 | different nodeset. `cd` to that directory and `vagrant ssh` to access the VM. |
21 | 44 | The tests that ran are in /tmp with randomly generated filenames. |
22 | | -``` |
23 | 45 |
|
24 | 46 | #### rspec-puppet tests |
25 | 47 | (note that these are run automatically by travis CI on pull requests) |
|
0 commit comments