Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add tests for raft_multiplier #429

Merged
merged 3 commits into from
Jul 5, 2018
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 3 additions & 3 deletions manifests/config.pp
Original file line number Diff line number Diff line change
Expand Up @@ -11,9 +11,9 @@
# Bool. If set will make puppet remove stale config files.
#
class consul::config(
$config_hash,
$purge = true,
$enable_beta_ui = $consul::enable_beta_ui,
Hash $config_hash,
Boolean $purge = true,
Boolean $enable_beta_ui = $consul::enable_beta_ui,
Boolean $allow_binding_to_root_ports = $consul::allow_binding_to_root_ports,
Boolean $restart_on_change = $consul::restart_on_change,
) {
Expand Down
40 changes: 38 additions & 2 deletions spec/acceptance/class_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,6 @@
it 'should work with no errors based on the example' do
pp = <<-EOS
package { 'unzip': ensure => present } ->
# Don't manage the service as it doesn't work well in docker
class { 'consul':
version => '1.0.5',
manage_service => true,
Expand Down Expand Up @@ -42,7 +41,6 @@ class { 'consul':
it 'should work with no errors based on the example' do
pp = <<-EOS
package { 'unzip': ensure => present } ->
# Don't manage the service as it doesn't work well in docker
class { 'consul':
version => '1.1.0',
manage_service => true,
Expand Down Expand Up @@ -75,5 +73,43 @@ 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.0',
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.0} }
end

end
end