Skip to content
This repository has been archived by the owner on Aug 9, 2021. It is now read-only.

Commit

Permalink
spec_cleanup
Browse files Browse the repository at this point in the history
  • Loading branch information
jlambert121 committed Sep 2, 2013
1 parent 0b51078 commit 4adff95
Showing 1 changed file with 43 additions and 209 deletions.
252 changes: 43 additions & 209 deletions spec/classes/logstash_init_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -4,158 +4,36 @@

context "With a package" do

context "On Debian OS" do
let :facts do {
:operatingsystem => 'Debian'
} end

# init.pp
it { should contain_class('logstash::package') }
it { should contain_class('logstash::config') }
it { should contain_class('logstash::service') }

# package.pp
it { should contain_package('logstash') }

# service.pp
it { should contain_service('logstash-agent') }
it { should contain_file('/etc/init.d/logstash-agent') }
it { should contain_file('/etc/logstash/agent/config') }
it { should contain_service('logstash').with(:enable => false, :ensure => 'stopped') }

end
['Debian', 'Ubuntu', 'CentOS', 'Redhat', 'Fedora', 'Scientific', 'Amazon'].each do |distro|
context "On #{distro} OS" do

context "On Ubuntu OS" do
let :facts do {
:operatingsystem => 'Ubuntu'
} end

# init.pp
it { should contain_class('logstash::package') }
it { should contain_class('logstash::config') }
it { should contain_class('logstash::service') }

# package.pp
it { should contain_package('logstash') }

# service.pp
it { should contain_service('logstash-agent') }
it { should contain_file('/etc/init.d/logstash-agent') }
it { should contain_file('/etc/logstash/agent/config') }
it { should contain_service('logstash').with(:enable => false, :ensure => 'stopped') }

end

context "On CentOS OS " do
let :facts do {
:operatingsystem => 'CentOS'
} end

# init.pp
it { should contain_class('logstash::package') }
it { should contain_class('logstash::config') }
it { should contain_class('logstash::service') }

# package.pp
it { should contain_package('logstash') }

# service.pp
it { should contain_service('logstash-agent') }
it { should contain_file('/etc/init.d/logstash-agent') }
it { should contain_file('/etc/logstash/agent/config') }
it { should contain_service('logstash').with(:enable => false, :ensure => 'stopped') }

end

context "On RedHat OS " do
let :facts do {
:operatingsystem => 'Redhat'
} end

# init.pp
it { should contain_class('logstash::package') }
it { should contain_class('logstash::config') }
it { should contain_class('logstash::service') }

# package.pp
it { should contain_package('logstash') }

# service.pp
it { should contain_service('logstash-agent') }
it { should contain_file('/etc/init.d/logstash-agent') }
it { should contain_file('/etc/logstash/agent/config') }
it { should contain_service('logstash').with(:enable => false, :ensure => 'stopped') }

end

context "On Fedora OS " do
let :facts do {
:operatingsystem => 'Fedora'
} end

# init.pp
it { should contain_class('logstash::package') }
it { should contain_class('logstash::config') }
it { should contain_class('logstash::service') }

# package.pp
it { should contain_package('logstash') }

# service.pp
it { should contain_service('logstash-agent') }
it { should contain_file('/etc/init.d/logstash-agent') }
it { should contain_file('/etc/logstash/agent/config') }
it { should contain_service('logstash').with(:enable => false, :ensure => 'stopped') }

end

context "On Scientific OS " do
let :facts do {
:operatingsystem => 'Scientific'
} end

# init.pp
it { should contain_class('logstash::package') }
it { should contain_class('logstash::config') }
it { should contain_class('logstash::service') }

# package.pp
it { should contain_package('logstash') }

# service.pp
it { should contain_service('logstash-agent') }
it { should contain_file('/etc/init.d/logstash-agent') }
it { should contain_file('/etc/logstash/agent/config') }
it { should contain_service('logstash').with(:enable => false, :ensure => 'stopped') }
let :facts do {
:operatingsystem => distro
} end

end
# init.pp
it { should contain_class('logstash::package') }
it { should contain_class('logstash::config') }
it { should contain_class('logstash::service') }

context "On Amazon OS " do
let :facts do {
:operatingsystem => 'Amazon'
} end
# package.pp
it { should contain_package('logstash') }

# init.pp
it { should contain_class('logstash::package') }
it { should contain_class('logstash::config') }
it { should contain_class('logstash::service') }
# service.pp
it { should contain_service('logstash-agent') }
it { should contain_file('/etc/init.d/logstash-agent') }
it { should contain_file('/etc/logstash/agent/config') }
it { should contain_service('logstash').with(:enable => false, :ensure => 'stopped') }

# package.pp
it { should contain_package('logstash') }
end

# service.pp
it { should contain_service('logstash-agent') }
it { should contain_file('/etc/init.d/logstash-agent') }
it { should contain_file('/etc/logstash/agent/config') }
it { should contain_service('logstash').with(:enable => false, :ensure => 'stopped') }

end

context "On an unknown OS" do
let :facts do {
:operatingsystem => 'Darwin'
} end

it { expect { should raise_error(Puppet::Error) } }
end

Expand Down Expand Up @@ -224,7 +102,7 @@
let :facts do {
:operatingsystem => 'CentOS'
} end

let :params do {
:provider => 'custom',
:jarfile => "puppet:///path/to/logstash-1.1.9.jar",
Expand Down Expand Up @@ -267,7 +145,7 @@
let :facts do {
:operatingsystem => 'CentOS'
} end

let :params do {
:provider => 'custom',
:jarfile => "puppet:///path/to/logstash-1.1.9.jar",
Expand Down Expand Up @@ -324,7 +202,7 @@
end

context "with a jar file" do

let :facts do {
:operatingsystem => 'CentOS'
} end
Expand Down Expand Up @@ -370,7 +248,7 @@
end

context "with separate defaults files" do

let :params do {
:instances => [ 'agent', 'indexer' ],
:defaultsfiles => { 'agent' => 'puppet:///path/to/agent-defaults', 'indexer' => 'puppet:///path/to/indexer-defaults' }
Expand Down Expand Up @@ -401,7 +279,7 @@

it { should contain_file('/etc/init.d/logstash-agent').with(:source => 'puppet:///path/to/agent-init') }
it { should contain_file('/etc/init.d/logstash-indexer').with(:source => 'puppet:///path/to/indexer-init') }

it { should contain_file('/etc/logstash/agent/config') }
it { should contain_file('/etc/logstash/indexer/config') }

Expand Down Expand Up @@ -445,78 +323,34 @@

context "install java" do

let :params do {
:java_install => true
} end

context "On a Debian OS" do

let :facts do {
:operatingsystem => 'Debian'
} end

it { should contain_package('openjdk-6-jre-headless') }

end

context "On an Ubuntu OS" do

let :facts do {
:operatingsystem => 'Ubuntu'
} end

it { should contain_package('openjdk-6-jre-headless') }

end

context "On a CentOS OS " do

let :facts do {
:operatingsystem => 'CentOS'
} end

it { should contain_package('java-1.6.0-openjdk') }

end

context "On a RedHat OS " do

let :facts do {
:operatingsystem => 'Redhat'
} end

it { should contain_package('java-1.6.0-openjdk') }

end

context "On a Fedora OS " do

let :facts do {
:operatingsystem => 'Fedora'
} end

it { should contain_package('java-1.6.0-openjdk') }

end

context "On a Scientific OS " do
['Debian', 'Ubuntu'].each do |distro|
context "On #{distro} OS" do
let :params do {
:java_install => true
} end

let :facts do {
:operatingsystem => 'Scientific'
} end
let :facts do {
:operatingsystem => distro
} end

it { should contain_package('java-1.6.0-openjdk') }
it { should contain_package('openjdk-6-jre-headless') }

end
end

context "On a Amazon OS " do
['CentOS', 'Redhat', 'Fedora', 'Scientific', 'Amazon'].each do |distro|
context "On #{distro} OS" do
let :params do {
:java_install => true
} end

let :facts do {
:operatingsystem => 'Amazon'
} end
let :facts do {
:operatingsystem => distro
} end

it { should contain_package('java-1.6.0-openjdk') }
it { should contain_package('java-1.6.0-openjdk') }

end
end

context "On an unknown OS" do
Expand Down

0 comments on commit 4adff95

Please sign in to comment.