Skip to content

Commit

Permalink
Merge pull request voxpupuli#443 from bastelfreak/puppet6
Browse files Browse the repository at this point in the history
bump default consul version from 0.7.4 to 1.2.3
  • Loading branch information
solarkennedy authored Oct 5, 2018
2 parents 171644a + 804622c commit 14664a7
Show file tree
Hide file tree
Showing 4 changed files with 48 additions and 10 deletions.
2 changes: 1 addition & 1 deletion manifests/params.pp
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@
$service_ensure = 'running'
$services = {}
$user = 'consul'
$version = '0.7.4'
$version = '1.2.3'
$watches = {}

case $facts['architecture'] {
Expand Down
38 changes: 38 additions & 0 deletions spec/acceptance/class_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -112,4 +112,42 @@ class { 'consul':
end

end
context 'with performance options' do
it 'should work with no errors based on the example' do
pp = <<-EOS
package { 'unzip': ensure => present } ->
class { 'consul':
version => '1.2.3',
manage_service => true,
config_hash => {
'datacenter' => 'east-aws',
'data_dir' => '/opt/consul',
'log_level' => 'INFO',
'node_name' => 'foobar',
'server' => true,
'performance' => {
'raft_multiplier' => 2,
},
}
}
EOS

# Run it twice and test for idempotency
apply_manifest(pp, catch_failures: true)
apply_manifest(pp, catch_changes: true)
end

describe file('/opt/consul') do
it { should be_directory }
end

describe service('consul') do
it { should be_enabled }
it { should be_running }
end

describe command('consul version') do
its(:stdout) { should match %r{Consul v1.2.3} }
end
end
end
14 changes: 7 additions & 7 deletions spec/classes/init_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -94,29 +94,29 @@
end

context "When installing via URL by default" do
it { should contain_archive('/opt/consul/archives/consul-0.7.4.zip').with(:source => 'https://releases.hashicorp.com/consul/0.7.4/consul_0.7.4_linux_amd64.zip') }
it { should contain_archive('/opt/consul/archives/consul-1.2.3.zip').with(:source => 'https://releases.hashicorp.com/consul/1.2.3/consul_1.2.3_linux_amd64.zip') }
it { should contain_file('/opt/consul/archives').with(:ensure => 'directory') }
it { should contain_file('/opt/consul/archives/consul-0.7.4').with(:ensure => 'directory') }
it { should contain_file('/opt/consul/archives/consul-1.2.3').with(:ensure => 'directory') }
it { should contain_file('/usr/local/bin/consul').that_notifies('Class[consul::run_service]') }
end

context "When installing via URL with a special archive_path" do
let(:params) {{
:archive_path => '/usr/share/puppet-archive',
}}
it { should contain_archive('/usr/share/puppet-archive/consul-0.7.4.zip').with(:source => 'https://releases.hashicorp.com/consul/0.7.4/consul_0.7.4_linux_amd64.zip') }
it { should contain_archive('/usr/share/puppet-archive/consul-1.2.3.zip').with(:source => 'https://releases.hashicorp.com/consul/1.2.3/consul_1.2.3_linux_amd64.zip') }
it { should contain_file('/usr/share/puppet-archive').with(:ensure => 'directory') }
it { should contain_file('/usr/share/puppet-archive/consul-0.7.4').with(:ensure => 'directory') }
it { should contain_file('/usr/share/puppet-archive/consul-1.2.3').with(:ensure => 'directory') }
it { should contain_file('/usr/local/bin/consul').that_notifies('Class[consul::run_service]') }
end

context "When installing by archive via URL and current version is already installed" do
let(:facts) do
facts.merge({
:consul_version => '0.7.4'
:consul_version => '1.2.3'
})
end
it { should contain_archive('/opt/consul/archives/consul-0.7.4.zip').with(:source => 'https://releases.hashicorp.com/consul/0.7.4/consul_0.7.4_linux_amd64.zip') }
it { should contain_archive('/opt/consul/archives/consul-1.2.3.zip').with(:source => 'https://releases.hashicorp.com/consul/1.2.3/consul_1.2.3_linux_amd64.zip') }
it { should contain_file('/usr/local/bin/consul') }
it { should_not contain_notify(['Class[consul::run_service]']) }
end
Expand All @@ -133,7 +133,7 @@
let(:params) {{
:download_url => 'http://myurl',
}}
it { should contain_archive('/opt/consul/archives/consul-0.7.4.zip').with(:source => 'http://myurl') }
it { should contain_archive('/opt/consul/archives/consul-1.2.3.zip').with(:source => 'http://myurl') }
it { should contain_file('/usr/local/bin/consul').that_notifies('Class[consul::run_service]') }
end

Expand Down
4 changes: 2 additions & 2 deletions spec/defines/consul_service_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@
.with_content(/"service" *: *\{/) \
.with_content(/"id" *: *"my_service"/) \
.with_content(/"name" *: *"my_service"/) \
.with_content(/"enableTagOverride" *: *false/)
.with_content(/"enable_tag_override" *: *false/)
}
end
describe 'with no args ( consul version not less than 1.1.0 )' do
Expand Down Expand Up @@ -69,7 +69,7 @@
.with_content(/"service" *: *\{/) \
.with_content(/"id" *: *"my_service"/) \
.with_content(/"name" *: *"my_service"/) \
.with_content(/"enableTagOverride" *: *true/)
.with_content(/"enable_tag_override" *: *true/)
}
end
describe 'with service name and address' do
Expand Down

0 comments on commit 14664a7

Please sign in to comment.