-
Notifications
You must be signed in to change notification settings - Fork 39
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 #30 from ehelms/refs-6736
Refs #6736: Updates to standard layout and basic test.
- Loading branch information
Showing
14 changed files
with
295 additions
and
18 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: | ||
repositories: | ||
stdlib: "git://github.com/puppetlabs/puppetlabs-stdlib.git" | ||
foreman: "git://github.com/theforeman/puppet-foreman.git" | ||
common: "git://github.com/katello/puppet-common.git" | ||
symlinks: | ||
certs: "#{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 |
---|---|---|
@@ -1,8 +1,6 @@ | ||
.vagrant | ||
*.swp | ||
*.swo | ||
*.swm | ||
*.swn | ||
|
||
.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 |
---|---|---|
@@ -1,5 +1,31 @@ | ||
--- | ||
language: ruby | ||
bundler_args: --without development | ||
before_install: rm Gemfile.lock || true | ||
rvm: | ||
- 1.8.7 | ||
- 1.9.3 | ||
script: | ||
- rake lint | ||
- 2.0.0 | ||
- 2.1.0 | ||
script: bundle exec rake test | ||
env: | ||
- PUPPET_VERSION="~> 2.7.0" | ||
- PUPPET_VERSION="~> 3.2.0" | ||
- PUPPET_VERSION="~> 3.3.0" | ||
- PUPPET_VERSION="~> 3.4.0" | ||
- PUPPET_VERSION="~> 3.5.0" | ||
- PUPPET_VERSION="~> 3.6.0" | ||
matrix: | ||
exclude: | ||
- rvm: 1.9.3 | ||
env: PUPPET_VERSION="~> 2.7.0" | ||
- rvm: 2.0.0 | ||
env: PUPPET_VERSION="~> 2.7.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 @@ | ||
2014-07-27 Release 0.1.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,87 @@ | ||
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. Open an issue here - http://projects.theforeman.org/projects/katello/issues/new | ||
|
||
6. Ensure commit message begins with 'Fixes #<redmine_issue_number>' | ||
|
||
5. Push to your fork andaa 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 | ||
|
||
## 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). | ||
|
||
This fires up a new virtual machine (using vagrant) and runs a series of | ||
simple tests against it after applying the module. You can run this | ||
with: | ||
|
||
bundle exec rake acceptance | ||
|
||
This will run the tests on an Ubuntu 12.04 virtual machine. You can also | ||
run the integration tests against Centos 6.5 with. | ||
|
||
RS_SET=centos-64-x64 bundle exec rake acceptances | ||
|
||
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_fies`. | ||
|
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 @@ | ||
Ivan Necas @iNecas | ||
Eric D Helms @ehelms | ||
Justin Sherrill @jlsherrill | ||
Dustin Tsang @dustint-rh | ||
Jason Montleon @jmontleon | ||
Alex Wood @awood | ||
Og Maciel @omaciel |
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 |
---|---|---|
@@ -1,11 +1,20 @@ | ||
source 'https://rubygems.org' | ||
source "https://rubygems.org" | ||
|
||
if ENV.key?('PUPPET_VERSION') | ||
puppetversion = "~> #{ENV['PUPPET_VERSION']}" | ||
else | ||
puppetversion = ['>= 2.6'] | ||
group :test do | ||
gem "rake" | ||
gem "puppet", ENV['PUPPET_VERSION'] || '~> 3.4.0' | ||
gem "puppet-lint" | ||
gem "rspec-puppet", :git => 'https://github.com/rodjek/rspec-puppet.git' | ||
gem "puppet-syntax" | ||
gem "puppetlabs_spec_helper" | ||
end | ||
|
||
gem 'rake' | ||
gem 'puppet', puppetversion | ||
gem 'puppet-lint', '~> 0.3.2' | ||
group :development do | ||
gem "travis" | ||
gem "travis-lint" | ||
gem "beaker" | ||
gem "beaker-rspec" | ||
gem "vagrant-wrapper" | ||
gem "puppet-blacksmith" | ||
gem "guard-rake" | ||
end |
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
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 |
---|---|---|
@@ -1,9 +1,44 @@ | ||
require 'puppetlabs_spec_helper/rake_tasks' | ||
require 'puppet-lint/tasks/puppet-lint' | ||
require 'puppet-syntax/tasks/puppet-syntax' | ||
|
||
# These two gems aren't always present, for instance | ||
# on Travis with --without development | ||
begin | ||
require 'puppet_blacksmith/rake_tasks' | ||
rescue LoadError | ||
end | ||
|
||
PuppetLint.configuration.log_format = '%{path}:%{linenumber}:%{KIND}: %{message}' | ||
PuppetLint.configuration.fail_on_warnings = true | ||
PuppetLint.configuration.send("disable_class_inherits_from_params_class") | ||
PuppetLint.configuration.send("disable_80chars") | ||
PuppetLint.configuration.log_format = "%{path}:%{linenumber}:%{check}:%{KIND}:%{message}" | ||
PuppetLint.configuration.fail_on_warnings = true | ||
|
||
# Forsake support for Puppet 2.6.2 for the benefit of cleaner code. | ||
# http://puppet-lint.com/checks/class_parameter_defaults/ | ||
PuppetLint.configuration.send('disable_class_parameter_defaults') | ||
# http://puppet-lint.com/checks/class_inherits_from_params_class/ | ||
PuppetLint.configuration.send('disable_class_inherits_from_params_class') | ||
# http://puppet-lint.com/checks/autoloader_layout/ | ||
PuppetLint.configuration.send('disable_autoloader_layout') | ||
# http://puppet-lint.com/checks/inherits_across_namespaces/ | ||
PuppetLint.configuration.send('disable_inherits_across_namespaces') | ||
|
||
exclude_paths = [ | ||
"pkg/**/*", | ||
"vendor/**/*", | ||
"spec/**/*", | ||
] | ||
PuppetLint.configuration.ignore_paths = exclude_paths | ||
PuppetSyntax.exclude_paths = exclude_paths | ||
|
||
desc "Run acceptance tests" | ||
RSpec::Core::RakeTask.new(:acceptance) do |t| | ||
t.pattern = 'spec/acceptance' | ||
end | ||
|
||
task :default => [:lint] | ||
desc "Run syntax, lint, and spec tests." | ||
task :test => [ | ||
:syntax, | ||
:lint, | ||
:spec, | ||
] |
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 @@ | ||
{ | ||
"name": "katello-certs", | ||
"version": "0.1.0", | ||
"author": "Katello", | ||
"summary": "Deploys CA and required certs for a Foreman and Katello installation.", | ||
"license": "GPLv3+", | ||
"source": "https://github.com/Katello/puppet-certs.git", | ||
"project_page": "https://github.com/Katello/puppet-certs", | ||
"issues_url": "http://projects.theforeman.org/projects/katello/issues", | ||
"dependencies": [ | ||
{ | ||
"name": "puppetlabs-stdlib", | ||
"version_requirement": ">= 1.0.0" | ||
}, | ||
{ | ||
"name": "theforeman-foreman", | ||
"version_requirement": ">= 1.5.0" | ||
}, | ||
{ | ||
"name": "katello-common", | ||
"version_requirement": ">= 0.1.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,20 @@ | ||
require 'spec_helper' | ||
|
||
describe 'certs' do | ||
|
||
context 'on redhat' do | ||
let :facts do | ||
{ | ||
:concat_basedir => '/tmp', | ||
:operatingsystem => 'RedHat', | ||
:operatingsystemrelease => '6.4', | ||
:operatingsystemmajrelease => '6.4', | ||
:osfamily => 'RedHat', | ||
} | ||
end | ||
|
||
it { should contain_class('certs::install') } | ||
it { should contain_class('certs::config') } | ||
end | ||
|
||
end |
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 @@ | ||
at_exit { RSpec::Puppet::Coverage.report! } |
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 @@ | ||
require 'puppetlabs_spec_helper/module_spec_helper' |
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 @@ | ||
require 'beaker-rspec/spec_helper' | ||
require 'beaker-rspec/helpers/serverspec' | ||
|
||
hosts.each do |host| | ||
# Install Puppet | ||
install_puppet | ||
end | ||
|
||
RSpec.configure do |c| | ||
# Project root | ||
proj_root = File.expand_path(File.join(File.dirname(__FILE__), '..')) | ||
|
||
# Readable test descriptions | ||
c.formatter = :documentation | ||
|
||
# Configure all nodes in nodeset | ||
c.before :suite do | ||
# Install module and dependencies | ||
puppet_module_install(:source => proj_root, :module_name => 'katello_devel') | ||
hosts.each do |host| | ||
on host, puppet('module', 'install', 'puppetlabs-stdlib'), { :acceptable_exit_codes => [0,1] } | ||
end | ||
end | ||
end |