Browse Source

Add acceptance tests for puppet-haveged

This patch adds some acceptance tests for puppet-haveged, making sure
that we can applied it without errors and ensuring idempotency.
Also we check if the packages are installed and the services are
running.

Change-Id: Ieab5554ddf45c0311d6de7e197c856c87cbccd92
changes/96/244796/2
Maitê Balhester 3 years ago
parent
commit
1efab539f9
4 changed files with 37 additions and 0 deletions
  1. 3
    0
      .gitignore
  2. 3
    0
      Gemfile
  3. 30
    0
      spec/acceptance/basic_spec.rb
  4. 1
    0
      spec/acceptance/fixtures/default.pp

+ 3
- 0
.gitignore View File

@@ -1,2 +1,5 @@
1 1
 Gemfile.lock
2 2
 .bundled_gems/
3
+log/
4
+junit/
5
+.vagrant/

+ 3
- 0
Gemfile View File

@@ -24,7 +24,10 @@ group :development, :test do
24 24
   else
25 25
     gem 'puppet', '~> 3.0', :require => false
26 26
   end
27
+end
27 28
 
29
+group :system_tests do
30
+  gem 'beaker-rspec', :require => false
28 31
 end
29 32
 
30 33
 # vim:ft=ruby

+ 30
- 0
spec/acceptance/basic_spec.rb View File

@@ -0,0 +1,30 @@
1
+require 'spec_helper_acceptance'
2
+
3
+describe 'puppet-haveged module' do
4
+  def pp_path
5
+    base_path = File.dirname(__FILE__)
6
+    File.join(base_path, 'fixtures')
7
+  end
8
+
9
+  def default_puppet_module
10
+    module_path = File.join(pp_path, 'default.pp')
11
+    File.read(module_path)
12
+  end
13
+
14
+  it 'should work with no errors' do
15
+    apply_manifest(default_puppet_module, catch_failures: true)
16
+  end
17
+
18
+  it 'should be idempotent' do
19
+    apply_manifest(default_puppet_module, catch_changes: true)
20
+  end
21
+
22
+  describe package('haveged') do
23
+    it { should be_installed }
24
+  end
25
+
26
+  describe service('haveged') do
27
+    it { should be_enabled }
28
+    it { should be_running }
29
+  end
30
+end

+ 1
- 0
spec/acceptance/fixtures/default.pp View File

@@ -0,0 +1 @@
1
+class { '::haveged': }

Loading…
Cancel
Save