Skip to content

Commit

Permalink
extended acceptance tests
Browse files Browse the repository at this point in the history
  • Loading branch information
deric committed Aug 13, 2019
1 parent 834e2dd commit 0a9c323
Show file tree
Hide file tree
Showing 5 changed files with 34 additions and 16 deletions.
2 changes: 2 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
## 0.8.7
- New features:
- [Support global outstanding limit](https://github.com/deric/puppet-zookeeper/issues/128) (#128)
- Fixes:
- Fixed and extended acceptance tests
- [Full diff](https://github.com/deric/puppet-zookeeper/compare/v0.8.6...v0.8.7)

## 0.8.6
Expand Down
16 changes: 8 additions & 8 deletions spec/acceptance/hiera.yaml
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
---
:backends:
- yaml
:hierarchy:
- default
- common
:yaml:
:datadir: '/etc/puppetlabs/code/environments/production/hieradata'
:merge_behavior: deep
version: 5
defaults: # Used for any hierarchy level that omits these keys.
datadir: hieradata # This path is relative to hiera.yaml's directory.
data_hash: yaml_data # Use the built-in YAML backend.

hierarchy:
- name: "Default"
path: "default.yaml"
4 changes: 3 additions & 1 deletion spec/acceptance/hieradata/default.yaml
Original file line number Diff line number Diff line change
@@ -1 +1,3 @@
---
---
classes:
- '::zookeeper'
26 changes: 20 additions & 6 deletions spec/acceptance/zookeeper_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -5,16 +5,13 @@
it 'install zookeeper' do
pp = <<-EOS
class{'zookeeper':
# provider 'init' doesn't seem to work with puppet 4.3 and newer
# 'debian' should work with older systems as well
service_provider => 'debian', #systemd requires host with systemd
client_port => 2181,
client_port => 2181,
}
EOS

expect(apply_manifest(pp,
:catch_failures => false,
:debug => true
:debug => false
).exit_code).to be_zero
end

Expand Down Expand Up @@ -49,5 +46,22 @@
its(:exit_status) { is_expected.to eq 0 }
its(:stdout) { is_expected.to match /^1$/ }
end
end

describe file('/etc/zookeeper/conf/zoo.cfg') do
it { is_expected.to be_file }
it { is_expected.to be_writable.by('owner') }
it { is_expected.to be_readable.by('group') }
it { is_expected.to be_readable.by('others') }
end

describe command('cat /etc/zookeeper/conf/zoo.cfg') do
its(:exit_status) { is_expected.to eq 0 }
its(:stdout) { is_expected.to match /^clientPort=2181$/ }
end

describe command('echo stat | nc 0.0.0.0 2181') do
its(:exit_status) { is_expected.to eq 0 }
its(:stdout) { is_expected.to match /^Mode: standalone$/ }
end
end
end
2 changes: 1 addition & 1 deletion spec/spec_helper_acceptance.rb
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@
on host, 'yum install -y tar'
end
if ['Debian'].include?(fact('osfamily'))
on host, 'apt-get update -q && apt-get install net-tools'
on host, 'apt-get update -q && apt-get install -y net-tools netcat'
end
#on host, 'gem install bundler'
#on host, 'cd /etc/puppet && bundle install --without development'
Expand Down

0 comments on commit 0a9c323

Please sign in to comment.