-
Notifications
You must be signed in to change notification settings - Fork 7
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Joshua Hoblitt
committed
Nov 6, 2013
1 parent
3a20317
commit 8438d72
Showing
16 changed files
with
307 additions
and
0 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': | ||
repo: 'git://github.com/puppetlabs/puppetlabs-stdlib.git' | ||
ref: '3.0.0' | ||
symlinks: | ||
'mdadm': "#{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 @@ | ||
pkg/ | ||
spec/fixtures/ | ||
Gemfile.lock | ||
*.orig | ||
*.rej | ||
*.patch | ||
.rspec_system/ |
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 @@ | ||
--- | ||
default_set: 'centos-64-x64' | ||
sets: | ||
'centos-64-x64': | ||
nodes: | ||
'main.vm': | ||
prefab: 'centos-64-x64' | ||
'debian-607-x64': | ||
nodes: | ||
'main.vm': | ||
prefab: 'debian-607-x64' |
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,36 @@ | ||
language: ruby | ||
rvm: | ||
- 1.8.7 | ||
- 1.9.3 | ||
- 2.0.0 | ||
- ruby-head | ||
env: | ||
- PUPPET_GEM_VERSION="~> 2.7.0" | ||
- PUPPET_GEM_VERSION="~> 3.0.0" | ||
- PUPPET_GEM_VERSION="~> 3.1.0" | ||
- PUPPET_GEM_VERSION="~> 3.2.1" | ||
- PUPPET_GEM_VERSION="~> 3.3.0" | ||
matrix: | ||
allow_failures: | ||
- rvm: ruby-head | ||
exclude: | ||
- rvm: 1.9.3 | ||
env: PUPPET_GEM_VERSION="~> 2.7.0" | ||
- rvm: 2.0.0 | ||
env: PUPPET_GEM_VERSION="~> 2.7.0" | ||
- rvm: 2.0.0 | ||
env: PUPPET_GEM_VERSION="~> 3.0.0" | ||
- rvm: 2.0.0 | ||
env: PUPPET_GEM_VERSION="~> 3.1.0" | ||
- rvm: ruby-head | ||
env: PUPPET_GEM_VERSION="~> 2.7.0" | ||
- rvm: ruby-head | ||
env: PUPPET_GEM_VERSION="~> 3.0.0" | ||
- rvm: ruby-head | ||
env: PUPPET_GEM_VERSION="~> 3.1.0" | ||
- rvm: ruby-head | ||
env: PUPPET_GEM_VERSION="~> 3.2.1" | ||
- rvm: ruby-head | ||
env: PUPPET_GEM_VERSION="~> 3.3.0" | ||
notifications: | ||
email: false |
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,23 @@ | ||
source 'https://rubygems.org' | ||
|
||
if puppetversion = ENV['PUPPET_GEM_VERSION'] | ||
gem 'puppet', puppetversion, :require => false | ||
else | ||
gem 'puppet', :require => false | ||
end | ||
|
||
group :development, :test do | ||
gem 'rake' | ||
gem 'puppetlabs_spec_helper' | ||
gem 'puppet-lint' | ||
gem 'puppet-syntax' | ||
end | ||
|
||
group :system do | ||
gem 'rspec-system' | ||
gem 'rspec-system-puppet' | ||
gem 'rspec-system-serverspec' | ||
gem 'serverspec' | ||
end | ||
|
||
# vim:ft=ruby |
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,13 @@ | ||
Copyright (C) 2013 Joshua Hoblitt <jhoblitt@cpan.org> | ||
|
||
Licensed under the Apache License, Version 2.0 (the "License"); | ||
you may not use this file except in compliance with the License. | ||
You may obtain a copy of the License at | ||
|
||
http://www.apache.org/licenses/LICENSE-2.0 | ||
|
||
Unless required by applicable law or agreed to in writing, software | ||
distributed under the License is distributed on an "AS IS" BASIS, | ||
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
See the License for the specific language governing permissions and | ||
limitations under the License. |
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,10 @@ | ||
name 'jhoblitt-mdadm' | ||
version '0.0.1' | ||
|
||
author 'Joshua Hoblitt <jhoblitt@cpan.org>' | ||
license 'Apache' | ||
project_page 'https://github.com/jhoblitt/puppet-mdadm' | ||
source 'https://github.com/jhoblitt/puppet-mdadm.git' | ||
summary 'module skeleton' | ||
description 'module skeleton' | ||
dependency 'puppetlabs/stdlib', '>= 3.0.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,52 @@ | ||
Puppet mdadm Module | ||
========================= | ||
|
||
[![Build Status](https://travis-ci.org/jhoblitt/puppet-mdadm.png)](https://travis-ci.org/jhoblitt/puppet-mdadm) | ||
|
||
#### Table of Contents | ||
|
||
1. [Overview](#overview) | ||
2. [Description](#description) | ||
3. [Usage](#usage) | ||
4. [Limitations](#limitations) | ||
* [Tested Platforms](#tested-platforms) | ||
5. [Versioning](#versioning) | ||
6. [Support](#support) | ||
7. [See Also](#see-also) | ||
|
||
|
||
Overview | ||
-------- | ||
|
||
|
||
Description | ||
----------- | ||
|
||
|
||
Usage | ||
----- | ||
|
||
|
||
Limitations | ||
----------- | ||
|
||
### Tested Platforms | ||
|
||
|
||
Versioning | ||
---------- | ||
|
||
This module is versioned according to the [Semantic Versioning | ||
2.0.0](http://semver.org/spec/v2.0.0.html) specification. | ||
|
||
|
||
Support | ||
------- | ||
|
||
Please log tickets and issues at | ||
[github](https://github.com/jhoblitt/puppet-mdadm/issues) | ||
|
||
|
||
See Also | ||
-------- | ||
|
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,15 @@ | ||
require 'puppetlabs_spec_helper/rake_tasks' | ||
require 'rspec-system/rake_task' | ||
require 'puppet-syntax/tasks/puppet-syntax' | ||
require 'puppet-lint/tasks/puppet-lint' | ||
|
||
PuppetSyntax.exclude_paths = ['spec/fixtures/**/*'] | ||
#PuppetLint.configuration.send('disable_class_inherits_from_params_class') | ||
#PuppetLint.configuration.send('disable_variable_scope') | ||
PuppetLint.configuration.ignore_paths = ['pkg/**/*.pp', 'spec/**/*.pp', 'tests/**/*.pp'] | ||
|
||
task :default => [ | ||
: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,11 @@ | ||
# == Class: mdadm | ||
# | ||
# simple template | ||
# | ||
# === Examples | ||
# | ||
# include mdadm | ||
# | ||
class mdadm { | ||
|
||
} |
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,22 @@ | ||
# == Class: mdadm::params | ||
# | ||
# This class should be considered private. | ||
# | ||
# === Authors | ||
# | ||
# Joshua Hoblitt <jhoblitt@cpan.org> | ||
# | ||
# === Copyright | ||
# | ||
# Copyright (C) 2013 Joshua Hoblitt | ||
# | ||
class mdadm::params { | ||
case $::osfamily { | ||
'redhat': { | ||
$mdadm_package = 'mdadm' | ||
} | ||
default: { | ||
fail("Module ${module_name} is not supported on ${::operatingsystem}") | ||
} | ||
} | ||
} |
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,28 @@ | ||
require 'spec_helper' | ||
|
||
describe 'mdadm::params', :type => :class do | ||
describe 'for osfamily RedHat' do | ||
let :facts do | ||
{ | ||
:osfamily => 'RedHat', | ||
} | ||
end | ||
|
||
it { should include_class('mdadm::params') } | ||
end | ||
|
||
describe 'unsupported osfamily' do | ||
let :facts do | ||
{ | ||
:osfamily => 'Debian', | ||
:operatingsystem => 'Debian', | ||
} | ||
end | ||
|
||
it 'should fail' do | ||
expect { should include_class('mdadm::params') }. | ||
to raise_error(Puppet::Error, /not supported on Debian/) | ||
end | ||
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,9 @@ | ||
require 'spec_helper' | ||
|
||
describe 'mdadm', :type => :class do | ||
|
||
describe 'for osfamily RedHat' do | ||
it { should contain_class('mdadm') } | ||
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 @@ | ||
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,28 @@ | ||
require 'rspec-system/spec_helper' | ||
require 'rspec-system-puppet/helpers' | ||
require 'rspec-system-serverspec/helpers' | ||
|
||
include RSpecSystemPuppet::Helpers | ||
|
||
include Serverspec::Helper::RSpecSystem | ||
include Serverspec::Helper::DetectOS | ||
|
||
RSpec.configure do |c| | ||
# Project root | ||
proj_root = File.expand_path(File.join(File.dirname(__FILE__), '..')) | ||
|
||
# Enable colour | ||
c.tty = true | ||
|
||
c.include RSpecSystemPuppet::Helpers | ||
|
||
# This is where we 'setup' the nodes before running our tests | ||
c.before :suite do | ||
# Install puppet | ||
puppet_install | ||
|
||
# Install modules and dependencies | ||
puppet_module_install(:source => proj_root, :module_name => 'mdadm') | ||
shell('puppet module install puppetlabs-stdlib') | ||
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,34 @@ | ||
require 'spec_helper_system' | ||
|
||
describe 'mdadm class' do | ||
case node.facts['osfamily'] | ||
when 'RedHat', 'Debian' | ||
package_name = 'mdadm' | ||
service_name = 'mdadm' | ||
end | ||
|
||
describe 'running puppet code' do | ||
# Using puppet_apply as a helper | ||
it 'should work with no errors' do | ||
pp = <<-EOS | ||
class { 'mdadm': } | ||
EOS | ||
|
||
# Run it twice and test for idempotency | ||
puppet_apply(pp) do |r| | ||
r.exit_code.should_not == 1 | ||
r.refresh | ||
r.exit_code.should be_zero | ||
end | ||
end | ||
end | ||
|
||
describe package(package_name) do | ||
it { should be_installed } | ||
end | ||
|
||
describe service(service_name) do | ||
it { should be_running } | ||
it { should be_enabled } | ||
end | ||
end |