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:
parent
0e2cbe1259
commit
c30510ad2f
35
spec/acceptance/basic_spec.rb
Executable file
35
spec/acceptance/basic_spec.rb
Executable 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
|
26
spec/acceptance/fixtures/default.pp
Normal file
26
spec/acceptance/fixtures/default.pp
Normal 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',
|
||||
}
|
Loading…
x
Reference in New Issue
Block a user