forked from sous-chefs/java
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathoracle_spec.rb
More file actions
99 lines (85 loc) · 2.65 KB
/
Copy pathoracle_spec.rb
File metadata and controls
99 lines (85 loc) · 2.65 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
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
require 'spec_helper'
describe 'java::oracle' do
let(:chef_run) do
runner = ChefSpec::ServerRunner.new
runner.converge(described_recipe)
end
it 'should include the set_java_home recipe' do
expect(chef_run).to include_recipe('java::set_java_home')
end
it 'should configure a java_ark[jdk] resource' do
pending "Testing LWRP use is not required at this time, this is tested post-converge."
this_should_not_get_executed
end
describe 'conditionally includes set attributes' do
context 'when java_home is set' do
let(:chef_run) do
runner = ChefSpec::ServerRunner.new(
:platform => 'ubuntu',
:version => '12.04'
)
runner.node.set['java']['java_home'] = "/some/path"
runner.converge(described_recipe)
end
it 'does not include set_attributes_from_version' do
expect(chef_run).to_not include_recipe('java::set_attributes_from_version')
end
end
context 'when java_home is not set' do
let(:chef_run) do
runner = ChefSpec::ServerRunner.new(
:platform => 'ubuntu',
:version => '12.04'
)
runner.converge(described_recipe)
end
it 'does not include set_attributes_from_version' do
expect(chef_run).to include_recipe('java::set_attributes_from_version')
end
end
end
describe 'default-java' do
context 'ubuntu' do
let(:chef_run) do
ChefSpec::ServerRunner.new(
:platform => 'ubuntu',
:version => '12.04'
).converge(described_recipe)
end
it 'includes default_java_symlink' do
expect(chef_run).to include_recipe('java::default_java_symlink')
end
end
context 'centos' do
let(:chef_run) do
ChefSpec::ServerRunner.new(
:platform => 'centos',
:version => '6.4'
).converge(described_recipe)
end
it 'does not include default_java_symlink' do
expect(chef_run).to_not include_recipe('java::default_java_symlink')
end
end
end
describe 'JCE installation' do
context 'when jce is disabled' do
let(:chef_run) do
ChefSpec::ServerRunner.new.converge(described_recipe)
end
it 'does not include jce recipe' do
expect(chef_run).to_not include_recipe('java::oracle_jce')
end
end
context 'when jce is enabled' do
let(:chef_run) do
ChefSpec::ServerRunner.new do |node|
node.set['java']['oracle']['jce']['enabled'] = true
end.converge(described_recipe)
end
it 'does include jce recipe' do
expect(chef_run).to include_recipe('java::oracle_jce')
end
end
end
end