Skip to content

Commit

Permalink
Fix acceptance test
Browse files Browse the repository at this point in the history
  • Loading branch information
RiANOl committed Dec 2, 2016
1 parent ed21a7e commit 756e439
Show file tree
Hide file tree
Showing 4 changed files with 20 additions and 34 deletions.
27 changes: 17 additions & 10 deletions spec/acceptance/standard_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -3,17 +3,24 @@
describe 'nomad class' do

context 'default parameters' do
# Using puppet_apply as a helper
apply_manifest_opts = {
:catch_failures => true,
:debug => true,
}
it 'should work with no errors based on the example' do
pp = <<-EOS
package { 'unzip': }
->
class { 'nomad':
version => '0.2.3',
version => '0.5.0',
config_hash => {
"region" => 'us-west',
"datacenter" => 'ptk',
"log_level" => 'INFO',
"bind_dir" => "0.0.0.0",
"data_dir" => "/var/lib/nomad",
"bind_addr" => "0.0.0.0",
"data_dir" => "/opt/nomad",
"advertise" => {
"http" => "127.0.0.1:4646",
"rpc" => "127.0.0.1:4647",
"serf" => "127.0.0.1:4648",
},
"server" => {
"enabled" => true,
"bootstrap_expect" => 1
Expand All @@ -23,8 +30,8 @@ class { 'nomad':
EOS

# Run it twice and test for idempotency
expect(apply_manifest(pp).exit_code).to_not eq(1)
expect(apply_manifest(pp).exit_code).to eq(0)
expect(apply_manifest(pp, apply_manifest_opts).exit_code).to_not eq(1)
expect(apply_manifest(pp, apply_manifest_opts).exit_code).to eq(0)
end

describe file('/opt/nomad') do
Expand All @@ -36,7 +43,7 @@ class { 'nomad':
end

describe command('nomad version') do
its(:stdout) { should match /Nomad v0\.2\.3/ }
its(:stdout) { should match /Nomad v0\.5\.0/ }
end

end
Expand Down
10 changes: 0 additions & 10 deletions spec/acceptance/unsupported_spec.rb

This file was deleted.

3 changes: 2 additions & 1 deletion spec/spec_helper_acceptance.rb
Original file line number Diff line number Diff line change
Expand Up @@ -14,8 +14,9 @@
# Configure all nodes in nodeset
c.before :suite do
# Install module and dependencies
puppet_module_install(:source => proj_root, :module_name => 'nomad')
puppet_module_install(:source => proj_root, :module_name => 'nomad', :target_module_path => '/etc/puppetlabs/code/modules')
hosts.each do |host|
puts host
on host, puppet('module', 'install', 'puppetlabs-stdlib'), { :acceptable_exit_codes => [0,1] }
on host, puppet('module', 'install', 'puppet-archive'), { :acceptable_exit_codes => [0,1] }
end
Expand Down
14 changes: 1 addition & 13 deletions tests/init.pp
Original file line number Diff line number Diff line change
Expand Up @@ -9,16 +9,4 @@
# Learn more about module testing here:
# http://docs.puppetlabs.com/guides/tests_smoke.html
#
class { 'nomad':
config_hash => {
"region" => 'us-west',
"datacenter" => 'ptk',
"log_level" => 'INFO',
"bind_dir" => "0.0.0.0",
"data_dir" => "/var/lib/nomad",
"server" => {
"enabled" => true,
"bootstrap_expect" => 1
}
}
}
include nomad

0 comments on commit 756e439

Please sign in to comment.