Browse Source

Add beaker tests

Add basic tests to ensure the puppet manifests can be applied cleanly
and the service will start.

We could test with a real IRC network and a real registered IRC user,
but the service starts just fine even if it can't connect to an IRC
server, and it's not the puppet module's job to test the bot itself,
it's sufficient to test that the server is configured the way we expect
it to be.

Change-Id: If153cdbfcd0a78b25ca01f22a10ab1c9055c0766
master
Colleen Murphy 10 months ago
parent
commit
b6c60c0414

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

@@ -0,0 +1,36 @@
1
+require 'puppet-openstack_infra_spec_helper/spec_helper_acceptance'
2
+
3
+describe 'statusbot' do
4
+
5
+  def pp_path
6
+    base_path = File.dirname(__FILE__)
7
+    File.join(base_path, 'fixtures')
8
+  end
9
+
10
+  def puppet_manifest
11
+    manifest_path = File.join(pp_path, 'default.pp')
12
+    File.read(manifest_path)
13
+  end
14
+
15
+  def postconditions_puppet_manifest
16
+    manifest_path = File.join(pp_path, 'postconditions.pp')
17
+    File.read(manifest_path)
18
+  end
19
+
20
+  it 'should work with no errors' do
21
+    apply_manifest(puppet_manifest, catch_failures: true)
22
+  end
23
+
24
+  it 'should be idempotent' do
25
+    apply_manifest(puppet_manifest, catch_changes: true)
26
+  end
27
+
28
+  it 'should start' do
29
+    apply_manifest(postconditions_puppet_manifest, catch_failures: true)
30
+  end
31
+
32
+  describe service('statusbot') do
33
+    it { should be_running }
34
+  end
35
+
36
+end

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

@@ -0,0 +1,15 @@
1
+class { 'statusbot':
2
+  nick                 => 'statusbot-test',
3
+  password             => 'statusbot-password',
4
+  server               => 'irc.notreal.net',
5
+  channels             => 'unrealchannel',
6
+  auth_nicks           => 'statusbot-test',
7
+  wiki_user            => 'dummy',
8
+  wiki_password        => 'dummy',
9
+  wiki_url             => 'dummy',
10
+  wiki_pageid          => 'dummy',
11
+  wiki_successpageid   => 'dummy',
12
+  wiki_successpageurl  => 'dummy',
13
+  wiki_thankspageid    => 'dummy',
14
+  wiki_thankspageurl   => 'dummy',
15
+}

+ 3
- 0
spec/acceptance/fixtures/postconditions.pp View File

@@ -0,0 +1,3 @@
1
+service { 'statusbot':
2
+  ensure => running,
3
+}

Loading…
Cancel
Save