vcloud-launcher 0.0.5 → 0.1.0

Sign up to get free protection for your applications and to get access to all the features.
@@ -1,80 +1,82 @@
1
1
  require 'spec_helper'
2
2
 
3
- module Vcloud
4
- module Launcher
5
- describe VmOrchestrator do
3
+ describe Vcloud::Launcher::VmOrchestrator do
6
4
 
7
- before(:each) do
8
- @vm_id = "vm-12345678-1234-1234-1234-123456712312"
9
- end
5
+ before(:each) do
6
+ @vm_id = "vm-12345678-1234-1234-1234-123456712312"
7
+ end
8
+
9
+ let(:fog_vm) {
10
+ { :href => "/#{@vm_id}" }
11
+ }
12
+ let(:vapp) {
13
+ double(:vapp, :name => 'web-app1')
14
+ }
15
+ subject {
16
+ Vcloud::Launcher::VmOrchestrator.new(fog_vm, vapp)
17
+ }
10
18
 
11
- it "orchestrate customization" do
12
- vm_config = {
13
- :hardware_config => {
14
- :memory => 4096,
15
- :cpu => 2
16
- },
17
- :metadata => {
18
- :shutdown => true
19
- },
20
- :extra_disks => [
21
- {:size => '1024', :name => 'Hard disk 2', :fs_file => 'mysql', :fs_mntops => 'mysql-something'},
22
- {:size => '2048', :name => 'Hard disk 3', :fs_file => 'solr', :fs_mntops => 'solr-something'}
23
- ],
19
+ it "orchestrate customization" do
20
+ vm_config = {
21
+ :hardware_config => {
22
+ :memory => 4096,
23
+ :cpu => 2
24
+ },
25
+ :metadata => {
26
+ :shutdown => true
27
+ },
28
+ :extra_disks => [
29
+ {:size => '1024', :name => 'Hard disk 2', :fs_file => 'mysql', :fs_mntops => 'mysql-something'},
30
+ {:size => '2048', :name => 'Hard disk 3', :fs_file => 'solr', :fs_mntops => 'solr-something'}
31
+ ],
24
32
 
25
- :network_connections => [
26
- {:name => "network1", :ip_address => "198.12.1.21"},
27
- ],
28
- :bootstrap => {
29
- :script_path => '/tmp/boostrap.erb',
30
- :vars => {
31
- :message => 'hello world'
32
- }
33
- },
34
- :storage_profile => {
35
- :name => 'basic-storage',
36
- :href => 'https://vcloud.example.net/api/vdcStorageProfile/000aea1e-a5e9-4dd1-a028-40db8c98d237'
33
+ :network_connections => [
34
+ {:name => "network1", :ip_address => "198.12.1.21"},
35
+ ],
36
+ :bootstrap => {
37
+ :script_path => '/tmp/boostrap.erb',
38
+ :vars => {
39
+ :message => 'hello world'
37
40
  }
41
+ },
42
+ :storage_profile => {
43
+ :name => 'basic-storage',
44
+ :href => 'https://vcloud.example.net/api/vdcStorageProfile/000aea1e-a5e9-4dd1-a028-40db8c98d237'
38
45
  }
39
- fog_vm = { :href => "/#{@vm_id}" }
40
- vapp = double(:vapp, :name => 'web-app1')
41
- vm = double(:vm, :id => @vm_id, :vapp_name => 'web-app1', :vapp => vapp, :name => 'test-vm-1')
42
- Core::Vm.should_receive(:new).with(@vm_id, vapp).and_return(vm)
46
+ }
47
+ vm = double(:vm, :id => @vm_id, :vapp_name => 'web-app1', :vapp => vapp, :name => 'test-vm-1')
48
+ Vcloud::Core::Vm.should_receive(:new).with(@vm_id, vapp).and_return(vm)
43
49
 
44
- vm.should_receive(:update_name).with('web-app1')
45
- vm.should_receive(:configure_network_interfaces).with(vm_config[:network_connections])
46
- vm.should_receive(:update_storage_profile).with(vm_config[:storage_profile])
47
- vm.should_receive(:update_cpu_count).with(2)
48
- vm.should_receive(:update_memory_size_in_mb).with(4096)
49
- vm.should_receive(:add_extra_disks).with(vm_config[:extra_disks])
50
- vm.should_receive(:update_metadata).with(vm_config[:metadata])
51
- vm.should_receive(:configure_guest_customization_section).with('web-app1', vm_config[:bootstrap], vm_config[:extra_disks])
50
+ vm.should_receive(:update_name).with('web-app1')
51
+ vm.should_receive(:configure_network_interfaces).with(vm_config[:network_connections])
52
+ vm.should_receive(:update_storage_profile).with(vm_config[:storage_profile])
53
+ vm.should_receive(:update_cpu_count).with(2)
54
+ vm.should_receive(:update_memory_size_in_mb).with(4096)
55
+ vm.should_receive(:add_extra_disks).with(vm_config[:extra_disks])
56
+ vm.should_receive(:update_metadata).with(vm_config[:metadata])
57
+ vm.should_receive(:configure_guest_customization_section).with('web-app1', vm_config[:bootstrap], vm_config[:extra_disks])
52
58
 
53
- VmOrchestrator.new(fog_vm, vapp).customize(vm_config)
54
- end
59
+ subject.customize(vm_config)
60
+ end
55
61
 
56
- it "if a storage_profile is not specified, customize continues with other customizations" do
57
- fog_vm = { :href => "/#{@vm_id}" }
58
- vapp = double(:vapp, :name => 'web-app1')
59
- vm = double(:vm, :id => @vm_id, :vapp_name => 'web-app1', :vapp => vapp, :name => 'test-vm-1')
60
- vm_config = {
61
- :metadata => {:shutdown => true},
62
- :network_connections => [{:name => "network1", :ip_address => "198.12.1.21"}],
63
- :extra_disks => [
64
- {:size => '1024', :name => 'Hard disk 2', :fs_file => 'mysql', :fs_mntops => 'mysql-something'},
65
- {:size => '2048', :name => 'Hard disk 3', :fs_file => 'solr', :fs_mntops => 'solr-something'}
66
- ]
67
- }
68
- Core::Vm.should_receive(:new).with(@vm_id, vapp).and_return(vm)
69
- vm.should_receive(:update_metadata).with(:shutdown => true)
70
- vm.should_receive(:update_name).with('web-app1')
71
- vm.should_receive(:add_extra_disks).with(vm_config[:extra_disks])
72
- vm.should_receive(:configure_network_interfaces).with(vm_config[:network_connections])
73
- vm.should_receive(:configure_guest_customization_section).with('web-app1', vm_config[:bootstrap], vm_config[:extra_disks])
62
+ it "if a storage_profile is not specified, customize continues with other customizations" do
63
+ vm = double(:vm, :id => @vm_id, :vapp_name => 'web-app1', :vapp => vapp, :name => 'test-vm-1')
64
+ vm_config = {
65
+ :metadata => {:shutdown => true},
66
+ :network_connections => [{:name => "network1", :ip_address => "198.12.1.21"}],
67
+ :extra_disks => [
68
+ {:size => '1024', :name => 'Hard disk 2', :fs_file => 'mysql', :fs_mntops => 'mysql-something'},
69
+ {:size => '2048', :name => 'Hard disk 3', :fs_file => 'solr', :fs_mntops => 'solr-something'}
70
+ ]
71
+ }
72
+ Vcloud::Core::Vm.should_receive(:new).with(@vm_id, vapp).and_return(vm)
73
+ vm.should_receive(:update_metadata).with(:shutdown => true)
74
+ vm.should_receive(:update_name).with('web-app1')
75
+ vm.should_receive(:add_extra_disks).with(vm_config[:extra_disks])
76
+ vm.should_receive(:configure_network_interfaces).with(vm_config[:network_connections])
77
+ vm.should_receive(:configure_guest_customization_section).with('web-app1', vm_config[:bootstrap], vm_config[:extra_disks])
74
78
 
75
- VmOrchestrator.new(fog_vm, vapp).customize(vm_config)
79
+ subject.customize(vm_config)
76
80
 
77
- end
78
- end
79
81
  end
80
82
  end
@@ -21,11 +21,13 @@ Gem::Specification.new do |s|
21
21
  s.required_ruby_version = '>= 1.9.2'
22
22
 
23
23
  s.add_runtime_dependency 'methadone'
24
- s.add_runtime_dependency 'vcloud-core', '~> 0.3.0'
24
+ s.add_runtime_dependency 'vcloud-core', '~> 0.5.0'
25
25
  s.add_development_dependency 'aruba', '~> 0.5.3'
26
26
  s.add_development_dependency 'cucumber', '~> 1.3.10'
27
27
  s.add_development_dependency 'gem_publisher', '1.2.0'
28
+ s.add_development_dependency 'pry'
28
29
  s.add_development_dependency 'rake'
29
30
  s.add_development_dependency 'rspec', '~> 2.14.1'
30
31
  s.add_development_dependency 'rubocop'
32
+ s.add_development_dependency 'vcloud-tools-tester', '0.0.3'
31
33
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: vcloud-launcher
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.5
4
+ version: 0.1.0
5
5
  prerelease:
6
6
  platform: ruby
7
7
  authors:
@@ -9,7 +9,7 @@ authors:
9
9
  autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
- date: 2014-05-14 00:00:00.000000000 Z
12
+ date: 2014-06-02 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: methadone
@@ -34,7 +34,7 @@ dependencies:
34
34
  requirements:
35
35
  - - ~>
36
36
  - !ruby/object:Gem::Version
37
- version: 0.3.0
37
+ version: 0.5.0
38
38
  type: :runtime
39
39
  prerelease: false
40
40
  version_requirements: !ruby/object:Gem::Requirement
@@ -42,7 +42,7 @@ dependencies:
42
42
  requirements:
43
43
  - - ~>
44
44
  - !ruby/object:Gem::Version
45
- version: 0.3.0
45
+ version: 0.5.0
46
46
  - !ruby/object:Gem::Dependency
47
47
  name: aruba
48
48
  requirement: !ruby/object:Gem::Requirement
@@ -91,6 +91,22 @@ dependencies:
91
91
  - - '='
92
92
  - !ruby/object:Gem::Version
93
93
  version: 1.2.0
94
+ - !ruby/object:Gem::Dependency
95
+ name: pry
96
+ requirement: !ruby/object:Gem::Requirement
97
+ none: false
98
+ requirements:
99
+ - - ! '>='
100
+ - !ruby/object:Gem::Version
101
+ version: '0'
102
+ type: :development
103
+ prerelease: false
104
+ version_requirements: !ruby/object:Gem::Requirement
105
+ none: false
106
+ requirements:
107
+ - - ! '>='
108
+ - !ruby/object:Gem::Version
109
+ version: '0'
94
110
  - !ruby/object:Gem::Dependency
95
111
  name: rake
96
112
  requirement: !ruby/object:Gem::Requirement
@@ -139,6 +155,22 @@ dependencies:
139
155
  - - ! '>='
140
156
  - !ruby/object:Gem::Version
141
157
  version: '0'
158
+ - !ruby/object:Gem::Dependency
159
+ name: vcloud-tools-tester
160
+ requirement: !ruby/object:Gem::Requirement
161
+ none: false
162
+ requirements:
163
+ - - '='
164
+ - !ruby/object:Gem::Version
165
+ version: 0.0.3
166
+ type: :development
167
+ prerelease: false
168
+ version_requirements: !ruby/object:Gem::Requirement
169
+ none: false
170
+ requirements:
171
+ - - '='
172
+ - !ruby/object:Gem::Version
173
+ version: 0.0.3
142
174
  description:
143
175
  email:
144
176
  - anna.shipman@digital.cabinet-office.gov.uk
@@ -167,17 +199,22 @@ files:
167
199
  - jenkins_integration_tests.sh
168
200
  - lib/vcloud/launcher.rb
169
201
  - lib/vcloud/launcher/launch.rb
202
+ - lib/vcloud/launcher/schema/launcher_vapps.rb
203
+ - lib/vcloud/launcher/schema/vapp.rb
204
+ - lib/vcloud/launcher/schema/vm.rb
170
205
  - lib/vcloud/launcher/vapp_orchestrator.rb
171
206
  - lib/vcloud/launcher/version.rb
172
207
  - lib/vcloud/launcher/vm_orchestrator.rb
173
208
  - scripts/basic.erb
174
209
  - spec/erb_helper.rb
210
+ - spec/integration/README.md
175
211
  - spec/integration/launcher/data/basic_preamble_test.erb
176
212
  - spec/integration/launcher/data/happy_path.yaml.erb
177
213
  - spec/integration/launcher/data/minimum_data_setup.yaml.erb
178
214
  - spec/integration/launcher/data/storage_profile.yaml.erb
179
215
  - spec/integration/launcher/storage_profile_integration_spec.rb
180
216
  - spec/integration/launcher/vcloud_launcher_spec.rb
217
+ - spec/integration/vcloud_tools_testing_config.yaml.template
181
218
  - spec/spec_helper.rb
182
219
  - spec/vcloud/launcher/launch_spec.rb
183
220
  - spec/vcloud/launcher/vapp_orchestrator_spec.rb
@@ -205,7 +242,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
205
242
  version: '0'
206
243
  segments:
207
244
  - 0
208
- hash: -774261046686009457
245
+ hash: 887521271783287653
209
246
  requirements: []
210
247
  rubyforge_project:
211
248
  rubygems_version: 1.8.23
@@ -217,12 +254,14 @@ test_files:
217
254
  - features/support/env.rb
218
255
  - features/vcloud-launch.feature
219
256
  - spec/erb_helper.rb
257
+ - spec/integration/README.md
220
258
  - spec/integration/launcher/data/basic_preamble_test.erb
221
259
  - spec/integration/launcher/data/happy_path.yaml.erb
222
260
  - spec/integration/launcher/data/minimum_data_setup.yaml.erb
223
261
  - spec/integration/launcher/data/storage_profile.yaml.erb
224
262
  - spec/integration/launcher/storage_profile_integration_spec.rb
225
263
  - spec/integration/launcher/vcloud_launcher_spec.rb
264
+ - spec/integration/vcloud_tools_testing_config.yaml.template
226
265
  - spec/spec_helper.rb
227
266
  - spec/vcloud/launcher/launch_spec.rb
228
267
  - spec/vcloud/launcher/vapp_orchestrator_spec.rb