vcloud-walker 3.2.2 → 3.2.3
Sign up to get free protection for your applications and to get access to all the features.
- data/.travis.yml +8 -0
- data/CHANGELOG.md +17 -0
- data/CONTRIBUTING.md +66 -0
- data/Gemfile +1 -1
- data/README.md +10 -0
- data/Rakefile +11 -6
- data/bin/vcloud-walk +1 -36
- data/jenkins.sh +1 -1
- data/jenkins_integration_tests.sh +1 -1
- data/lib/vcloud/walker/cli.rb +82 -0
- data/lib/vcloud/walker/fog_interface.rb +0 -1
- data/lib/vcloud/walker/resource/vapp.rb +12 -3
- data/lib/vcloud/walker/version.rb +1 -1
- data/lib/vcloud/walker.rb +6 -6
- data/spec/fog_interface_spec.rb +28 -33
- data/spec/integration/vcloud_walker_spec.rb +17 -17
- data/spec/spec_helper.rb +13 -15
- data/spec/stubs/stubs.rb +0 -1
- data/spec/vcloud/walker/cli_spec.rb +169 -0
- data/spec/vcloud/walker/resource/catalogs_spec.rb +38 -0
- data/spec/{walk → vcloud/walker/resource}/entity_spec.rb +17 -8
- data/spec/{walk → vcloud/walker/resource}/gateway_ipsec_vpn_service_spec.rb +0 -0
- data/spec/{walk → vcloud/walker/resource}/network_spec.rb +8 -18
- data/spec/vcloud/walker/resource/organization_spec.rb +66 -0
- data/spec/vcloud/walker/resource/vapp_spec.rb +89 -0
- data/spec/vcloud/walker/resource/vdcs_spec.rb +30 -0
- data/spec/{walk → vcloud/walker/resource}/vm_spec.rb +24 -24
- data/spec/vcloud/walker_spec.rb +12 -14
- data/vcloud-walker.gemspec +10 -8
- metadata +67 -65
- data/spec/walk/catalogs_spec.rb +0 -31
- data/spec/walk/organization_spec.rb +0 -53
- data/spec/walk/vapp_spec.rb +0 -24
- data/spec/walk/vdcs_spec.rb +0 -30
data/vcloud-walker.gemspec
CHANGED
@@ -6,7 +6,7 @@ Gem::Specification.new do |s|
|
|
6
6
|
s.name = 'vcloud-walker'
|
7
7
|
s.version = Vcloud::Walker::VERSION
|
8
8
|
s.authors = ['Government Digital Service']
|
9
|
-
s.homepage = 'https://github.com/
|
9
|
+
s.homepage = 'https://github.com/gds-operations/vcloud-walker'
|
10
10
|
s.summary = %q{Command line tool to describe vCloud entities}
|
11
11
|
s.description = %q{Vcloud-walker is a command line tool to describe different vCloud entities.
|
12
12
|
This tool is a thin layer around fog api, which exposes summarized vCloud entities
|
@@ -18,14 +18,16 @@ Gem::Specification.new do |s|
|
|
18
18
|
s.test_files = s.files.grep(%r{^(test|spec|features)/})
|
19
19
|
s.require_paths = ["lib"]
|
20
20
|
|
21
|
+
s.required_ruby_version = '>= 1.9.3'
|
22
|
+
|
23
|
+
s.add_runtime_dependency 'fog', '>= 1.21.0'
|
24
|
+
s.add_runtime_dependency 'json', '~> 1.8.0'
|
25
|
+
s.add_runtime_dependency 'vcloud-core', '~> 0.6.0'
|
26
|
+
s.add_development_dependency 'gem_publisher', '1.2.0'
|
27
|
+
s.add_development_dependency 'json_spec', '~> 1.1.1'
|
21
28
|
s.add_development_dependency 'rake'
|
22
29
|
s.add_development_dependency 'rspec', '~> 2.14.1'
|
23
30
|
s.add_development_dependency 'rspec-mocks', '~> 2.14.3'
|
24
|
-
s.add_development_dependency '
|
25
|
-
s.
|
26
|
-
s.add_runtime_dependency 'methadone'
|
27
|
-
s.add_runtime_dependency 'fog', '>= 1.21.0'
|
28
|
-
s.add_runtime_dependency 'vcloud-core', '~> 0.0.12'
|
29
|
-
s.add_development_dependency 'simplecov', '~> 0.8.2'
|
30
|
-
s.add_development_dependency 'gem_publisher', '1.2.0'
|
31
|
+
s.add_development_dependency 'rubocop', '~> 0.23.0'
|
32
|
+
s.add_development_dependency 'simplecov', '~> 0.7.1'
|
31
33
|
end
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: vcloud-walker
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 3.2.
|
4
|
+
version: 3.2.3
|
5
5
|
prerelease:
|
6
6
|
platform: ruby
|
7
7
|
authors:
|
@@ -9,97 +9,97 @@ authors:
|
|
9
9
|
autorequire:
|
10
10
|
bindir: bin
|
11
11
|
cert_chain: []
|
12
|
-
date: 2014-
|
12
|
+
date: 2014-07-15 00:00:00.000000000 Z
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
|
-
name:
|
15
|
+
name: fog
|
16
16
|
requirement: !ruby/object:Gem::Requirement
|
17
17
|
none: false
|
18
18
|
requirements:
|
19
19
|
- - ! '>='
|
20
20
|
- !ruby/object:Gem::Version
|
21
|
-
version:
|
22
|
-
type: :
|
21
|
+
version: 1.21.0
|
22
|
+
type: :runtime
|
23
23
|
prerelease: false
|
24
24
|
version_requirements: !ruby/object:Gem::Requirement
|
25
25
|
none: false
|
26
26
|
requirements:
|
27
27
|
- - ! '>='
|
28
28
|
- !ruby/object:Gem::Version
|
29
|
-
version:
|
29
|
+
version: 1.21.0
|
30
30
|
- !ruby/object:Gem::Dependency
|
31
|
-
name:
|
31
|
+
name: json
|
32
32
|
requirement: !ruby/object:Gem::Requirement
|
33
33
|
none: false
|
34
34
|
requirements:
|
35
35
|
- - ~>
|
36
36
|
- !ruby/object:Gem::Version
|
37
|
-
version:
|
38
|
-
type: :
|
37
|
+
version: 1.8.0
|
38
|
+
type: :runtime
|
39
39
|
prerelease: false
|
40
40
|
version_requirements: !ruby/object:Gem::Requirement
|
41
41
|
none: false
|
42
42
|
requirements:
|
43
43
|
- - ~>
|
44
44
|
- !ruby/object:Gem::Version
|
45
|
-
version:
|
45
|
+
version: 1.8.0
|
46
46
|
- !ruby/object:Gem::Dependency
|
47
|
-
name:
|
47
|
+
name: vcloud-core
|
48
48
|
requirement: !ruby/object:Gem::Requirement
|
49
49
|
none: false
|
50
50
|
requirements:
|
51
51
|
- - ~>
|
52
52
|
- !ruby/object:Gem::Version
|
53
|
-
version:
|
54
|
-
type: :
|
53
|
+
version: 0.6.0
|
54
|
+
type: :runtime
|
55
55
|
prerelease: false
|
56
56
|
version_requirements: !ruby/object:Gem::Requirement
|
57
57
|
none: false
|
58
58
|
requirements:
|
59
59
|
- - ~>
|
60
60
|
- !ruby/object:Gem::Version
|
61
|
-
version:
|
61
|
+
version: 0.6.0
|
62
62
|
- !ruby/object:Gem::Dependency
|
63
|
-
name:
|
63
|
+
name: gem_publisher
|
64
64
|
requirement: !ruby/object:Gem::Requirement
|
65
65
|
none: false
|
66
66
|
requirements:
|
67
|
-
- -
|
67
|
+
- - '='
|
68
68
|
- !ruby/object:Gem::Version
|
69
|
-
version: 1.
|
69
|
+
version: 1.2.0
|
70
70
|
type: :development
|
71
71
|
prerelease: false
|
72
72
|
version_requirements: !ruby/object:Gem::Requirement
|
73
73
|
none: false
|
74
74
|
requirements:
|
75
|
-
- -
|
75
|
+
- - '='
|
76
76
|
- !ruby/object:Gem::Version
|
77
|
-
version: 1.
|
77
|
+
version: 1.2.0
|
78
78
|
- !ruby/object:Gem::Dependency
|
79
|
-
name:
|
79
|
+
name: json_spec
|
80
80
|
requirement: !ruby/object:Gem::Requirement
|
81
81
|
none: false
|
82
82
|
requirements:
|
83
83
|
- - ~>
|
84
84
|
- !ruby/object:Gem::Version
|
85
|
-
version: 1.
|
86
|
-
type: :
|
85
|
+
version: 1.1.1
|
86
|
+
type: :development
|
87
87
|
prerelease: false
|
88
88
|
version_requirements: !ruby/object:Gem::Requirement
|
89
89
|
none: false
|
90
90
|
requirements:
|
91
91
|
- - ~>
|
92
92
|
- !ruby/object:Gem::Version
|
93
|
-
version: 1.
|
93
|
+
version: 1.1.1
|
94
94
|
- !ruby/object:Gem::Dependency
|
95
|
-
name:
|
95
|
+
name: rake
|
96
96
|
requirement: !ruby/object:Gem::Requirement
|
97
97
|
none: false
|
98
98
|
requirements:
|
99
99
|
- - ! '>='
|
100
100
|
- !ruby/object:Gem::Version
|
101
101
|
version: '0'
|
102
|
-
type: :
|
102
|
+
type: :development
|
103
103
|
prerelease: false
|
104
104
|
version_requirements: !ruby/object:Gem::Requirement
|
105
105
|
none: false
|
@@ -108,45 +108,45 @@ dependencies:
|
|
108
108
|
- !ruby/object:Gem::Version
|
109
109
|
version: '0'
|
110
110
|
- !ruby/object:Gem::Dependency
|
111
|
-
name:
|
111
|
+
name: rspec
|
112
112
|
requirement: !ruby/object:Gem::Requirement
|
113
113
|
none: false
|
114
114
|
requirements:
|
115
|
-
- -
|
115
|
+
- - ~>
|
116
116
|
- !ruby/object:Gem::Version
|
117
|
-
version:
|
118
|
-
type: :
|
117
|
+
version: 2.14.1
|
118
|
+
type: :development
|
119
119
|
prerelease: false
|
120
120
|
version_requirements: !ruby/object:Gem::Requirement
|
121
121
|
none: false
|
122
122
|
requirements:
|
123
|
-
- -
|
123
|
+
- - ~>
|
124
124
|
- !ruby/object:Gem::Version
|
125
|
-
version:
|
125
|
+
version: 2.14.1
|
126
126
|
- !ruby/object:Gem::Dependency
|
127
|
-
name:
|
127
|
+
name: rspec-mocks
|
128
128
|
requirement: !ruby/object:Gem::Requirement
|
129
129
|
none: false
|
130
130
|
requirements:
|
131
131
|
- - ~>
|
132
132
|
- !ruby/object:Gem::Version
|
133
|
-
version:
|
134
|
-
type: :
|
133
|
+
version: 2.14.3
|
134
|
+
type: :development
|
135
135
|
prerelease: false
|
136
136
|
version_requirements: !ruby/object:Gem::Requirement
|
137
137
|
none: false
|
138
138
|
requirements:
|
139
139
|
- - ~>
|
140
140
|
- !ruby/object:Gem::Version
|
141
|
-
version:
|
141
|
+
version: 2.14.3
|
142
142
|
- !ruby/object:Gem::Dependency
|
143
|
-
name:
|
143
|
+
name: rubocop
|
144
144
|
requirement: !ruby/object:Gem::Requirement
|
145
145
|
none: false
|
146
146
|
requirements:
|
147
147
|
- - ~>
|
148
148
|
- !ruby/object:Gem::Version
|
149
|
-
version: 0.
|
149
|
+
version: 0.23.0
|
150
150
|
type: :development
|
151
151
|
prerelease: false
|
152
152
|
version_requirements: !ruby/object:Gem::Requirement
|
@@ -154,23 +154,23 @@ dependencies:
|
|
154
154
|
requirements:
|
155
155
|
- - ~>
|
156
156
|
- !ruby/object:Gem::Version
|
157
|
-
version: 0.
|
157
|
+
version: 0.23.0
|
158
158
|
- !ruby/object:Gem::Dependency
|
159
|
-
name:
|
159
|
+
name: simplecov
|
160
160
|
requirement: !ruby/object:Gem::Requirement
|
161
161
|
none: false
|
162
162
|
requirements:
|
163
|
-
- -
|
163
|
+
- - ~>
|
164
164
|
- !ruby/object:Gem::Version
|
165
|
-
version:
|
165
|
+
version: 0.7.1
|
166
166
|
type: :development
|
167
167
|
prerelease: false
|
168
168
|
version_requirements: !ruby/object:Gem::Requirement
|
169
169
|
none: false
|
170
170
|
requirements:
|
171
|
-
- -
|
171
|
+
- - ~>
|
172
172
|
- !ruby/object:Gem::Version
|
173
|
-
version:
|
173
|
+
version: 0.7.1
|
174
174
|
description: ! "Vcloud-walker is a command line tool to describe different vCloud
|
175
175
|
entities.\n This tool is a thin layer around fog api, which exposes
|
176
176
|
summarized vCloud entities\n in the form of JSON"
|
@@ -181,7 +181,9 @@ extensions: []
|
|
181
181
|
extra_rdoc_files: []
|
182
182
|
files:
|
183
183
|
- .gitignore
|
184
|
+
- .travis.yml
|
184
185
|
- CHANGELOG.md
|
186
|
+
- CONTRIBUTING.md
|
185
187
|
- Gemfile
|
186
188
|
- LICENSE
|
187
189
|
- README.md
|
@@ -194,6 +196,7 @@ files:
|
|
194
196
|
- jenkins.sh
|
195
197
|
- jenkins_integration_tests.sh
|
196
198
|
- lib/vcloud/walker.rb
|
199
|
+
- lib/vcloud/walker/cli.rb
|
197
200
|
- lib/vcloud/walker/fog_interface.rb
|
198
201
|
- lib/vcloud/walker/resource.rb
|
199
202
|
- lib/vcloud/walker/resource/catalog.rb
|
@@ -216,18 +219,19 @@ files:
|
|
216
219
|
- spec/spec_helper.rb
|
217
220
|
- spec/stubs/service_layer_stub.rb
|
218
221
|
- spec/stubs/stubs.rb
|
222
|
+
- spec/vcloud/walker/cli_spec.rb
|
223
|
+
- spec/vcloud/walker/resource/catalogs_spec.rb
|
224
|
+
- spec/vcloud/walker/resource/entity_spec.rb
|
225
|
+
- spec/vcloud/walker/resource/gateway_ipsec_vpn_service_spec.rb
|
226
|
+
- spec/vcloud/walker/resource/network_spec.rb
|
227
|
+
- spec/vcloud/walker/resource/organization_spec.rb
|
228
|
+
- spec/vcloud/walker/resource/vapp_spec.rb
|
229
|
+
- spec/vcloud/walker/resource/vdcs_spec.rb
|
230
|
+
- spec/vcloud/walker/resource/vm_spec.rb
|
219
231
|
- spec/vcloud/walker_spec.rb
|
220
|
-
- spec/walk/catalogs_spec.rb
|
221
|
-
- spec/walk/entity_spec.rb
|
222
|
-
- spec/walk/gateway_ipsec_vpn_service_spec.rb
|
223
|
-
- spec/walk/network_spec.rb
|
224
|
-
- spec/walk/organization_spec.rb
|
225
|
-
- spec/walk/vapp_spec.rb
|
226
|
-
- spec/walk/vdcs_spec.rb
|
227
|
-
- spec/walk/vm_spec.rb
|
228
232
|
- tools/fog_credentials.rb
|
229
233
|
- vcloud-walker.gemspec
|
230
|
-
homepage: https://github.com/
|
234
|
+
homepage: https://github.com/gds-operations/vcloud-walker
|
231
235
|
licenses:
|
232
236
|
- MIT
|
233
237
|
post_install_message:
|
@@ -239,10 +243,7 @@ required_ruby_version: !ruby/object:Gem::Requirement
|
|
239
243
|
requirements:
|
240
244
|
- - ! '>='
|
241
245
|
- !ruby/object:Gem::Version
|
242
|
-
version:
|
243
|
-
segments:
|
244
|
-
- 0
|
245
|
-
hash: 523235107079612422
|
246
|
+
version: 1.9.3
|
246
247
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
247
248
|
none: false
|
248
249
|
requirements:
|
@@ -251,7 +252,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
251
252
|
version: '0'
|
252
253
|
segments:
|
253
254
|
- 0
|
254
|
-
hash:
|
255
|
+
hash: 2006502224418708712
|
255
256
|
requirements: []
|
256
257
|
rubyforge_project:
|
257
258
|
rubygems_version: 1.8.23
|
@@ -264,12 +265,13 @@ test_files:
|
|
264
265
|
- spec/spec_helper.rb
|
265
266
|
- spec/stubs/service_layer_stub.rb
|
266
267
|
- spec/stubs/stubs.rb
|
268
|
+
- spec/vcloud/walker/cli_spec.rb
|
269
|
+
- spec/vcloud/walker/resource/catalogs_spec.rb
|
270
|
+
- spec/vcloud/walker/resource/entity_spec.rb
|
271
|
+
- spec/vcloud/walker/resource/gateway_ipsec_vpn_service_spec.rb
|
272
|
+
- spec/vcloud/walker/resource/network_spec.rb
|
273
|
+
- spec/vcloud/walker/resource/organization_spec.rb
|
274
|
+
- spec/vcloud/walker/resource/vapp_spec.rb
|
275
|
+
- spec/vcloud/walker/resource/vdcs_spec.rb
|
276
|
+
- spec/vcloud/walker/resource/vm_spec.rb
|
267
277
|
- spec/vcloud/walker_spec.rb
|
268
|
-
- spec/walk/catalogs_spec.rb
|
269
|
-
- spec/walk/entity_spec.rb
|
270
|
-
- spec/walk/gateway_ipsec_vpn_service_spec.rb
|
271
|
-
- spec/walk/network_spec.rb
|
272
|
-
- spec/walk/organization_spec.rb
|
273
|
-
- spec/walk/vapp_spec.rb
|
274
|
-
- spec/walk/vdcs_spec.rb
|
275
|
-
- spec/walk/vm_spec.rb
|
data/spec/walk/catalogs_spec.rb
DELETED
@@ -1,31 +0,0 @@
|
|
1
|
-
require 'spec_helper'
|
2
|
-
require 'rspec/mocks'
|
3
|
-
|
4
|
-
describe Vcloud::Walker::Resource::Catalogs do
|
5
|
-
|
6
|
-
it "should summarize catalogs" do
|
7
|
-
set_login_credential
|
8
|
-
mock_fog_item = double(:catalog_item,
|
9
|
-
:id => "12345",
|
10
|
-
:name => 'ubuntu 11.04',
|
11
|
-
:description => 'image for ubuntu 11.04',
|
12
|
-
:vapp_template_id => 'vapp-template-01')
|
13
|
-
mock_fog_catalog = double(:catalog,
|
14
|
-
:id => 'catalog_id_1',
|
15
|
-
:name => 'Default catalog',
|
16
|
-
:description => 'default catalog for infrastructure',
|
17
|
-
:catalog_items => double(:catalog_items, :all => [mock_fog_item]))
|
18
|
-
|
19
|
-
catalog_summary = Vcloud::Walker::Resource::Catalogs.new([mock_fog_catalog]).to_summary
|
20
|
-
catalog_summary.count.should == 1
|
21
|
-
catalog_summary.first[:items].count.should == 1
|
22
|
-
catalog_summary.should == [{
|
23
|
-
:id => "catalog_id_1",
|
24
|
-
:name => "Default catalog",
|
25
|
-
:description => "default catalog for infrastructure",
|
26
|
-
:items => [
|
27
|
-
{:id => "12345", :name => "ubuntu 11.04", :description => "image for ubuntu 11.04", :vapp_template_id => "vapp-template-01"}
|
28
|
-
]
|
29
|
-
}]
|
30
|
-
end
|
31
|
-
end
|
@@ -1,53 +0,0 @@
|
|
1
|
-
require 'spec_helper'
|
2
|
-
|
3
|
-
describe Vcloud::Walker::Resource::Organization do
|
4
|
-
|
5
|
-
it "should retrieve networks" do
|
6
|
-
fog_networks = double(:fog_networks)
|
7
|
-
Vcloud::Walker::FogInterface.should_receive(:get_networks).and_return(fog_networks)
|
8
|
-
Vcloud::Walker::Resource::Networks.should_receive(:new).with(fog_networks).and_return(double(:walker_networks, :to_summary => [:network => "Network 1"]))
|
9
|
-
Vcloud::Walker::Resource::Organization.networks.should == [:network => "Network 1"]
|
10
|
-
end
|
11
|
-
|
12
|
-
it "should retrieve catalogs" do
|
13
|
-
fog_catalogs = double(:fog_catalogs)
|
14
|
-
Vcloud::Walker::FogInterface.should_receive(:get_catalogs).and_return(fog_catalogs)
|
15
|
-
Vcloud::Walker::Resource::Catalogs.should_receive(:new).with(fog_catalogs).and_return(double(:walker_catalogs, :to_summary => [:catalog => "Catalog 1"]))
|
16
|
-
Vcloud::Walker::Resource::Organization.catalogs.should == [:catalog => "Catalog 1"]
|
17
|
-
end
|
18
|
-
|
19
|
-
it "should retrieve vdcs" do
|
20
|
-
fog_vdcs = double(:fog_vdcs)
|
21
|
-
Vcloud::Walker::FogInterface.should_receive(:get_vdcs).and_return(fog_vdcs)
|
22
|
-
Vcloud::Walker::Resource::Vdcs.should_receive(:new).with(fog_vdcs).and_return(double(:walker_vdcs, :to_summary => [:vdc => "VDC 1"]))
|
23
|
-
Vcloud::Walker::Resource::Organization.vdcs.should == [:vdc => "VDC 1"]
|
24
|
-
end
|
25
|
-
|
26
|
-
it "should retrieve edgegateways" do
|
27
|
-
fog_edgegateways = [{:id => 'urn:vcloud:gateway:1', :href => 'host/1', :name => 'Gateway 1',
|
28
|
-
:Configuration => { :EdgeGatewayServiceConfiguration => {}}}]
|
29
|
-
Vcloud::Walker::FogInterface.should_receive(:get_edge_gateways).and_return(fog_edgegateways)
|
30
|
-
|
31
|
-
Vcloud::Walker::Resource::Organization.edgegateways.should == [{:id => '1',
|
32
|
-
name: 'Gateway 1',
|
33
|
-
:href => 'host/1',
|
34
|
-
:Configuration => {
|
35
|
-
:EdgeGatewayServiceConfiguration => {}}
|
36
|
-
}]
|
37
|
-
end
|
38
|
-
|
39
|
-
it "should retrive entire organization" do
|
40
|
-
Vcloud::Walker::Resource::Organization.should_receive(:edgegateways).and_return([:edgegateway => 'Gateway 1'])
|
41
|
-
Vcloud::Walker::Resource::Organization.should_receive(:vdcs).and_return([:vdc => "VDC 1"])
|
42
|
-
Vcloud::Walker::Resource::Organization.should_receive(:catalogs).and_return([:catalog => "Catalog 1"])
|
43
|
-
Vcloud::Walker::Resource::Organization.should_receive(:networks).and_return([:network => "Network 1"])
|
44
|
-
|
45
|
-
Vcloud::Walker::Resource::Organization.organization.should == {
|
46
|
-
:vdcs => [{ :vdc => "VDC 1" }],
|
47
|
-
:networks => [{ :network => "Network 1" }],
|
48
|
-
:catalogs => [{ :catalog => "Catalog 1" }],
|
49
|
-
:edgegateways => [{ :edgegateway => "Gateway 1" }]
|
50
|
-
}
|
51
|
-
end
|
52
|
-
end
|
53
|
-
|
data/spec/walk/vapp_spec.rb
DELETED
@@ -1,24 +0,0 @@
|
|
1
|
-
require 'spec_helper'
|
2
|
-
|
3
|
-
describe Vcloud::Walker::Resource::VApp do
|
4
|
-
|
5
|
-
context 'populate summary vapp model' do
|
6
|
-
before(:each) do
|
7
|
-
fog_vapp = Fog::ServiceLayerStub.vapp_body
|
8
|
-
@metadata = {:name => 'web-app-1', :shutdown => true}
|
9
|
-
Vcloud::Core::Vapp.should_receive(:get_metadata).with("vapp-aaaaaaaa-bbbb-cccc-dddd-eeeeeeeeeeee").and_return(@metadata)
|
10
|
-
Vcloud::Walker::Resource::Vms.should_receive(:new).with(fog_vapp[:Children][:Vm])
|
11
|
-
|
12
|
-
@vapp_summary = Vcloud::Walker::Resource::VApp.new(fog_vapp)
|
13
|
-
end
|
14
|
-
|
15
|
-
it 'should report id from the href' do
|
16
|
-
@vapp_summary.id.should == 'vapp-aaaaaaaa-bbbb-cccc-dddd-eeeeeeeeeeee'
|
17
|
-
end
|
18
|
-
|
19
|
-
it "should report metadata" do
|
20
|
-
@vapp_summary.metadata.count.should == 2
|
21
|
-
@vapp_summary.metadata.should == @metadata
|
22
|
-
end
|
23
|
-
end
|
24
|
-
end
|
data/spec/walk/vdcs_spec.rb
DELETED
@@ -1,30 +0,0 @@
|
|
1
|
-
require 'spec_helper'
|
2
|
-
require 'fog'
|
3
|
-
|
4
|
-
describe Vcloud::Walker::Resource::Vdcs do
|
5
|
-
let(:api_session) { double(:fog_session) }
|
6
|
-
|
7
|
-
context 'vdcs' do
|
8
|
-
|
9
|
-
it "should summarize vdcs" do
|
10
|
-
Fog::Compute::VcloudDirector.should_receive(:new).with(any_args()).and_return(api_session)
|
11
|
-
mock_fog_vdcs = StubCollectionBuilders.vdcs(StubVdc.new.vapps([mock_vapp]).build)
|
12
|
-
api_session.should_receive(:get_vapp).with(1).and_return(Fog::ServiceLayerStub.mock_vapp)
|
13
|
-
Vcloud::Core::Vm.should_receive(:get_metadata).with("vm-d19d84a5-c950-4497-a638-23eccc4226a5").and_return({})
|
14
|
-
Vcloud::Core::Vapp.should_receive(:get_metadata).with("vapp-aaaaaaaa-bbbb-cccc-dddd-eeeeeeeeeeee").and_return({})
|
15
|
-
|
16
|
-
vdcs_summary = Vcloud::Walker::Resource::Vdcs.new(mock_fog_vdcs).to_summary
|
17
|
-
|
18
|
-
vdc_summary = vdcs_summary.first
|
19
|
-
vdc_summary[:vapps].count.should == 1
|
20
|
-
vdc_summary[:vapps].first[:vms].count == 1
|
21
|
-
end
|
22
|
-
|
23
|
-
private
|
24
|
-
|
25
|
-
def mock_vapp
|
26
|
-
double(:vapp, :id => 1)
|
27
|
-
end
|
28
|
-
|
29
|
-
end
|
30
|
-
end
|