forked from voxpupuli/puppet-gluster
-
Notifications
You must be signed in to change notification settings - Fork 0
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
Scott Merrill
committed
Jan 12, 2015
1 parent
b2351ea
commit 7927438
Showing
9 changed files
with
173 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,5 @@ | ||
fixtures: | ||
symlinks: | ||
gluster: "#{source_dir}" | ||
repositories: | ||
stdlib: "git://github.com/puppetlabs/puppetlabs-stdlib.git" |
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 +1,3 @@ | ||
pkg/ | ||
spec/fixtures | ||
.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 @@ | ||
require 'puppetlabs_spec_helper/rake_tasks' |
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,14 @@ | ||
require 'spec_helper' | ||
|
||
describe 'gluster::client', :type => :class do | ||
let :facts do | ||
{ | ||
:osfamily => 'RedHat', | ||
:architecture => 'x86_64', | ||
} | ||
end | ||
let :params do { :version => 'LATEST', } end | ||
it 'should include gluster::install' do | ||
should create_class('gluster::install') | ||
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,73 @@ | ||
require 'spec_helper' | ||
|
||
describe 'gluster::install', :type => :class do | ||
# describe 'installing on an unsupported OS' do | ||
# let :facts do { :osfamily => 'Amiga' } end | ||
# expect { subject }.to raise_error(Puppet::Error, //) | ||
# end | ||
describe 'installing on an unsupported architecture' do | ||
let :facts do { :architecture => 'zLinux' } end | ||
it 'should not install' do | ||
expect { subject }.to raise_error(Puppet::Error, /not yet supported/) | ||
end | ||
end | ||
describe 'installing on Red Hat Enterprise Linux' do | ||
let :facts do | ||
{ | ||
:osfamily => 'RedHat', | ||
:operatingsystem => 'RedHat', | ||
:operatingsystemmajrelease => '6', | ||
:architecture => 'x86_64', | ||
} | ||
end | ||
context 'when repo is true' do | ||
let :params do | ||
{ :server => true } | ||
end | ||
it 'should create gluster::repo' do | ||
should create_class('gluster::repo') | ||
end | ||
end | ||
context 'when repo is false' do | ||
let :params do | ||
{ :repo => false } | ||
end | ||
it 'should not create gluster::repo' do | ||
should_not create_class('gluster::repo') | ||
end | ||
end | ||
context 'when client is true' do | ||
let :params do | ||
{ :client => true } | ||
end | ||
it 'should install glusterfs-fuse package' do | ||
should create_package('glusterfs-fuse') | ||
end | ||
end | ||
context 'when client is false' do | ||
let :params do | ||
{ :client => false } | ||
end | ||
it 'should not install glusterfs-fuse package' do | ||
should_not create_package('glusterfs-fuse') | ||
end | ||
end | ||
context 'when server is true' do | ||
let :params do | ||
{ :server => true } | ||
end | ||
it 'should install glusterfs-server' do | ||
should create_package('glusterfs-server') | ||
end | ||
end | ||
context 'when server is false' do | ||
let :params do | ||
{ :server => false } | ||
end | ||
it 'should not install glusterfs-server' do | ||
should_not create_package('glusterfs-server') | ||
end | ||
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,54 @@ | ||
require 'spec_helper' | ||
|
||
describe 'gluster::repo::yum', :type => :class do | ||
describe 'version not specified' do | ||
it 'should not install' do | ||
expect { subject }.to raise_error(Puppet::Error, /Version not specified/) | ||
end | ||
end | ||
describe 'bogus version' do | ||
let :params do { :version => 'foobar', } end | ||
it 'should not install' do | ||
expect { subject }.to raise_error(Puppet::Error, /doesn't make sense!/) | ||
end | ||
end | ||
describe 'unsupported architecture' do | ||
let :facts do { :architecture => 'zLinux', } end | ||
let :params do { :version => 'LATEST', } end | ||
it 'should not install' do | ||
expect { subject }.to raise_error(Puppet::Error, /not yet supported/) | ||
end | ||
end | ||
describe 'latest version on x86_64' do | ||
let :facts do { :architecture => 'x86_64', } end | ||
let :params do | ||
{ | ||
:version => 'LATEST', | ||
:repo_key_path => '/etc/pki/rpm-gpg/', | ||
:repo_key_name => 'RPM-GPG-KEY-gluster.pub', | ||
:repo_key_source => 'puppet:///modules/gluster/RPM-GPG-KEY-gluster.pub', | ||
} | ||
end | ||
it 'should install' do | ||
should create_file('/etc/pki/rpm-gpg/RPM-GPG-KEY-gluster.pub') | ||
should create_yumrepo('glusterfs-x86_64') | ||
end | ||
end | ||
describe 'latest version on x86_64 with priority' do | ||
let :facts do { :architecture => 'x86_64', } end | ||
let :params do | ||
{ | ||
:version => 'LATEST', | ||
:repo_key_path => '/etc/pki/rpm-gpg/', | ||
:repo_key_name => 'RPM-GPG-KEY-gluster.pub', | ||
:repo_key_source => 'puppet:///modules/gluster/RPM-GPG-KEY-gluster.pub', | ||
:priority => '50', | ||
} | ||
end | ||
it 'should install' do | ||
should create_file('/etc/pki/rpm-gpg/RPM-GPG-KEY-gluster.pub') | ||
should create_package('yum-plugin-priorities') | ||
should create_yumrepo('glusterfs-x86_64') | ||
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,7 @@ | ||
require 'spec_helper' | ||
|
||
describe 'gluster::service', :type => :class do | ||
it 'should start the service' do | ||
should create_service('glusterd') | ||
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,16 @@ | ||
require 'spec_helper' | ||
|
||
describe 'gluster::mount', :type => :define do | ||
let(:title) { 'rspec' } | ||
describe 'no volume specified' do | ||
it 'should fail' do | ||
expect { subject }.to raise_error(Puppet::Error, /Volume parameter is mandatory/) | ||
end | ||
end | ||
describe 'bogus ensure value' do | ||
let :params do { :volume => 'rspec', :ensure => 'foobar' } end | ||
it 'should fail' do | ||
expect { subject }.to raise_error(Puppet::Error, /Unknown option/) | ||
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 @@ | ||
require 'puppetlabs_spec_helper/module_spec_helper' |