From ebcfbac5e7d280f989ce894063bbaa250e90f964 Mon Sep 17 00:00:00 2001 From: Colleen Murphy Date: Sun, 1 Jul 2018 21:21:24 +0200 Subject: [PATCH] Add beaker tests Add tests for the client, dbserver, and fileserver classes. Change-Id: Iae7f2e8735648f91b8c62230fbc4b6480b6eef74 --- spec/acceptance/basic_spec.rb | 30 +++++++++++++++++++++++++++++ spec/acceptance/fixtures/default.pp | 16 +++++++++++++++ 2 files changed, 46 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..78db984 --- /dev/null +++ b/spec/acceptance/basic_spec.rb @@ -0,0 +1,30 @@ +require 'puppet-openstack_infra_spec_helper/spec_helper_acceptance' + +describe 'openafs', :if => ['debian', 'ubuntu'].include?(os[:family]) do + + def pp_path + base_path = File.dirname(__FILE__) + File.join(base_path, 'fixtures') + end + + def puppet_manifest + module_path = File.join(pp_path, 'default.pp') + File.read(module_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 + + ['openafs-client', 'openafs-fileserver'].each do |service| + describe command("systemctl status #{service}") do + its(:stdout) { should contain('Active: active') } + its(:stdout) { should_not contain('dead') } + end + end + +end diff --git a/spec/acceptance/fixtures/default.pp b/spec/acceptance/fixtures/default.pp new file mode 100644 index 0000000..15568ed --- /dev/null +++ b/spec/acceptance/fixtures/default.pp @@ -0,0 +1,16 @@ +class { 'openafs::client': + cell => 'openstack.org', + realm => 'OPENSTACK.ORG', +} + +class { '::openafs::fileserver': + cell => 'openstack.org', + dbservers => [ + { + name => 'localhost', + ip => '127.0.0.1', + } + ], +} + +class { '::openafs::dbserver': }