Add beaker tests

Add basic tests to ensure the puppet classes apply cleanly and the site
comes up. Uses a stubbed version of planet.ini to avoid waiting to sync
all the content.

Change-Id: I6baa4a1ba977845e6648932f6c2f15949fe6d0ff
This commit is contained in:
Colleen Murphy 2018-07-11 17:28:28 +02:00 committed by Colleen Murphy
parent 6d20d0feb7
commit 40c7c1c223
2 changed files with 65 additions and 0 deletions

31
spec/acceptance/basic_spec.rb Executable file
View File

@ -0,0 +1,31 @@
require 'puppet-openstack_infra_spec_helper/spec_helper_acceptance'
describe 'planet', 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 command('cd /var/lib/planet/openstack && planet /var/lib/planet/openstack/planet.ini') do
its(:exit_status) { should eq 0 }
end
describe command('curl http://localhost') do
its(:stdout) { should contain('<title>Planet OpenStack</title>') }
end
end

View File

@ -0,0 +1,34 @@
include ::planet
planet::site { 'openstack':
git_url => 'git://git.openstack.org/openstack/openstack-planet',
}
$planet_config = '[Planet]
name = Planet OpenStack
link = http://planet.openstack.org/
owner_name = Monty Taylor
owner_email = mordred@inaugust.com
output_theme = classic_fancy
cache_directory = cache
output_dir = /srv/planet/openstack
feed_timeout = 20
items_per_page = 60
future_dates = ignore_date
log_level = DEBUG
bill_of_materials:
images/#{face}
[DEFAULT]
facewidth = 85
faceheight = 85
[http://www.openstack.org/blog/feed/]
name = OpenStack Blog
nick = openstack'
file { '/var/lib/planet/openstack/planet.ini':
ensure => present,
content => $planet_config,
require => Vcsrepo['/var/lib/planet/openstack'],
}