bosh-stemcell 1.5.0.pre.1113
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- data/.rspec +3 -0
- data/README.md +104 -0
- data/Vagrantfile +37 -0
- data/bosh-stemcell.gemspec +28 -0
- data/lib/bosh/stemcell.rb +4 -0
- data/lib/bosh/stemcell/archive.rb +59 -0
- data/lib/bosh/stemcell/archive_filename.rb +29 -0
- data/lib/bosh/stemcell/aws/ami.rb +58 -0
- data/lib/bosh/stemcell/aws/light_stemcell.rb +44 -0
- data/lib/bosh/stemcell/aws/region.rb +15 -0
- data/lib/bosh/stemcell/builder_command.rb +174 -0
- data/lib/bosh/stemcell/builder_options.rb +85 -0
- data/lib/bosh/stemcell/disk_image.rb +61 -0
- data/lib/bosh/stemcell/infrastructure.rb +49 -0
- data/lib/bosh/stemcell/operating_system.rb +31 -0
- data/lib/bosh/stemcell/stage_collection.rb +154 -0
- data/lib/bosh/stemcell/stage_runner.rb +53 -0
- data/lib/bosh/stemcell/version.rb +5 -0
- data/lib/monkeypatch/serverspec/backend/exec.rb +86 -0
- data/spec/assets/fake-stemcell-aws.tgz +0 -0
- data/spec/assets/fake-stemcell-vsphere.tgz +0 -0
- data/spec/assets/light-fake-stemcell-aws.tgz +0 -0
- data/spec/bosh/monkeypatch/serverspec/backend/exec_spec.rb +46 -0
- data/spec/bosh/stemcell/archive_filename_spec.rb +42 -0
- data/spec/bosh/stemcell/archive_spec.rb +98 -0
- data/spec/bosh/stemcell/aws/ami_spec.rb +30 -0
- data/spec/bosh/stemcell/aws/light_stemcell_spec.rb +94 -0
- data/spec/bosh/stemcell/aws/region_spec.rb +12 -0
- data/spec/bosh/stemcell/builder_command_spec.rb +241 -0
- data/spec/bosh/stemcell/builder_options_spec.rb +201 -0
- data/spec/bosh/stemcell/disk_image_spec.rb +163 -0
- data/spec/bosh/stemcell/infrastructure_spec.rb +66 -0
- data/spec/bosh/stemcell/operating_system_spec.rb +47 -0
- data/spec/bosh/stemcell/stage_collection_spec.rb +213 -0
- data/spec/bosh/stemcell/stage_runner_spec.rb +141 -0
- data/spec/bosh/stemcell/version_spec.rb +12 -0
- data/spec/bosh/stemcell_spec.rb +6 -0
- data/spec/spec_helper.rb +6 -0
- data/spec/stemcells/aws_spec.rb +9 -0
- data/spec/stemcells/centos_spec.rb +131 -0
- data/spec/stemcells/openstack_spec.rb +9 -0
- data/spec/stemcells/ubuntu_spec.rb +143 -0
- data/spec/stemcells/vsphere_spec.rb +9 -0
- data/spec/support/rspec_fire.rb +9 -0
- data/spec/support/serverspec.rb +4 -0
- data/spec/support/spec_assets.rb +11 -0
- data/spec/support/stemcell_image.rb +26 -0
- data/spec/support/stemcell_shared_examples.rb +43 -0
- data/spec/support/stub_env.rb +5 -0
- metadata +236 -0
@@ -0,0 +1,213 @@
|
|
1
|
+
require 'spec_helper'
|
2
|
+
require 'bosh/stemcell/stage_collection'
|
3
|
+
|
4
|
+
module Bosh::Stemcell
|
5
|
+
describe StageCollection do
|
6
|
+
subject(:stage_collection) do
|
7
|
+
StageCollection.new(
|
8
|
+
infrastructure: infrastructure,
|
9
|
+
operating_system: operating_system
|
10
|
+
)
|
11
|
+
end
|
12
|
+
|
13
|
+
describe '#operating_system_stages' do
|
14
|
+
context 'when infrastructure is AWS' do
|
15
|
+
let(:infrastructure) { Infrastructure.for('aws') }
|
16
|
+
|
17
|
+
context 'when operating system is Ubuntu' do
|
18
|
+
let(:operating_system) { OperatingSystem.for('ubuntu') }
|
19
|
+
|
20
|
+
it 'has the correct stages' do
|
21
|
+
expect(stage_collection.operating_system_stages).to eq([
|
22
|
+
:base_debootstrap,
|
23
|
+
:base_apt,
|
24
|
+
:bosh_users,
|
25
|
+
:bosh_monit,
|
26
|
+
:bosh_ruby,
|
27
|
+
:bosh_agent,
|
28
|
+
:bosh_sysstat,
|
29
|
+
:bosh_sysctl,
|
30
|
+
:bosh_ntpdate,
|
31
|
+
:bosh_sudoers,
|
32
|
+
:bosh_micro,
|
33
|
+
:system_grub,
|
34
|
+
:system_kernel,
|
35
|
+
])
|
36
|
+
end
|
37
|
+
end
|
38
|
+
end
|
39
|
+
|
40
|
+
context 'when infrastructure is OpenStack' do
|
41
|
+
let(:infrastructure) { Infrastructure.for('openstack') }
|
42
|
+
|
43
|
+
context 'when operating system is Ubuntu' do
|
44
|
+
let(:operating_system) { OperatingSystem.for('ubuntu') }
|
45
|
+
|
46
|
+
it 'has the correct stages' do
|
47
|
+
expect(stage_collection.operating_system_stages).to eq([
|
48
|
+
:base_debootstrap,
|
49
|
+
:base_apt,
|
50
|
+
:bosh_users,
|
51
|
+
:bosh_monit,
|
52
|
+
:bosh_ruby,
|
53
|
+
:bosh_agent,
|
54
|
+
:bosh_sysstat,
|
55
|
+
:bosh_sysctl,
|
56
|
+
:bosh_ntpdate,
|
57
|
+
:bosh_sudoers,
|
58
|
+
:bosh_micro,
|
59
|
+
:system_grub,
|
60
|
+
:system_kernel,
|
61
|
+
])
|
62
|
+
end
|
63
|
+
end
|
64
|
+
end
|
65
|
+
|
66
|
+
context 'when infrastructure is vSphere' do
|
67
|
+
let(:infrastructure) { Infrastructure.for('vsphere') }
|
68
|
+
|
69
|
+
context 'when operating system is CentOS' do
|
70
|
+
let(:operating_system) { OperatingSystem.for('centos') }
|
71
|
+
|
72
|
+
it 'has the correct stages' do
|
73
|
+
expect(stage_collection.operating_system_stages).to eq([
|
74
|
+
:base_centos,
|
75
|
+
:base_yum,
|
76
|
+
:bosh_users,
|
77
|
+
:bosh_monit,
|
78
|
+
:bosh_ruby,
|
79
|
+
:bosh_agent,
|
80
|
+
#:bosh_sysstat,
|
81
|
+
#:bosh_sysctl,
|
82
|
+
#:bosh_ntpdate,
|
83
|
+
:bosh_sudoers,
|
84
|
+
:bosh_micro,
|
85
|
+
:system_grub,
|
86
|
+
#:system_kernel,
|
87
|
+
])
|
88
|
+
end
|
89
|
+
end
|
90
|
+
|
91
|
+
context 'when operating system is Ubuntu' do
|
92
|
+
let(:operating_system) { OperatingSystem.for('ubuntu') }
|
93
|
+
|
94
|
+
it 'has the correct stages' do
|
95
|
+
expect(stage_collection.operating_system_stages).to eq([
|
96
|
+
:base_debootstrap,
|
97
|
+
:base_apt,
|
98
|
+
:bosh_users,
|
99
|
+
:bosh_monit,
|
100
|
+
:bosh_ruby,
|
101
|
+
:bosh_agent,
|
102
|
+
:bosh_sysstat,
|
103
|
+
:bosh_sysctl,
|
104
|
+
:bosh_ntpdate,
|
105
|
+
:bosh_sudoers,
|
106
|
+
:bosh_micro,
|
107
|
+
:system_grub,
|
108
|
+
:system_kernel,
|
109
|
+
])
|
110
|
+
end
|
111
|
+
end
|
112
|
+
end
|
113
|
+
end
|
114
|
+
|
115
|
+
describe '#infrastructure_stages' do
|
116
|
+
context 'when infrastructure is AWS' do
|
117
|
+
let(:infrastructure) { Infrastructure.for('aws') }
|
118
|
+
|
119
|
+
context 'when operating system is Ubuntu' do
|
120
|
+
let(:operating_system) { OperatingSystem.for('ubuntu') }
|
121
|
+
|
122
|
+
it 'has the correct stages' do
|
123
|
+
expect(stage_collection.infrastructure_stages).to eq([
|
124
|
+
:system_aws_network,
|
125
|
+
:system_aws_clock,
|
126
|
+
:system_aws_modules,
|
127
|
+
:system_parameters,
|
128
|
+
:bosh_clean,
|
129
|
+
:bosh_harden,
|
130
|
+
:bosh_harden_ssh,
|
131
|
+
:bosh_dpkg_list,
|
132
|
+
:image_create,
|
133
|
+
:image_install_grub,
|
134
|
+
:image_aws_update_grub,
|
135
|
+
:image_aws_prepare_stemcell,
|
136
|
+
:stemcell
|
137
|
+
])
|
138
|
+
end
|
139
|
+
end
|
140
|
+
end
|
141
|
+
|
142
|
+
context 'when infrastructure is OpenStack' do
|
143
|
+
let(:infrastructure) { Infrastructure.for('openstack') }
|
144
|
+
|
145
|
+
context 'when operating system is Ubuntu' do
|
146
|
+
let(:operating_system) { OperatingSystem.for('ubuntu') }
|
147
|
+
|
148
|
+
it 'has the correct stages' do
|
149
|
+
expect(stage_collection.infrastructure_stages).to eq([
|
150
|
+
:system_openstack_network,
|
151
|
+
:system_openstack_clock,
|
152
|
+
:system_openstack_modules,
|
153
|
+
:system_parameters,
|
154
|
+
:bosh_clean,
|
155
|
+
:bosh_harden,
|
156
|
+
:bosh_harden_ssh,
|
157
|
+
:bosh_dpkg_list,
|
158
|
+
:image_create,
|
159
|
+
:image_install_grub,
|
160
|
+
:image_openstack_qcow2,
|
161
|
+
:image_openstack_prepare_stemcell,
|
162
|
+
:stemcell_openstack
|
163
|
+
])
|
164
|
+
end
|
165
|
+
end
|
166
|
+
end
|
167
|
+
|
168
|
+
context 'when infrastructure is vSphere' do
|
169
|
+
let(:infrastructure) { Infrastructure.for('vsphere') }
|
170
|
+
|
171
|
+
context 'when operating system is CentOS' do
|
172
|
+
let(:operating_system) { OperatingSystem.for('centos') }
|
173
|
+
|
174
|
+
it 'has the correct stages' do
|
175
|
+
expect(stage_collection.infrastructure_stages).to eq([
|
176
|
+
#:system_open_vm_tools,
|
177
|
+
:system_parameters,
|
178
|
+
:bosh_clean,
|
179
|
+
#:bosh_harden,
|
180
|
+
#:bosh_dpkg_list,
|
181
|
+
:image_create,
|
182
|
+
:image_install_grub,
|
183
|
+
:image_vsphere_vmx,
|
184
|
+
:image_vsphere_ovf,
|
185
|
+
:image_vsphere_prepare_stemcell,
|
186
|
+
:stemcell
|
187
|
+
])
|
188
|
+
end
|
189
|
+
end
|
190
|
+
|
191
|
+
context 'when operating system is Ubuntu' do
|
192
|
+
let(:operating_system) { OperatingSystem.for('ubuntu') }
|
193
|
+
|
194
|
+
it 'has the correct stages' do
|
195
|
+
expect(stage_collection.infrastructure_stages).to eq([
|
196
|
+
:system_open_vm_tools,
|
197
|
+
:system_parameters,
|
198
|
+
:bosh_clean,
|
199
|
+
:bosh_harden,
|
200
|
+
:bosh_dpkg_list,
|
201
|
+
:image_create,
|
202
|
+
:image_install_grub,
|
203
|
+
:image_vsphere_vmx,
|
204
|
+
:image_vsphere_ovf,
|
205
|
+
:image_vsphere_prepare_stemcell,
|
206
|
+
:stemcell
|
207
|
+
])
|
208
|
+
end
|
209
|
+
end
|
210
|
+
end
|
211
|
+
end
|
212
|
+
end
|
213
|
+
end
|
@@ -0,0 +1,141 @@
|
|
1
|
+
require 'spec_helper'
|
2
|
+
require 'timecop'
|
3
|
+
require 'bosh/stemcell/stage_runner'
|
4
|
+
|
5
|
+
module Bosh::Stemcell
|
6
|
+
describe StageRunner do
|
7
|
+
include FakeFS::SpecHelpers
|
8
|
+
|
9
|
+
let(:shell) { instance_double('Bosh::Core::Shell', run: nil) }
|
10
|
+
|
11
|
+
let(:stages) { [:stage_0, :stage_1] }
|
12
|
+
let(:build_path) { '/fake/path/to/build_dir' }
|
13
|
+
let(:command_env) { 'env FOO=bar' }
|
14
|
+
let(:settings_file) { '/fake/path/to/settings.bash' }
|
15
|
+
let(:work_path) { '/fake/path/to/work_dir' }
|
16
|
+
|
17
|
+
subject(:stage_runner) do
|
18
|
+
described_class.new(build_path: build_path,
|
19
|
+
command_env: command_env,
|
20
|
+
settings_file: settings_file,
|
21
|
+
work_path: work_path)
|
22
|
+
end
|
23
|
+
|
24
|
+
before do
|
25
|
+
Bosh::Core::Shell.stub(:new).and_return(shell)
|
26
|
+
|
27
|
+
stage_runner.stub(:puts)
|
28
|
+
end
|
29
|
+
|
30
|
+
describe '#initialize' do
|
31
|
+
it 'requires :build_path' do
|
32
|
+
expect {
|
33
|
+
StageRunner.new(stages: 'FAKE', command_env: 'FAKE', settings_file: 'FAKE', work_path: 'FAKE')
|
34
|
+
}.to raise_error('key not found: :build_path')
|
35
|
+
end
|
36
|
+
|
37
|
+
it 'requires :command_env' do
|
38
|
+
expect {
|
39
|
+
StageRunner.new(stages: 'FAKE', build_path: 'FAKE', settings_file: 'FAKE', work_path: 'FAKE')
|
40
|
+
}.to raise_error('key not found: :command_env')
|
41
|
+
end
|
42
|
+
|
43
|
+
it 'requires :settings_file' do
|
44
|
+
expect {
|
45
|
+
StageRunner.new(stages: 'FAKE', build_path: 'FAKE', command_env: 'FAKE', work_path: 'FAKE')
|
46
|
+
}.to raise_error('key not found: :settings_file')
|
47
|
+
end
|
48
|
+
|
49
|
+
it 'requires :work_path' do
|
50
|
+
expect {
|
51
|
+
StageRunner.new(stages: 'FAKE', build_path: 'FAKE', command_env: 'FAKE', settings_file: 'FAKE')
|
52
|
+
}.to raise_error('key not found: :work_path')
|
53
|
+
end
|
54
|
+
end
|
55
|
+
|
56
|
+
describe '#configure' do
|
57
|
+
before do
|
58
|
+
stages.each do |stage|
|
59
|
+
stage_dir = File.join(File.join(build_path, 'stages'), stage.to_s)
|
60
|
+
FileUtils.mkdir_p(stage_dir)
|
61
|
+
|
62
|
+
config_script = File.join(stage_dir, 'config.sh')
|
63
|
+
FileUtils.touch(config_script)
|
64
|
+
File.chmod(0700, config_script)
|
65
|
+
end
|
66
|
+
|
67
|
+
File.stub(executable?: true) # because FakeFs does not support :executable?
|
68
|
+
end
|
69
|
+
|
70
|
+
it 'prints the expected messages' do
|
71
|
+
stage_runner.should_receive(:puts).with("=== Configuring 'stage_0' stage ===")
|
72
|
+
stage_runner.should_receive(:puts).with("=== Configuring 'stage_1' stage ===")
|
73
|
+
|
74
|
+
stage_runner.configure(stages)
|
75
|
+
end
|
76
|
+
|
77
|
+
it 'runs the configure script for each stage in order' do
|
78
|
+
shell.should_receive(:run).
|
79
|
+
with('sudo env FOO=bar /fake/path/to/build_dir/stages/stage_0/config.sh /fake/path/to/settings.bash 2>&1')
|
80
|
+
shell.should_receive(:run).
|
81
|
+
with('sudo env FOO=bar /fake/path/to/build_dir/stages/stage_1/config.sh /fake/path/to/settings.bash 2>&1')
|
82
|
+
|
83
|
+
stage_runner.configure(stages)
|
84
|
+
end
|
85
|
+
|
86
|
+
context 'when a stage does not have a config.sh file' do
|
87
|
+
before do
|
88
|
+
FileUtils.rm('/fake/path/to/build_dir/stages/stage_0/config.sh')
|
89
|
+
end
|
90
|
+
|
91
|
+
it 'does not attempt to run the configure step which is missing a config.sh' do
|
92
|
+
shell.should_not_receive(:run).
|
93
|
+
with('sudo env FOO=bar /fake/path/to/build_dir/stages/stage_0/config.sh /fake/path/to/settings.bash 2>&1')
|
94
|
+
shell.should_receive(:run).
|
95
|
+
with('sudo env FOO=bar /fake/path/to/build_dir/stages/stage_1/config.sh /fake/path/to/settings.bash 2>&1')
|
96
|
+
|
97
|
+
stage_runner.configure(stages)
|
98
|
+
end
|
99
|
+
end
|
100
|
+
|
101
|
+
context 'when a stage has config.sh file which is not executable' do
|
102
|
+
before do
|
103
|
+
File.stub(:executable?).with('/fake/path/to/build_dir/stages/stage_1/config.sh').and_return(false)
|
104
|
+
end
|
105
|
+
|
106
|
+
it 'does not attempt to run the configure step which has a non-executable config.sh' do
|
107
|
+
shell.should_receive(:run).
|
108
|
+
with('sudo env FOO=bar /fake/path/to/build_dir/stages/stage_0/config.sh /fake/path/to/settings.bash 2>&1')
|
109
|
+
shell.should_not_receive(:run).
|
110
|
+
with('sudo env FOO=bar /fake/path/to/build_dir/stages/stage_1/config.sh /fake/path/to/settings.bash 2>&1')
|
111
|
+
|
112
|
+
stage_runner.configure(stages)
|
113
|
+
end
|
114
|
+
end
|
115
|
+
end
|
116
|
+
|
117
|
+
describe '#apply' do
|
118
|
+
it 'prints the expected messages' do
|
119
|
+
Timecop.freeze do
|
120
|
+
stage_runner.should_receive(:puts).with("=== Applying 'stage_0' stage ===")
|
121
|
+
stage_runner.should_receive(:puts).with("== Started #{Time.now.strftime('%a %b %e %H:%M:%S %Z %Y')} ==")
|
122
|
+
stage_runner.should_receive(:puts).with("=== Applying 'stage_1' stage ===")
|
123
|
+
stage_runner.should_receive(:puts).with("== Started #{Time.now.strftime('%a %b %e %H:%M:%S %Z %Y')} ==")
|
124
|
+
|
125
|
+
stage_runner.apply(stages)
|
126
|
+
end
|
127
|
+
end
|
128
|
+
|
129
|
+
it 'runs the apply script for each stage in order' do
|
130
|
+
FileUtils.should_receive(:mkdir_p).with(File.join(work_path, 'work')).exactly(2).times
|
131
|
+
|
132
|
+
shell.should_receive(:run).
|
133
|
+
with('sudo env FOO=bar /fake/path/to/build_dir/stages/stage_0/apply.sh /fake/path/to/work_dir/work 2>&1')
|
134
|
+
shell.should_receive(:run).
|
135
|
+
with('sudo env FOO=bar /fake/path/to/build_dir/stages/stage_1/apply.sh /fake/path/to/work_dir/work 2>&1')
|
136
|
+
|
137
|
+
stage_runner.apply(stages)
|
138
|
+
end
|
139
|
+
end
|
140
|
+
end
|
141
|
+
end
|
@@ -0,0 +1,12 @@
|
|
1
|
+
require 'spec_helper'
|
2
|
+
require 'bosh/stemcell/version'
|
3
|
+
|
4
|
+
module Bosh::Stemcell
|
5
|
+
describe VERSION do
|
6
|
+
let(:bosh_version_file) do
|
7
|
+
File.expand_path('../../../../BOSH_VERSION', File.dirname(__FILE__))
|
8
|
+
end
|
9
|
+
|
10
|
+
it { should eq(File.read(bosh_version_file).strip) }
|
11
|
+
end
|
12
|
+
end
|
data/spec/spec_helper.rb
ADDED
@@ -0,0 +1,131 @@
|
|
1
|
+
require 'spec_helper'
|
2
|
+
|
3
|
+
describe 'CentOs Stemcell' do
|
4
|
+
|
5
|
+
it_behaves_like 'a stemcell'
|
6
|
+
|
7
|
+
describe package('apt') do
|
8
|
+
it { should_not be_installed }
|
9
|
+
end
|
10
|
+
|
11
|
+
describe package('rpm') do
|
12
|
+
it { should be_installed }
|
13
|
+
end
|
14
|
+
|
15
|
+
context 'installed by base_centos' do
|
16
|
+
{
|
17
|
+
'centos-release' => '6-4.el6.centos.10.x86_64',
|
18
|
+
'epel-release' => '6-8.noarch',
|
19
|
+
}.each do |pkg, version|
|
20
|
+
describe package(pkg) do
|
21
|
+
it { should be_installed.with_version(version) }
|
22
|
+
end
|
23
|
+
end
|
24
|
+
|
25
|
+
describe file('/etc/sysconfig/network') do
|
26
|
+
it { should be_file }
|
27
|
+
end
|
28
|
+
end
|
29
|
+
|
30
|
+
context 'installed by base_yum' do
|
31
|
+
{
|
32
|
+
'upstart' => '0.6.5-12.el6_4.1.x86_64',
|
33
|
+
'openssl-devel' => '1.0.0-27.el6_4.2',
|
34
|
+
'lsof' => '4.82-4.el6.x86_64',
|
35
|
+
'quota' => '3.17-18.el6.x86_64',
|
36
|
+
'rsync' => '3.0.6-9.el6.x86_64',
|
37
|
+
'strace' => '4.5.19-1.17.el6.x86_64',
|
38
|
+
'iptables' => '1.4.7-9.el6.x86_64',
|
39
|
+
'sysstat' => '9.0.4-20.el6.x86_64',
|
40
|
+
'tcpdump' => '4.0.0-3.20090921gitdf3cb4.2.el6.x86_64',
|
41
|
+
'dhclient' => '4.1.1-34.P1.el6_4.1.x86_64',
|
42
|
+
'zip' => '3.0-1.el6.x86_64',
|
43
|
+
'traceroute' => '2.0.14-2.el6.x86_64',
|
44
|
+
'gdb' => '7.2-60.el6_4.1.x86_64',
|
45
|
+
'curl' => '7.19.7-37.el6_4.x86_64',
|
46
|
+
'readline-devel' => '6.0-4.el6.x86_64',
|
47
|
+
'flex' => '2.5.35-8.el6.x86_64',
|
48
|
+
'openssh-server' => '5.3p1-84.1.el6',
|
49
|
+
'wget' => '1.12-1.8.el6.x86_64',
|
50
|
+
'libxml2' => '2.7.6-12.el6_4.1.x86_64',
|
51
|
+
'libxml2-devel' => '2.7.6-12.el6_4.1.x86_64',
|
52
|
+
'libxslt' => '1.1.26-2.el6_3.1.x86_64',
|
53
|
+
'libxslt-devel' => '1.1.26-2.el6_3.1.x86_64',
|
54
|
+
'psmisc' => '22.6-15.el6_0.1.x86_64',
|
55
|
+
'unzip' => '6.0-1.el6.x86_64',
|
56
|
+
'bison' => '2.4.1-5.el6.x86_64',
|
57
|
+
'libyaml' => '0.1.3-1.el6.x86_64',
|
58
|
+
'libyaml-devel' => '0.1.3-1.el6.x86_64',
|
59
|
+
'bzip2-devel' => '1.0.5-7.el6_0.x86_64',
|
60
|
+
'libcap-devel' => '2.16-5.5.el6.x86_64',
|
61
|
+
'cmake' => '2.6.4-5.el6.x86_64',
|
62
|
+
'rpm-build' => '4.8.0-32.el6.x86_64',
|
63
|
+
'rpmdevtools' => '7.5-2.el6.noarch',
|
64
|
+
'glibc-static' => '2.12-1.107.el6_4.5.x86_64',
|
65
|
+
'runit' => '2.1.1-6.el6.x86_64',
|
66
|
+
'sudo' => '1.8.6p3-7.el6.x86_64',
|
67
|
+
'rsyslog' => '5.8.10-7.el6_4.x86_64',
|
68
|
+
'rsyslog-relp' => '5.8.10-7.el6_4.x86_64',
|
69
|
+
'nc' => '1.84-22.el6.x86_64',
|
70
|
+
}.each do |pkg, version|
|
71
|
+
describe package(pkg) do
|
72
|
+
it { should be_installed.with_version(version) }
|
73
|
+
end
|
74
|
+
end
|
75
|
+
end
|
76
|
+
|
77
|
+
context 'installed by system_grub' do
|
78
|
+
{
|
79
|
+
'grub' => '0.97-81.el6.x86_64',
|
80
|
+
}.each do |pkg, version|
|
81
|
+
describe package(pkg) do
|
82
|
+
it { should be_installed.with_version(version) }
|
83
|
+
end
|
84
|
+
end
|
85
|
+
|
86
|
+
%w(e2fs_stage1_5 stage1 stage2).each do |grub_stage|
|
87
|
+
describe file("/boot/grub/#{grub_stage}") do
|
88
|
+
it { should be_file }
|
89
|
+
end
|
90
|
+
end
|
91
|
+
end
|
92
|
+
|
93
|
+
context 'installed by system_kernel' do
|
94
|
+
{
|
95
|
+
'kernel' => '2.6.32-358.18.1.el6.x86_64',
|
96
|
+
'kernel-headers' => '2.6.32-358.18.1.el6.x86_64',
|
97
|
+
}.each do |pkg, version|
|
98
|
+
describe package(pkg) do
|
99
|
+
it { should be_installed.with_version(version) }
|
100
|
+
end
|
101
|
+
end
|
102
|
+
end
|
103
|
+
|
104
|
+
context 'installed by image_install_grub' do
|
105
|
+
describe file('/etc/fstab') do
|
106
|
+
it { should be_file }
|
107
|
+
it { should contain 'UUID=' }
|
108
|
+
it { should contain '/ ext4 defaults 1 1' }
|
109
|
+
end
|
110
|
+
|
111
|
+
describe file('/boot/grub/grub.conf') do
|
112
|
+
it { should be_file }
|
113
|
+
it { should contain 'default=0' }
|
114
|
+
it { should contain 'timeout=1' }
|
115
|
+
it { should contain 'title CentOS release 6.4 (Final) (2.6.32-358.18.1.el6.x86_64)' }
|
116
|
+
it { should contain ' root (hd0,0)' }
|
117
|
+
it { should contain ' kernel /boot/vmlinuz-2.6.32-358.18.1.el6.x86_64 ro root=UUID=' }
|
118
|
+
it { should contain ' initrd /boot/initramfs-2.6.32-358.18.1.el6.x86_64.img' }
|
119
|
+
end
|
120
|
+
|
121
|
+
describe file('/boot/grub/menu.lst') do
|
122
|
+
it { should be_linked_to('./grub.conf') }
|
123
|
+
end
|
124
|
+
end
|
125
|
+
|
126
|
+
context 'installed by system_parameters' do
|
127
|
+
describe file('/var/vcap/bosh/etc/operating_system') do
|
128
|
+
it { should contain('centos') }
|
129
|
+
end
|
130
|
+
end
|
131
|
+
end
|