-
Notifications
You must be signed in to change notification settings - Fork 25
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #10 from adamcrews/tests
Add spec tests and some minor cleanup
- Loading branch information
Showing
48 changed files
with
1,587 additions
and
182 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
fixtures: | ||
forge_modules: | ||
stdlib: | ||
repo: 'puppetlabs/stdlib' | ||
ref: '4.5.1' | ||
symlinks: | ||
loggly: "#{source_dir}" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
.*.sw? | ||
pkg | ||
spec/fixtures | ||
.rspec_system | ||
.vagrant | ||
.bundle | ||
vendor |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,2 @@ | ||
--format documentation | ||
--color |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,37 @@ | ||
--- | ||
language: ruby | ||
bundler_args: --without development system_tests | ||
before_install: rm Gemfile.lock || true | ||
rvm: | ||
- 1.9.3 | ||
- 2.0.0 | ||
- 2.1.0 | ||
script: bundle exec rake test | ||
env: | ||
- PUPPET_VERSION="~> 3.2.0" | ||
- PUPPET_VERSION="~> 3.3.0" | ||
- PUPPET_VERSION="~> 3.4.0" | ||
- PUPPET_VERSION="~> 3.5.0" STRICT_VARIABLES=yes | ||
- PUPPET_VERSION="~> 3.6.0" STRICT_VARIABLES=yes | ||
- PUPPET_VERSION="~> 3.7.0" STRICT_VARIABLES=yes | ||
- PUPPET_VERSION="~> 3.7.0" STRICT_VARIABLES=yes FUTURE_PARSER=yes | ||
- PUPPET_VERSION="~> 4.0.0" STRICT_VARIABLES=yes | ||
matrix: | ||
exclude: | ||
# Ruby 1.9.3 | ||
- rvm: 1.9.3 | ||
env: PUPPET_VERSION="~> 2.7.0" | ||
|
||
# Ruby 2.0.0 | ||
- rvm: 2.0.0 | ||
env: PUPPET_VERSION="~> 2.7.0" | ||
|
||
# Ruby 2.1.0 | ||
- rvm: 2.1.0 | ||
env: PUPPET_VERSION="~> 2.7.0" | ||
- rvm: 2.1.0 | ||
env: PUPPET_VERSION="~> 3.2.0" | ||
- rvm: 2.1.0 | ||
env: PUPPET_VERSION="~> 3.3.0" | ||
- rvm: 2.1.0 | ||
env: PUPPET_VERSION="~> 3.4.0" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
YYYY-MM-DD Release 0.1.0 | ||
- something you did | ||
- something else you did |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,92 @@ | ||
This module has grown over time based on a range of contributions from | ||
people using it. If you follow these contributing guidelines your patch | ||
will likely make it into a release a little quicker. | ||
|
||
|
||
## Contributing | ||
|
||
1. Fork the repo. | ||
|
||
2. Run the tests. We only take pull requests with passing tests, and | ||
it's great to know that you have a clean slate. | ||
|
||
3. Add a test for your change. Only refactoring and documentation | ||
changes require no new tests. If you are adding functionality | ||
or fixing a bug, please add a test. | ||
|
||
4. Make the test pass. | ||
|
||
5. Push to your fork and submit a pull request. | ||
|
||
|
||
## Dependencies | ||
|
||
The testing and development tools have a bunch of dependencies, | ||
all managed by [Bundler](http://bundler.io/) according to the | ||
[Puppet support matrix](http://docs.puppetlabs.com/guides/platforms.html#ruby-versions). | ||
|
||
By default the tests use a baseline version of Puppet. | ||
|
||
If you have Ruby 2.x or want a specific version of Puppet, | ||
you must set an environment variable such as: | ||
|
||
export PUPPET_VERSION="~> 3.2.0" | ||
|
||
Install the dependencies like so... | ||
|
||
bundle install | ||
|
||
## Syntax and style | ||
|
||
The test suite will run [Puppet Lint](http://puppet-lint.com/) and | ||
[Puppet Syntax](https://github.com/gds-operations/puppet-syntax) to | ||
check various syntax and style things. You can run these locally with: | ||
|
||
bundle exec rake lint | ||
bundle exec rake syntax | ||
|
||
## Running the unit tests | ||
|
||
The unit test suite covers most of the code, as mentioned above please | ||
add tests if you're adding new functionality. If you've not used | ||
[rspec-puppet](http://rspec-puppet.com/) before then feel free to ask | ||
about how best to test your new feature. Running the test suite is done | ||
with: | ||
|
||
bundle exec rake spec | ||
|
||
Note also you can run the syntax, style and unit tests in one go with: | ||
|
||
bundle exec rake test | ||
|
||
### Automatically run the tests | ||
|
||
During development of your puppet module you might want to run your unit | ||
tests a couple of times. You can use the following command to automate | ||
running the unit tests on every change made in the manifests folder. | ||
|
||
bundle exec guard | ||
|
||
## Integration tests | ||
|
||
The unit tests just check the code runs, not that it does exactly what | ||
we want on a real machine. For that we're using | ||
[Beaker](https://github.com/puppetlabs/beaker). | ||
|
||
Beaker fires up a new virtual machine (using Vagrant) and runs a series of | ||
simple tests against it after applying the module. You can run our | ||
Beaker tests with: | ||
|
||
bundle exec rake acceptance | ||
|
||
This will use the host described in `spec/acceptance/nodeset/default.yml` | ||
by default. To run against another host, set the `BEAKER_set` environment | ||
variable to the name of a host described by a `.yml` file in the | ||
`nodeset` directory. For example, to run against CentOS 6.4: | ||
|
||
BEAKER_set=centos-64-x64 bundle exec rake acceptance | ||
|
||
If you don't want to have to recreate the virtual machine every time you | ||
can use `BEAKER_destroy=no` and `BEAKER_provision=no`. On the first run you will | ||
at least need `BEAKER_provision` set to yes (the default). The Vagrantfile | ||
for the created virtual machines will be in `.vagrant/beaker_vagrant_files`. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
Adam Crews | ||
Jason Skowronski | ||
Joey Moe | ||
Jon Fautley | ||
Jonathan Niesen | ||
Michael Blume | ||
Q | ||
Ryan Coleman | ||
jasons-loggly | ||
maxgutman | ||
psquickitjayant |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,24 @@ | ||
source "https://rubygems.org" | ||
|
||
group :test do | ||
gem "rake" | ||
gem "puppet", ENV['PUPPET_VERSION'] || '~> 3.7.0' | ||
gem "rspec", '< 3.2.0' | ||
gem "rspec-puppet", :git => 'https://github.com/rodjek/rspec-puppet.git' | ||
gem "puppetlabs_spec_helper" | ||
gem "metadata-json-lint" | ||
gem "rspec-puppet-facts" | ||
end | ||
|
||
group :development do | ||
gem "travis" | ||
gem "travis-lint" | ||
gem "vagrant-wrapper" | ||
gem "puppet-blacksmith" | ||
gem "guard-rake" | ||
end | ||
|
||
group :system_tests do | ||
gem "beaker" | ||
gem "beaker-rspec" | ||
end |
Oops, something went wrong.