forked from theforeman/puppet-foreman
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathforeman_database_spec.rb
More file actions
76 lines (65 loc) · 2.07 KB
/
foreman_database_spec.rb
File metadata and controls
76 lines (65 loc) · 2.07 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
require 'spec_helper'
describe 'foreman::database' do
on_supported_os.each do |os, facts|
next if only_test_os() and not only_test_os.include?(os)
next if exclude_test_os() and exclude_test_os.include?(os)
context "on #{os}" do
let(:facts) do
facts.merge({
:concat_basedir => '/tmp',
:interfaces => '',
})
end
describe 'without parameters' do
let :pre_condition do
"class {'foreman':}"
end
it { should contain_class('foreman::database::postgresql') }
it { should contain_foreman_config_entry('db_pending_migration') }
it { should contain_foreman__rake('db:migrate') }
it { should contain_foreman_config_entry('db_pending_seed') }
it { should contain_foreman__rake('db:seed') }
it { should contain_foreman__rake('apipie:cache:index') }
end
describe 'with seed parameters' do
let :pre_condition do
"class {'foreman':
admin_username => 'joe',
admin_password => 'secret',
}"
end
it {
should contain_foreman__rake('db:seed').
with_environment({
'SEED_ADMIN_USER' => 'joe',
'SEED_ADMIN_PASSWORD' => 'secret',
})
}
end
describe 'with apipie_task' do
let :pre_condition do
"class {'foreman':
apipie_task => 'apipie:cache',
}"
end
it { should contain_foreman__rake('apipie:cache') }
end
describe 'with mysql db_type' do
let :pre_condition do
"class { 'foreman':
db_type => 'mysql'
}"
end
it { should_not contain_class('foreman::database::postgresql') }
it { should contain_class('foreman::database::mysql') }
it { should contain_class('mysql::server') }
it { should contain_class('mysql::server::account_security') }
it {
should contain_mysql__db('foreman').with({
:user => 'foreman',
})
}
end
end
end
end