bosh-stemcell 1.5.0.pre.1209 → 1.5.0.pre.1210

Sign up to get free protection for your applications and to get access to all the features.
data/Berksfile ADDED
@@ -0,0 +1,3 @@
1
+ site :opscode
2
+
3
+ cookbook 'golang'
data/Berksfile.lock ADDED
@@ -0,0 +1,28 @@
1
+ {
2
+ "sources": {
3
+ "golang": {
4
+ "locked_version": "1.1.2"
5
+ },
6
+ "git": {
7
+ "locked_version": "2.7.0"
8
+ },
9
+ "dmg": {
10
+ "locked_version": "2.0.4"
11
+ },
12
+ "build-essential": {
13
+ "locked_version": "1.4.2"
14
+ },
15
+ "yum": {
16
+ "locked_version": "2.4.0"
17
+ },
18
+ "windows": {
19
+ "locked_version": "1.11.0"
20
+ },
21
+ "chef_handler": {
22
+ "locked_version": "1.1.4"
23
+ },
24
+ "runit": {
25
+ "locked_version": "1.3.0"
26
+ }
27
+ }
28
+ }
data/Vagrantfile CHANGED
@@ -33,5 +33,18 @@ Vagrant.configure('2') do |config|
33
33
  BASH
34
34
  end
35
35
 
36
+ config.omnibus.chef_version = :latest
37
+ config.berkshelf.enabled = true
38
+
39
+ config.vm.provision :chef_solo do |chef|
40
+ chef.run_list = %w(recipe[golang])
41
+
42
+ chef.json = {
43
+ go: {
44
+ version: '1.1.2',
45
+ }
46
+ }
47
+ end
48
+
36
49
  config.vm.synced_folder '../', '/bosh'
37
50
  end
@@ -14,6 +14,7 @@ module Bosh::Stemcell
14
14
  @environment = env
15
15
  @infrastructure = Infrastructure.for(options.fetch(:infrastructure_name))
16
16
  @operating_system = OperatingSystem.for(options.fetch(:operating_system_name))
17
+ @agent_name = options.fetch(:agent_name) || 'ruby'
17
18
 
18
19
  @stemcell_builder_options = BuilderOptions.new(
19
20
  env,
@@ -40,7 +41,8 @@ module Bosh::Stemcell
40
41
 
41
42
  stage_collection = StageCollection.new(
42
43
  infrastructure: infrastructure,
43
- operating_system: operating_system
44
+ operating_system: operating_system,
45
+ agent_name: agent_name,
44
46
  )
45
47
  stage_runner = StageRunner.new(
46
48
  build_path: build_path,
@@ -48,8 +50,7 @@ module Bosh::Stemcell
48
50
  settings_file: settings_path,
49
51
  work_path: work_root
50
52
  )
51
- stage_runner.configure_and_apply(stage_collection.operating_system_stages)
52
- stage_runner.configure_and_apply(stage_collection.infrastructure_stages)
53
+ stage_runner.configure_and_apply(stage_collection.all_stages)
53
54
  system(rspec_command) || raise('Stemcell specs failed')
54
55
 
55
56
  stemcell_file
@@ -66,6 +67,7 @@ module Bosh::Stemcell
66
67
  :environment,
67
68
  :infrastructure,
68
69
  :operating_system,
70
+ :agent_name,
69
71
  :stemcell_builder_options
70
72
  )
71
73
 
@@ -75,6 +77,7 @@ module Bosh::Stemcell
75
77
  "STEMCELL_IMAGE=#{image_file_path}",
76
78
  'bundle exec rspec -fd',
77
79
  "spec/stemcells/#{operating_system.name}_spec.rb",
80
+ "spec/stemcells/#{agent_name}_agent_spec.rb",
78
81
  "spec/stemcells/#{infrastructure.name}_spec.rb",
79
82
  ].join(' ')
80
83
  end
@@ -27,6 +27,7 @@ module Bosh::Stemcell
27
27
  'ruby_bin' => ruby_bin,
28
28
  'bosh_release_src_dir' => File.join(source_root, 'release/src/bosh'),
29
29
  'bosh_agent_src_dir' => File.join(source_root, 'bosh_agent'),
30
+ 'go_agent_src_dir' => File.join(source_root, 'go_agent'),
30
31
  'image_create_disk_size' => image_create_disk_size
31
32
  }.merge(bosh_micro_options).merge(environment_variables).merge(vsphere_options)
32
33
  end
@@ -5,8 +5,33 @@ module Bosh::Stemcell
5
5
  class StageCollection
6
6
 
7
7
  def initialize(options)
8
- @infrastructure = options.fetch(:infrastructure)
8
+ @infrastructure = options.fetch(:infrastructure)
9
9
  @operating_system = options.fetch(:operating_system)
10
+ @agent_name = options.fetch(:agent_name)
11
+ end
12
+
13
+ def all_stages
14
+ operating_system_stages + agent_stages + infrastructure_stages
15
+ end
16
+
17
+ private
18
+
19
+ attr_reader :infrastructure, :operating_system, :agent_name
20
+
21
+ def agent_stages
22
+ case agent_name
23
+ when 'go'
24
+ [
25
+ :bosh_go_agent,
26
+ #:bosh_micro,
27
+ ]
28
+ else
29
+ [
30
+ :bosh_ruby,
31
+ :bosh_agent,
32
+ :bosh_micro,
33
+ ]
34
+ end
10
35
  end
11
36
 
12
37
  def operating_system_stages
@@ -29,26 +54,18 @@ module Bosh::Stemcell
29
54
  end
30
55
  end
31
56
 
32
- private
33
-
34
- attr_reader :infrastructure, :operating_system
35
-
36
57
  def hacked_centos_common
37
58
  [
38
59
  # Bosh steps
39
60
  :bosh_users,
40
61
  :bosh_monit,
41
- :bosh_ruby,
42
- :bosh_agent,
43
62
  #:bosh_sysstat,
44
63
  #:bosh_sysctl,
45
64
  :bosh_ntpdate,
46
65
  :bosh_sudoers,
47
- # Micro BOSH
48
- :bosh_micro,
49
66
  # Install GRUB/kernel/etc
50
67
  :system_grub,
51
- #:system_kernel,
68
+ #:system_kernel,
52
69
  ]
53
70
  end
54
71
 
@@ -73,14 +90,10 @@ module Bosh::Stemcell
73
90
  # Bosh steps
74
91
  :bosh_users,
75
92
  :bosh_monit,
76
- :bosh_ruby,
77
- :bosh_agent,
78
93
  :bosh_sysstat,
79
94
  :bosh_sysctl,
80
95
  :bosh_ntpdate,
81
96
  :bosh_sudoers,
82
- # Micro BOSH
83
- :bosh_micro,
84
97
  # Install GRUB/kernel/etc
85
98
  :system_grub,
86
99
  :system_kernel,
@@ -1,5 +1,5 @@
1
1
  module Bosh
2
2
  module Stemcell
3
- VERSION = '1.5.0.pre.1209'
3
+ VERSION = '1.5.0.pre.1210'
4
4
  end
5
5
  end
@@ -8,6 +8,7 @@ module Bosh::Stemcell
8
8
  env,
9
9
  infrastructure_name: infrastructure.name,
10
10
  operating_system_name: operating_system.name,
11
+ agent_name: agent_name,
11
12
  release_tarball_path: release_tarball_path,
12
13
  version: version
13
14
  )
@@ -15,6 +16,9 @@ module Bosh::Stemcell
15
16
 
16
17
  let(:env) { {} }
17
18
 
19
+ let(:agent_name) { 'ruby' }
20
+ let(:expected_agent_name) { 'ruby' }
21
+
18
22
  let(:infrastructure) do
19
23
  instance_double(
20
24
  'Bosh::Stemcell::Infrastructure::Vsphere',
@@ -32,7 +36,8 @@ module Bosh::Stemcell
32
36
  OperatingSystem.stub(:for).with(operating_system.name).and_return(operating_system)
33
37
  StageCollection.stub(:new).with(
34
38
  infrastructure: infrastructure,
35
- operating_system: operating_system
39
+ operating_system: operating_system,
40
+ agent_name: agent_name,
36
41
  ).and_return(stage_collection)
37
42
 
38
43
  StageRunner.stub(:new).with(
@@ -62,8 +67,7 @@ module Bosh::Stemcell
62
67
  let(:stage_collection) do
63
68
  instance_double(
64
69
  'Bosh::Stemcell::StageCollection',
65
- operating_system_stages: ['FAKE_OS_STAGES'],
66
- infrastructure_stages: ['FAKE_INFRASTRUCTURE_STAGES']
70
+ all_stages: %w(FAKE_OS_STAGES FAKE_INFRASTRUCTURE_STAGES)
67
71
  )
68
72
  end
69
73
 
@@ -97,6 +101,36 @@ module Bosh::Stemcell
97
101
  end
98
102
  end
99
103
 
104
+ context 'when agent_name is nil' do
105
+ let(:agent_name) { nil }
106
+ let(:expected_agent_name) { 'ruby' }
107
+
108
+ it 'uses the correct agent name for the stage collection' do
109
+ StageCollection.should_receive(:new).with(
110
+ infrastructure: infrastructure,
111
+ operating_system: operating_system,
112
+ agent_name: expected_agent_name,
113
+ ).and_return(stage_collection)
114
+
115
+ stemcell_builder_command.build
116
+ end
117
+ end
118
+
119
+ context 'when agent_name is foo' do
120
+ let(:agent_name) { 'foo' }
121
+ let(:expected_agent_name) { 'foo' }
122
+
123
+ it 'uses the correct agent name for the stage collection' do
124
+ StageCollection.should_receive(:new).with(
125
+ infrastructure: infrastructure,
126
+ operating_system: operating_system,
127
+ agent_name: expected_agent_name,
128
+ ).and_return(stage_collection)
129
+
130
+ stemcell_builder_command.build
131
+ end
132
+ end
133
+
100
134
  describe 'sanitizing the environment' do
101
135
  it 'removes any tgz files from current working directory' do
102
136
  expect {
@@ -170,15 +204,14 @@ module Bosh::Stemcell
170
204
  "STEMCELL_IMAGE=#{File.join(root_dir, 'work', 'work', 'fake-root-disk-image.raw')}",
171
205
  'bundle exec rspec -fd',
172
206
  "spec/stemcells/#{operating_system.name}_spec.rb",
207
+ "spec/stemcells/#{agent_name}_agent_spec.rb",
173
208
  "spec/stemcells/#{infrastructure.name}_spec.rb",
174
209
  ].join(' ')
175
210
  end
176
211
 
177
212
  it 'calls #configure_and_apply' do
178
213
  stage_runner.should_receive(:configure_and_apply).
179
- with(['FAKE_OS_STAGES']).ordered
180
- stage_runner.should_receive(:configure_and_apply).
181
- with(['FAKE_INFRASTRUCTURE_STAGES']).ordered
214
+ with(%w(FAKE_OS_STAGES FAKE_INFRASTRUCTURE_STAGES)).ordered
182
215
  stemcell_builder_command.should_receive(:system).
183
216
  with(expected_rspec_command).ordered
184
217
 
@@ -190,9 +223,7 @@ module Bosh::Stemcell
190
223
 
191
224
  it 'calls #configure_and_apply' do
192
225
  stage_runner.should_receive(:configure_and_apply).
193
- with(['FAKE_OS_STAGES']).ordered
194
- stage_runner.should_receive(:configure_and_apply).
195
- with(['FAKE_INFRASTRUCTURE_STAGES']).ordered
226
+ with(%w(FAKE_OS_STAGES FAKE_INFRASTRUCTURE_STAGES)).ordered
196
227
  stemcell_builder_command.should_receive(:system).
197
228
  with(expected_rspec_command).ordered
198
229
 
@@ -108,6 +108,7 @@ module Bosh::Stemcell
108
108
  expect(result['ruby_bin']).to eq('fake_ruby_bin')
109
109
  expect(result['bosh_release_src_dir']).to eq(File.join(expected_source_root, '/release/src/bosh'))
110
110
  expect(result['bosh_agent_src_dir']).to eq(File.join(expected_source_root, 'bosh_agent'))
111
+ expect(result['go_agent_src_dir']).to eq(File.join(expected_source_root, 'go_agent'))
111
112
  expect(result['image_create_disk_size']).to eq(default_disk_size)
112
113
  expect(result['bosh_micro_enabled']).to eq('yes')
113
114
  expect(result['bosh_micro_package_compiler_path']).to eq(
@@ -5,206 +5,272 @@ module Bosh::Stemcell
5
5
  describe StageCollection do
6
6
  subject(:stage_collection) do
7
7
  StageCollection.new(
8
- infrastructure: infrastructure,
9
- operating_system: operating_system
8
+ infrastructure: infrastructure,
9
+ operating_system: operating_system,
10
+ agent_name: agent_name,
10
11
  )
11
12
  end
12
13
 
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
- ])
14
+ let(:ubuntu_stages) {
15
+ [
16
+ :base_debootstrap,
17
+ :base_apt,
18
+ :bosh_users,
19
+ :bosh_monit,
20
+ :bosh_sysstat,
21
+ :bosh_sysctl,
22
+ :bosh_ntpdate,
23
+ :bosh_sudoers,
24
+ :system_grub,
25
+ :system_kernel,
26
+ ]
27
+ }
28
+
29
+ let(:centos_stages) {
30
+ [
31
+ :base_centos,
32
+ :base_yum,
33
+ :bosh_users,
34
+ :bosh_monit,
35
+ #:bosh_sysstat,
36
+ #:bosh_sysctl,
37
+ :bosh_ntpdate,
38
+ :bosh_sudoers,
39
+ :system_grub,
40
+ #:system_kernel,
41
+ ]
42
+ }
43
+
44
+ let(:aws_infrastructure_stages) {
45
+ [
46
+ :system_aws_network,
47
+ :system_aws_clock,
48
+ :system_aws_modules,
49
+ :system_parameters,
50
+ :bosh_clean,
51
+ :bosh_harden,
52
+ :bosh_harden_ssh,
53
+ :bosh_dpkg_list,
54
+ :image_create,
55
+ :image_install_grub,
56
+ :image_aws_update_grub,
57
+ :image_aws_prepare_stemcell,
58
+ :stemcell
59
+ ]
60
+ }
61
+
62
+ let(:openstack_infrastructure_stages) {
63
+ [
64
+ :system_openstack_network,
65
+ :system_openstack_clock,
66
+ :system_openstack_modules,
67
+ :system_parameters,
68
+ :bosh_clean,
69
+ :bosh_harden,
70
+ :bosh_harden_ssh,
71
+ :bosh_dpkg_list,
72
+ :image_create,
73
+ :image_install_grub,
74
+ :image_openstack_qcow2,
75
+ :image_openstack_prepare_stemcell,
76
+ :stemcell_openstack
77
+ ]
78
+ }
79
+
80
+ let(:vsphere_infrastructure_stages) {
81
+ [
82
+ :system_open_vm_tools,
83
+ :system_parameters,
84
+ :bosh_clean,
85
+ :bosh_harden,
86
+ :bosh_dpkg_list,
87
+ :image_create,
88
+ :image_install_grub,
89
+ :image_vsphere_vmx,
90
+ :image_vsphere_ovf,
91
+ :image_vsphere_prepare_stemcell,
92
+ :stemcell
93
+ ]
94
+ }
95
+
96
+ let(:vsphere_centos_infrastructure_stages) {
97
+ [
98
+ #:system_open_vm_tools,
99
+ :system_parameters,
100
+ :bosh_clean,
101
+ :bosh_harden,
102
+ #:bosh_dpkg_list,
103
+ :image_create,
104
+ :image_install_grub,
105
+ :image_vsphere_vmx,
106
+ :image_vsphere_ovf,
107
+ :image_vsphere_prepare_stemcell,
108
+ :stemcell
109
+ ]
110
+ }
111
+
112
+ describe '#all_stages' do
113
+ context 'when using the ruby agent' do
114
+ let(:agent_name) { 'ruby' }
115
+ let(:agent_stages) {
116
+ [
117
+ :bosh_ruby,
118
+ :bosh_agent,
119
+ :bosh_micro,
120
+ ]
121
+ }
122
+
123
+ context 'when infrastructure is AWS' do
124
+ let(:infrastructure) { Infrastructure.for('aws') }
125
+
126
+ context 'when operating system is Ubuntu' do
127
+ let(:operating_system) { OperatingSystem.for('ubuntu') }
128
+
129
+ it 'has the correct stages' do
130
+ expect(stage_collection.all_stages).to eq(ubuntu_stages +
131
+ agent_stages +
132
+ aws_infrastructure_stages)
133
+ end
36
134
  end
37
- end
38
- end
39
135
 
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
- ])
136
+ context 'when operating system is Centos' do
137
+ let(:operating_system) { OperatingSystem.for('centos') }
138
+
139
+ it 'has the correct stages' do
140
+ expect(stage_collection.all_stages).to eq(centos_stages +
141
+ agent_stages +
142
+ aws_infrastructure_stages)
143
+ end
62
144
  end
63
145
  end
64
- end
65
146
 
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
- ])
147
+ context 'when infrastructure is OpenStack' do
148
+ let(:infrastructure) { Infrastructure.for('openstack') }
149
+
150
+ context 'when operating system is Ubuntu' do
151
+ let(:operating_system) { OperatingSystem.for('ubuntu') }
152
+
153
+ it 'has the correct stages' do
154
+ expect(stage_collection.all_stages).to eq(ubuntu_stages +
155
+ agent_stages +
156
+ openstack_infrastructure_stages)
157
+ end
88
158
  end
89
- end
90
159
 
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
- ])
160
+ context 'when operating system is CentOS' do
161
+ let(:operating_system) { OperatingSystem.for('centos') }
162
+
163
+ it 'has the correct stages' do
164
+ expect(stage_collection.all_stages).to eq(centos_stages +
165
+ agent_stages +
166
+ openstack_infrastructure_stages)
167
+ end
110
168
  end
111
169
  end
112
- end
113
- end
114
170
 
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
- ])
171
+ context 'when infrastructure is vSphere' do
172
+ let(:infrastructure) { Infrastructure.for('vsphere') }
173
+
174
+ context 'when operating system is Ubuntu' do
175
+ let(:operating_system) { OperatingSystem.for('ubuntu') }
176
+
177
+ it 'has the correct stages' do
178
+ expect(stage_collection.all_stages).to eq(ubuntu_stages +
179
+ agent_stages +
180
+ vsphere_infrastructure_stages)
181
+ end
182
+ end
183
+
184
+ context 'when operating system is CentOS' do
185
+ let(:operating_system) { OperatingSystem.for('centos') }
186
+
187
+ it 'has the correct stages' do
188
+ expect(stage_collection.all_stages).to eq(centos_stages +
189
+ agent_stages +
190
+ vsphere_centos_infrastructure_stages)
191
+ end
138
192
  end
139
193
  end
140
194
  end
141
195
 
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
- ])
196
+ context 'when using the go agent' do
197
+ let(:agent_name) { 'go' }
198
+ let(:agent_stages) {
199
+ [
200
+ :bosh_go_agent,
201
+ #:bosh_micro,
202
+ ]
203
+ }
204
+
205
+ context 'when infrastructure is AWS' do
206
+ let(:infrastructure) { Infrastructure.for('aws') }
207
+
208
+ context 'when operating system is Ubuntu' do
209
+ let(:operating_system) { OperatingSystem.for('ubuntu') }
210
+
211
+ it 'has the correct stages' do
212
+ expect(stage_collection.all_stages).to eq(ubuntu_stages +
213
+ agent_stages +
214
+ aws_infrastructure_stages)
215
+ end
216
+ end
217
+
218
+ context 'when operating system is Centos' do
219
+ let(:operating_system) { OperatingSystem.for('centos') }
220
+
221
+ it 'has the correct stages' do
222
+ expect(stage_collection.all_stages).to eq(centos_stages +
223
+ agent_stages +
224
+ aws_infrastructure_stages)
225
+ end
164
226
  end
165
227
  end
166
- end
167
228
 
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
- ])
229
+ context 'when infrastructure is OpenStack' do
230
+ let(:infrastructure) { Infrastructure.for('openstack') }
231
+
232
+ context 'when operating system is Ubuntu' do
233
+ let(:operating_system) { OperatingSystem.for('ubuntu') }
234
+
235
+ it 'has the correct stages' do
236
+ expect(stage_collection.all_stages).to eq(ubuntu_stages +
237
+ agent_stages +
238
+ openstack_infrastructure_stages)
239
+ end
240
+ end
241
+
242
+ context 'when operating system is CentOS' do
243
+ let(:operating_system) { OperatingSystem.for('centos') }
244
+
245
+ it 'has the correct stages' do
246
+ expect(stage_collection.all_stages).to eq(centos_stages +
247
+ agent_stages +
248
+ openstack_infrastructure_stages)
249
+ end
188
250
  end
189
251
  end
190
252
 
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
- ])
253
+ context 'when infrastructure is vSphere' do
254
+ let(:infrastructure) { Infrastructure.for('vsphere') }
255
+
256
+ context 'when operating system is Ubuntu' do
257
+ let(:operating_system) { OperatingSystem.for('ubuntu') }
258
+
259
+ it 'has the correct stages' do
260
+ expect(stage_collection.all_stages).to eq(ubuntu_stages +
261
+ agent_stages +
262
+ vsphere_infrastructure_stages)
263
+ end
264
+ end
265
+
266
+ context 'when operating system is CentOS' do
267
+ let(:operating_system) { OperatingSystem.for('centos') }
268
+
269
+ it 'has the correct stages' do
270
+ expect(stage_collection.all_stages).to eq(centos_stages +
271
+ agent_stages +
272
+ vsphere_centos_infrastructure_stages)
273
+ end
208
274
  end
209
275
  end
210
276
  end
@@ -0,0 +1,10 @@
1
+ require 'spec_helper'
2
+
3
+ describe 'Stemcell with Go Agent' do
4
+ describe 'installed by bosh_go_agent' do
5
+ describe file('/var/vcap/bosh/bin/bosh-agent') do
6
+ it { should be_file }
7
+ it { should be_executable }
8
+ end
9
+ end
10
+ end
@@ -0,0 +1,27 @@
1
+ require 'spec_helper'
2
+
3
+ describe 'Stemcell with Ruby Agent' do
4
+ describe 'installed by bosh_ruby' do
5
+ describe command('/var/vcap/bosh/bin/ruby -r yaml -e "Psych::SyntaxError"') do
6
+ it { should return_exit_status(0) }
7
+ end
8
+ end
9
+
10
+ describe 'installed by bosh_agent' do
11
+ describe command('/var/vcap/bosh/bin/ruby -r bosh_agent -e "Bosh::Agent"') do
12
+ it { should return_exit_status(0) }
13
+ end
14
+ end
15
+
16
+ context 'installed by bosh_micro' do
17
+ describe file('/var/vcap/micro/apply_spec.yml') do
18
+ it { should be_file }
19
+ it { should contain 'deployment: micro' }
20
+ it { should contain 'powerdns' }
21
+ end
22
+
23
+ describe file('/var/vcap/micro_bosh/data/cache') do
24
+ it { should be_a_directory }
25
+ end
26
+ end
27
+ end
@@ -1,16 +1,4 @@
1
1
  shared_examples_for 'a stemcell' do
2
- describe 'installed by bosh_ruby' do
3
- describe command('/var/vcap/bosh/bin/ruby -r yaml -e "Psych::SyntaxError"') do
4
- it { should return_exit_status(0) }
5
- end
6
- end
7
-
8
- describe 'installed by bosh_agent' do
9
- describe command('/var/vcap/bosh/bin/ruby -r bosh_agent -e "Bosh::Agent"') do
10
- it { should return_exit_status(0) }
11
- end
12
- end
13
-
14
2
  context 'installed by bosh_sudoers' do
15
3
  describe file('/etc/sudoers') do
16
4
  it { should be_file }
@@ -18,18 +6,6 @@ shared_examples_for 'a stemcell' do
18
6
  end
19
7
  end
20
8
 
21
- context 'installed by bosh_micro' do
22
- describe file('/var/vcap/micro/apply_spec.yml') do
23
- it { should be_file }
24
- it { should contain 'deployment: micro' }
25
- it { should contain 'powerdns' }
26
- end
27
-
28
- describe file('/var/vcap/micro_bosh/data/cache') do
29
- it { should be_a_directory }
30
- end
31
- end
32
-
33
9
  # currently `should cotain` on a file does not properly escape $PATH
34
10
  context 'installed by bosh_users' do
35
11
  describe command("grep -q 'export PATH=/var/vcap/bosh/bin:\\$PATH\n' /root/.bashrc") do
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: bosh-stemcell
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.5.0.pre.1209
4
+ version: 1.5.0.pre.1210
5
5
  prerelease: 6
6
6
  platform: ruby
7
7
  authors:
@@ -18,7 +18,7 @@ dependencies:
18
18
  requirements:
19
19
  - - ~>
20
20
  - !ruby/object:Gem::Version
21
- version: 1.5.0.pre.1209
21
+ version: 1.5.0.pre.1210
22
22
  type: :runtime
23
23
  prerelease: false
24
24
  version_requirements: !ruby/object:Gem::Requirement
@@ -26,7 +26,7 @@ dependencies:
26
26
  requirements:
27
27
  - - ~>
28
28
  - !ruby/object:Gem::Version
29
- version: 1.5.0.pre.1209
29
+ version: 1.5.0.pre.1210
30
30
  - !ruby/object:Gem::Dependency
31
31
  name: rake
32
32
  requirement: !ruby/object:Gem::Requirement
@@ -130,6 +130,8 @@ extensions: []
130
130
  extra_rdoc_files: []
131
131
  files:
132
132
  - .rspec
133
+ - Berksfile
134
+ - Berksfile.lock
133
135
  - README.md
134
136
  - Vagrantfile
135
137
  - bosh-stemcell.gemspec
@@ -169,7 +171,9 @@ files:
169
171
  - spec/spec_helper.rb
170
172
  - spec/stemcells/aws_spec.rb
171
173
  - spec/stemcells/centos_spec.rb
174
+ - spec/stemcells/go_agent_spec.rb
172
175
  - spec/stemcells/openstack_spec.rb
176
+ - spec/stemcells/ruby_agent_spec.rb
173
177
  - spec/stemcells/ubuntu_spec.rb
174
178
  - spec/stemcells/vsphere_spec.rb
175
179
  - spec/support/rspec_fire.rb
@@ -225,7 +229,9 @@ test_files:
225
229
  - spec/spec_helper.rb
226
230
  - spec/stemcells/aws_spec.rb
227
231
  - spec/stemcells/centos_spec.rb
232
+ - spec/stemcells/go_agent_spec.rb
228
233
  - spec/stemcells/openstack_spec.rb
234
+ - spec/stemcells/ruby_agent_spec.rb
229
235
  - spec/stemcells/ubuntu_spec.rb
230
236
  - spec/stemcells/vsphere_spec.rb
231
237
  - spec/support/rspec_fire.rb