summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorColleen Murphy <colleen.murphy@suse.de>2018-07-12 13:24:46 +0200
committerColleen Murphy <colleen.murphy@suse.de>2018-08-08 23:34:21 +0200
commitb6c60c0414279b4f3ad1bca2aacf65b6a7c85c7f (patch)
tree2398c11d7c5403894f2452f002d55ed256b5cc77
parent3973ed99a2b8487b45427363652966c5f0a171dd (diff)
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
Notes
Notes (review): Code-Review+2: Clark Boylan <cboylan@sapwetik.org> Code-Review+2: Ian Wienand <iwienand@redhat.com> Workflow+1: Ian Wienand <iwienand@redhat.com> Verified+2: Zuul Submitted-by: Zuul Submitted-at: Wed, 21 Nov 2018 22:49:09 +0000 Reviewed-on: https://review.openstack.org/582153 Project: openstack-infra/puppet-statusbot Branch: refs/heads/master
-rwxr-xr-xspec/acceptance/basic_spec.rb36
-rw-r--r--spec/acceptance/fixtures/default.pp15
-rw-r--r--spec/acceptance/fixtures/postconditions.pp3
3 files changed, 54 insertions, 0 deletions
diff --git a/spec/acceptance/basic_spec.rb b/spec/acceptance/basic_spec.rb
new file mode 100755
index 0000000..abdbd2e
--- /dev/null
+++ b/spec/acceptance/basic_spec.rb
@@ -0,0 +1,36 @@
1require 'puppet-openstack_infra_spec_helper/spec_helper_acceptance'
2
3describe '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
36end
diff --git a/spec/acceptance/fixtures/default.pp b/spec/acceptance/fixtures/default.pp
new file mode 100644
index 0000000..190a69d
--- /dev/null
+++ b/spec/acceptance/fixtures/default.pp
@@ -0,0 +1,15 @@
1class { '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}
diff --git a/spec/acceptance/fixtures/postconditions.pp b/spec/acceptance/fixtures/postconditions.pp
new file mode 100644
index 0000000..8359147
--- /dev/null
+++ b/spec/acceptance/fixtures/postconditions.pp
@@ -0,0 +1,3 @@
1service { 'statusbot':
2 ensure => running,
3}