summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorIan Wienand <iwienand@redhat.com>2017-12-14 11:50:23 +1100
committerColleen Murphy <colleen.murphy@suse.de>2018-08-09 20:56:27 +0200
commit15c133270b78002a0b93f44263c76660339409a0 (patch)
tree56367f5ca5adece4ae034c9746a9d06bace6ece3
parent05b1414b9b40b8b6cd325ae8df7e00954fbfe695 (diff)
Add basic rspec test
Add a basic apply test Change-Id: Iff4d74806c67c9480e3679fcca56d8470b9fd29e
Notes
Notes (review): Code-Review+2: Monty Taylor <mordred@inaugust.com> Code-Review+2: Colleen Murphy <colleen@gazlene.net> Code-Review+2: Clark Boylan <cboylan@sapwetik.org> Workflow+1: Clark Boylan <cboylan@sapwetik.org> Verified+2: Zuul Submitted-by: Zuul Submitted-at: Fri, 10 Aug 2018 20:16:26 +0000 Reviewed-on: https://review.openstack.org/527822 Project: openstack-infra/puppet-ethercalc Branch: refs/heads/master
-rw-r--r--spec/acceptance/ethercalc_spec.rb54
-rw-r--r--spec/acceptance/fixtures/ethercalc.pp5
2 files changed, 59 insertions, 0 deletions
diff --git a/spec/acceptance/ethercalc_spec.rb b/spec/acceptance/ethercalc_spec.rb
new file mode 100644
index 0000000..face6f4
--- /dev/null
+++ b/spec/acceptance/ethercalc_spec.rb
@@ -0,0 +1,54 @@
1require 'puppet-openstack_infra_spec_helper/spec_helper_acceptance'
2
3describe 'puppet-ethercalc:: manifest', :if => ['debian', 'ubuntu'].include?(os[:family]) do
4 def pp_path
5 base_path = File.dirname(__FILE__)
6 File.join(base_path, 'fixtures')
7 end
8
9 def init_puppet_module
10 module_path = File.join(pp_path, 'ethercalc.pp')
11 File.read(module_path)
12 end
13
14 it 'should work with no errors' do
15 apply_manifest(init_puppet_module, catch_failures: true)
16 end
17
18 describe 'required packages' do
19 describe 'os packages' do
20 required_packages = [
21 package('curl'),
22 package('redis-server'),
23 ]
24
25 required_packages.each do |package|
26 describe package do
27 it { should be_installed }
28 end
29 end
30 end
31 end
32
33 describe 'required files' do
34 describe file('/opt/ethercalc') do
35 it { should be_directory }
36 end
37 end
38
39 # TODO(ianw): not quite reliable ... possibly need this in a retry
40 # loop for a little to let the service start up?
41
42 # describe 'required services' do
43 # describe 'ports are open and services are reachable' do
44 # describe port(8000) do
45 # it { should be_listening }
46 # end
47
48 # describe command('curl http://localhost:8000 --verbose') do
49 # its(:stdout) { should contain('EtherCalc - Share the URL to your friends') }
50 # end
51 # end
52 # end
53
54end
diff --git a/spec/acceptance/fixtures/ethercalc.pp b/spec/acceptance/fixtures/ethercalc.pp
new file mode 100644
index 0000000..d721bd3
--- /dev/null
+++ b/spec/acceptance/fixtures/ethercalc.pp
@@ -0,0 +1,5 @@
1$source_dir = '/opt/openstack-health'
2
3include ethercalc::redis
4
5class { '::ethercalc': }