-
Notifications
You must be signed in to change notification settings - Fork 29
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 8, 2013
1 parent
d9fa183
commit c8f12f3
Showing
6 changed files
with
106 additions
and
5 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 |
---|---|---|
@@ -1,6 +1,8 @@ | ||
pkg/ | ||
spec/fixtures/ | ||
Gemfile.lock | ||
.rspec_system/ | ||
*.orig | ||
*.rej | ||
*.patch | ||
*.swp |
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
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 |
---|---|---|
@@ -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 => 'udev') | ||
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,56 @@ | ||
require 'spec_helper_system' | ||
|
||
describe 'udev class' do | ||
describe 'running puppet code' do | ||
it 'should work with no errors' do | ||
pp = <<-EOS | ||
class { 'udev': udev_log => 'debug' } | ||
udev::rule { '51-android.rules': | ||
content => 'SUBSYSTEMS=="usb", ATTRS{idVendor}=="22b8", ATTRS{idProduct}=="4372", MODE="0660", OWNER="vagrant"', | ||
} | ||
udev::rule { '60-raw.rules': | ||
content => 'ACTION=="add", KERNEL=="sda", RUN+="/bin/raw /dev/raw/raw1 %N"', | ||
} | ||
EOS | ||
|
||
# Run it twice and test for idempotency | ||
puppet_apply(pp) do |r| | ||
r.exit_code.should_not == 1 | ||
r.stderr.should be_empty | ||
r.refresh | ||
r.exit_code.should be_zero | ||
r.stderr.should be_empty | ||
end | ||
end | ||
end | ||
|
||
describe package('udev') do | ||
it { should be_installed } | ||
end | ||
|
||
describe file('/etc/udev/udev.conf') do | ||
it { should be_file } | ||
it { should be_owned_by 'root' } | ||
it { should be_grouped_into 'root' } | ||
it { should be_mode 644 } | ||
it { should contain 'udev_log="debug"' } | ||
end | ||
|
||
describe file('/etc/udev/rules.d/51-android.rules') do | ||
it { should be_file } | ||
it { should be_owned_by 'root' } | ||
it { should be_grouped_into 'root' } | ||
it { should be_mode 644 } | ||
it { should contain 'SUBSYSTEMS=="usb", ATTRS{idVendor}=="22b8", ATTRS{idProduct}=="4372", MODE="0660", OWNER="vagrant"' } | ||
end | ||
|
||
describe file('/etc/udev/rules.d/60-raw.rules') do | ||
it { should be_file } | ||
it { should be_owned_by 'root' } | ||
it { should be_grouped_into 'root' } | ||
it { should be_mode 644 } | ||
it { should contain 'ACTION=="add", KERNEL=="sda", RUN+="/bin/raw /dev/raw/raw1 %N"' } | ||
end | ||
end |