Add beaker tests

Add tests to ensure the manifests apply cleanly and a kerberos ticket
can be granted.

The krb5-admin-server service won't start without the realm being
manually set up, so add those steps in between running the manifest once
and checking for idempotency. Once the realm is set up, the service will
automatically start and puppet shouldn't try to start it again.

Change-Id: I7f8aea80ea40bf4ff28fafa6a53c9d26e9c303ec
This commit is contained in:
Colleen Murphy 2018-07-12 15:52:40 +02:00
parent 0e2cbe1259
commit c30510ad2f
2 changed files with 61 additions and 0 deletions

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

@ -0,0 +1,35 @@
require 'puppet-openstack_infra_spec_helper/spec_helper_acceptance'
describe 'kerberos', 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
# Realm needs to be manually set up before admin service will start
it 'set up the kerberos realm' do
shell('yes krbpass | krb5_newrealm')
shell('echo "addprinc -randkey host/krbtest.openstack.ci" | kadmin.local')
shell('echo "ktadd host/krbtest.openstack.ci" | kadmin.local')
shell('echo "addprinc -pw rootpw root@OPENSTACK.CI" | kadmin.local')
end
it 'should be idempotent' do
apply_manifest(puppet_manifest, catch_changes: true)
end
describe command('echo rootpw | kinit') do
its(:exit_status) { should eq 0 }
end
end

View File

@ -0,0 +1,26 @@
host { 'krbtest.openstack.ci':
ensure => present,
host_aliases => 'krbtest',
ip => '127.0.1.1',
}
exec { 'set hostname':
command => '/bin/hostname krbtest',
unless => '/usr/bin/test "$(/bin/hostname)" == "krbtest"',
}
class { 'kerberos::server':
realm => 'OPENSTACK.CI',
kdcs => [
'krbtest.openstack.ci',
],
admin_server => 'krbtest.openstack.ci',
slaves => [ ],
slave => false,
}
class { 'kerberos::client':
admin_server => 'krbtest.openstack.ci',
kdcs => ['krbtest.openstack.ci'],
realm => 'OPENSTACK.CI',
}