From fb49c42c4ce1a09af7cdf0d6a835c5b853486569 Mon Sep 17 00:00:00 2001 From: Colleen Murphy Date: Wed, 11 Jul 2018 10:41:20 +0200 Subject: [PATCH] Add beaker tests Add basic tests to ensure the redis class can be applied and that the server will run. Change-Id: I7cae75b31e0ed3a167fd7cb7c36bd4a5476c415d --- spec/acceptance/basic_spec.rb | 27 +++++++++++++++++++++++++++ spec/acceptance/fixtures/default.pp | 3 +++ 2 files changed, 30 insertions(+) create mode 100755 spec/acceptance/basic_spec.rb create mode 100644 spec/acceptance/fixtures/default.pp diff --git a/spec/acceptance/basic_spec.rb b/spec/acceptance/basic_spec.rb new file mode 100755 index 0000000..0f3bf9d --- /dev/null +++ b/spec/acceptance/basic_spec.rb @@ -0,0 +1,27 @@ +require 'puppet-openstack_infra_spec_helper/spec_helper_acceptance' + +describe 'redis', if: os[:family] == 'ubuntu' do + + def pp_path + base_path = File.dirname(__FILE__) + File.join(base_path, 'fixtures') + end + + def puppet_manifest + manifest_path = File.join(pp_path, 'default.pp') + File.read(manifest_path) + end + + it 'should work with no errors' do + apply_manifest(puppet_manifest, catch_failures: true) + end + + it 'should be idempotent' do + apply_manifest(puppet_manifest, catch_changes: true) + end + + describe service('redis-server') do + it { should be_running } + end + +end diff --git a/spec/acceptance/fixtures/default.pp b/spec/acceptance/fixtures/default.pp new file mode 100644 index 0000000..3c91434 --- /dev/null +++ b/spec/acceptance/fixtures/default.pp @@ -0,0 +1,3 @@ +class { 'redis': + version => '3.0.6', +}