]> git.donarmstrong.com Git - dsa-puppet.git/blob - 3rdparty/modules/keystone/spec/acceptance/basic_keystone_spec.rb
try with modules from master
[dsa-puppet.git] / 3rdparty / modules / keystone / spec / acceptance / basic_keystone_spec.rb
1 require 'spec_helper_acceptance'
2
3 describe 'basic keystone server with resources' do
4
5   context 'default parameters' do
6
7     it 'should work with no errors' do
8       pp= <<-EOS
9       Exec { logoutput => 'on_failure' }
10
11       # Common resources
12       case $::osfamily {
13         'Debian': {
14           include ::apt
15           class { '::openstack_extras::repo::debian::ubuntu':
16             release => 'kilo',
17             package_require => true,
18           }
19         }
20         'RedHat': {
21           class { '::openstack_extras::repo::redhat::redhat':
22             release => 'kilo',
23           }
24           package { 'openstack-selinux': ensure => 'latest' }
25         }
26         default: {
27           fail("Unsupported osfamily (${::osfamily})")
28         }
29       }
30
31       class { '::mysql::server': }
32
33       # Keystone resources
34       class { '::keystone::client': }
35       class { '::keystone::cron::token_flush': }
36       class { '::keystone::db::mysql':
37         password => 'keystone',
38       }
39       class { '::keystone':
40         verbose             => true,
41         debug               => true,
42         database_connection => 'mysql://keystone:keystone@127.0.0.1/keystone',
43         admin_token         => 'admin_token',
44         enabled             => true,
45       }
46       class { '::keystone::roles::admin':
47         email    => 'test@example.tld',
48         password => 'a_big_secret',
49       }
50       class { '::keystone::endpoint':
51         public_url => "http://127.0.0.1:5000/",
52         admin_url  => "http://127.0.0.1:35357/",
53       }
54       ::keystone::resource::service_identity { 'beaker-ci':
55         service_type        => 'beaker',
56         service_description => 'beaker service',
57         service_name        => 'beaker',
58         password            => 'secret',
59         public_url          => 'http://127.0.0.1:1234',
60         admin_url           => 'http://127.0.0.1:1234',
61         internal_url        => 'http://127.0.0.1:1234',
62       }
63       EOS
64
65
66       # Run it twice and test for idempotency
67       apply_manifest(pp, :catch_failures => true)
68       apply_manifest(pp, :catch_changes => true)
69     end
70
71     describe port(5000) do
72       it { is_expected.to be_listening.with('tcp') }
73     end
74
75     describe port(35357) do
76       it { is_expected.to be_listening.with('tcp') }
77     end
78
79     describe cron do
80       it { should have_entry('1 0 * * * keystone-manage token_flush >>/var/log/keystone/keystone-tokenflush.log 2>&1').with_user('keystone') }
81     end
82
83     describe 'test keystone user/tenant/service/role/endpoint resources' do
84       it 'should find beaker user' do
85         shell('openstack --os-username admin --os-password a_big_secret --os-tenant-name openstack --os-auth-url http://127.0.0.1:5000/v2.0 user list') do |r|
86           expect(r.stdout).to match(/beaker/)
87           expect(r.stderr).to be_empty
88         end
89       end
90       it 'should find services tenant' do
91         shell('openstack --os-username admin --os-password a_big_secret --os-tenant-name openstack --os-auth-url http://127.0.0.1:5000/v2.0 project list') do |r|
92           expect(r.stdout).to match(/services/)
93           expect(r.stderr).to be_empty
94         end
95       end
96       it 'should find beaker service' do
97         shell('openstack --os-username admin --os-password a_big_secret --os-tenant-name openstack --os-auth-url http://127.0.0.1:5000/v2.0 service list') do |r|
98           expect(r.stdout).to match(/beaker/)
99           expect(r.stderr).to be_empty
100         end
101       end
102       it 'should find admin role' do
103         shell('openstack --os-username admin --os-password a_big_secret --os-tenant-name openstack --os-auth-url http://127.0.0.1:5000/v2.0 role list') do |r|
104           expect(r.stdout).to match(/admin/)
105           expect(r.stderr).to be_empty
106         end
107       end
108       it 'should find beaker endpoints' do
109         shell('openstack --os-username admin --os-password a_big_secret --os-tenant-name openstack --os-auth-url http://127.0.0.1:5000/v2.0 endpoint list --long') do |r|
110           expect(r.stdout).to match(/1234/)
111           expect(r.stderr).to be_empty
112         end
113       end
114     end
115   end
116 end