vcloud-edge_gateway 0.0.2 → 0.1.0
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/CHANGELOG.md +11 -0
- data/jenkins_integration_tests.sh +8 -0
- data/lib/vcloud/edge_gateway/configuration_generator/load_balancer_service.rb +1 -7
- data/lib/vcloud/edge_gateway/configuration_generator/nat_service.rb +16 -6
- data/lib/vcloud/edge_gateway/edge_gateway_configuration.rb +34 -9
- data/lib/vcloud/edge_gateway/load_balancer_configuration_differ.rb +28 -0
- data/lib/vcloud/edge_gateway/version.rb +1 -1
- data/lib/vcloud/edge_gateway.rb +1 -0
- data/lib/vcloud/edge_gateway_services.rb +9 -4
- data/lib/vcloud/schema/edge_gateway.rb +2 -1
- data/lib/vcloud/schema/load_balancer_service.rb +3 -2
- data/spec/erb_helper.rb +1 -1
- data/spec/integration/edge_gateway/data/load_balancer_config.yaml.erb +24 -0
- data/spec/integration/edge_gateway/data/load_balancer_empty.yaml.erb +4 -0
- data/spec/integration/edge_gateway/data/load_balancer_single_pool.yaml.erb +15 -0
- data/spec/integration/edge_gateway/data/load_balancer_single_virtual_server_invalid_pool.yaml.erb +13 -0
- data/spec/integration/edge_gateway/data/load_balancer_single_virtual_server_missing_pool.yaml.erb +12 -0
- data/spec/integration/edge_gateway/data/nat_and_firewall_plus_load_balancer_config.yaml.erb +54 -0
- data/spec/integration/edge_gateway/edge_gateway_services_spec.rb +52 -23
- data/spec/integration/edge_gateway/load_balancer_service_spec.rb +204 -0
- data/spec/integration/edge_gateway/nat_service_spec.rb +7 -2
- data/spec/vcloud/edge_gateway/configuration_generator/data/load_balancer_http-output.yaml +2 -2
- data/spec/vcloud/edge_gateway/configuration_generator/data/load_balancer_https-output.yaml +2 -0
- data/spec/vcloud/edge_gateway/configuration_generator/data/load_balancer_mixed_complex-output.yaml +1 -0
- data/spec/vcloud/edge_gateway/configuration_generator/load_balancer_service_spec.rb +2 -0
- data/spec/vcloud/edge_gateway/configuration_generator/nat_service_spec.rb +198 -94
- data/spec/vcloud/edge_gateway/edge_gateway_configuration_spec.rb +1043 -88
- data/spec/vcloud/edge_gateway/load_balancer_configuration_differ_spec.rb +160 -0
- data/spec/vcloud/edge_gateway/load_balancer_schema_validation_spec.rb +4 -6
- data/vcloud-edge_gateway.gemspec +1 -1
- metadata +24 -5
@@ -0,0 +1,160 @@
|
|
1
|
+
require 'spec_helper'
|
2
|
+
|
3
|
+
module Vcloud
|
4
|
+
module EdgeGateway
|
5
|
+
describe LoadBalancerConfigurationDiffer do
|
6
|
+
|
7
|
+
test_cases = [
|
8
|
+
{
|
9
|
+
title: 'should return an empty array for two identical empty Hashes',
|
10
|
+
src: { },
|
11
|
+
dest: { },
|
12
|
+
output: [],
|
13
|
+
},
|
14
|
+
|
15
|
+
{
|
16
|
+
title: 'should return an empty array for two identical simple Hashes',
|
17
|
+
src: { testing: 'testing', one: 1, two: 'two', three: "3" },
|
18
|
+
dest: { testing: 'testing', one: 1, two: 'two', three: "3" },
|
19
|
+
output: [],
|
20
|
+
},
|
21
|
+
|
22
|
+
{
|
23
|
+
title: 'should return an empty array for two identical deep Hashes',
|
24
|
+
src: { testing: 'testing', one: 1, deep: [
|
25
|
+
{ foo: 'bar', deeper: [ 1, 2, 3, 4, 5 ] },
|
26
|
+
{ baz: 'bop', deeper: [ 6, 5, 4, 3, 2 ] },
|
27
|
+
]},
|
28
|
+
dest: { testing: 'testing', one: 1, deep: [
|
29
|
+
{ foo: 'bar', deeper: [ 1, 2, 3, 4, 5 ] },
|
30
|
+
{ baz: 'bop', deeper: [ 6, 5, 4, 3, 2 ] },
|
31
|
+
]},
|
32
|
+
output: [],
|
33
|
+
},
|
34
|
+
|
35
|
+
{
|
36
|
+
title: 'should highlight a simple addition',
|
37
|
+
src: { foo: '1' },
|
38
|
+
dest: { foo: '1', bar: '2' },
|
39
|
+
output: [["+", "bar", "2"]],
|
40
|
+
},
|
41
|
+
|
42
|
+
{
|
43
|
+
title: 'should highlight a simple subtraction',
|
44
|
+
src: { foo: '1', bar: '2' },
|
45
|
+
dest: { foo: '1' },
|
46
|
+
output: [["-", "bar", "2"]],
|
47
|
+
},
|
48
|
+
|
49
|
+
{
|
50
|
+
title: 'should highlight a deep addition',
|
51
|
+
src: { testing: 'testing', one: 1, deep: [
|
52
|
+
{ foo: 'bar', deeper: [ 1, 2, 3, 4, 5 ] },
|
53
|
+
{ baz: 'bop', deeper: [ 6, 5, 4, 3, 2 ] },
|
54
|
+
]},
|
55
|
+
dest: { testing: 'testing', one: 1, deep: [
|
56
|
+
{ foo: 'bar', deeper: [ 1, 2, 3, 4, 5, 6 ] },
|
57
|
+
{ baz: 'bop', deeper: [ 6, 5, 4, 3, 2 ] },
|
58
|
+
]},
|
59
|
+
output: [["+", "deep[0].deeper[5]", 6]],
|
60
|
+
},
|
61
|
+
|
62
|
+
{
|
63
|
+
title: 'should highlight a deep subtraction',
|
64
|
+
src: { testing: 'testing', one: 1, deep: [
|
65
|
+
{ foo: 'bar', deeper: [ 1, 2, 3, 4, 5 ] },
|
66
|
+
{ baz: 'bop', deeper: [ 6, 5, 4, 3, 2 ] },
|
67
|
+
]},
|
68
|
+
dest: { testing: 'testing', one: 1, deep: [
|
69
|
+
{ foo: 'bar', deeper: [ 1, 2, 3, 4, 5 ] },
|
70
|
+
{ baz: 'bop', deeper: [ 6, 5, 3, 2 ] },
|
71
|
+
]},
|
72
|
+
output: [["-", "deep[1].deeper[2]", 4]],
|
73
|
+
},
|
74
|
+
|
75
|
+
{
|
76
|
+
title: 'should return an empty array when hash params are reordered',
|
77
|
+
src: { one: 1, testing: 'testing', deep: [
|
78
|
+
{ deeper: [ 1, 2, 3, 4, 5 ], foo: 'bar' },
|
79
|
+
{ baz: 'bop', deeper: [ 6, 5, 4, 3, 2 ] },
|
80
|
+
]},
|
81
|
+
dest: { testing: 'testing', one: 1, deep: [
|
82
|
+
{ foo: 'bar', deeper: [ 1, 2, 3, 4, 5 ] },
|
83
|
+
{ baz: 'bop', deeper: [ 6, 5, 4, 3, 2 ] },
|
84
|
+
]},
|
85
|
+
output: [],
|
86
|
+
},
|
87
|
+
|
88
|
+
{
|
89
|
+
title: 'should highlight when array elements are reordered',
|
90
|
+
src: { testing: 'testing', one: 1, deep: [
|
91
|
+
{ baz: 'bop', deeper: [ 6, 5, 4, 3, 2 ] },
|
92
|
+
{ foo: 'bar', deeper: [ 1, 2, 3, 4, 5 ] },
|
93
|
+
]},
|
94
|
+
dest: { testing: 'testing', one: 1, deep: [
|
95
|
+
{ foo: 'bar', deeper: [ 1, 2, 3, 4, 5 ] },
|
96
|
+
{ baz: 'bop', deeper: [ 6, 5, 4, 3, 2 ] },
|
97
|
+
]},
|
98
|
+
output: [
|
99
|
+
["+", "deep[0]", {:foo=>"bar", :deeper=>[1, 2, 3, 4, 5]}],
|
100
|
+
["-", "deep[2]", {:foo=>"bar", :deeper=>[1, 2, 3, 4, 5]}],
|
101
|
+
]
|
102
|
+
},
|
103
|
+
|
104
|
+
{
|
105
|
+
title: 'should highlight when deep array elements are reordered',
|
106
|
+
src: { testing: 'testing', one: 1, deep: [
|
107
|
+
{ foo: 'bar', deeper: [ 1, 2, 3, 4, 5 ] },
|
108
|
+
{ baz: 'bop', deeper: [ 5, 6, 4, 3, 2 ] },
|
109
|
+
]},
|
110
|
+
dest: { testing: 'testing', one: 1, deep: [
|
111
|
+
{ foo: 'bar', deeper: [ 1, 2, 3, 4, 5 ] },
|
112
|
+
{ baz: 'bop', deeper: [ 6, 5, 4, 3, 2 ] },
|
113
|
+
]},
|
114
|
+
output: [
|
115
|
+
["+", "deep[1].deeper[0]", 6],
|
116
|
+
["-", "deep[1].deeper[2]", 6]
|
117
|
+
]
|
118
|
+
},
|
119
|
+
|
120
|
+
{
|
121
|
+
title: 'should ignore remote config having additional :Operational keys in :Pool entries',
|
122
|
+
src: { Pool: [
|
123
|
+
{ foo: 'bar', deeper: [ 1, 2, 3, 4, 5 ] },
|
124
|
+
{ baz: 'bop', deeper: [ 5, 6, 4, 3, 2 ] },
|
125
|
+
]},
|
126
|
+
dest: { Pool: [
|
127
|
+
{ foo: 'bar', Operational: 'wibble', deeper: [ 1, 2, 3, 4, 5 ] },
|
128
|
+
{ baz: 'bop', Operational: 'wobble', deeper: [ 5, 6, 4, 3, 2 ] },
|
129
|
+
]},
|
130
|
+
output: []
|
131
|
+
},
|
132
|
+
|
133
|
+
{
|
134
|
+
title: 'should ignore remote config having additional :Operational keys in :Pool entries, yet still report other differences ',
|
135
|
+
src: { Pool: [
|
136
|
+
{ foo: 'bar', deeper: [ 1, 2, 3, 4, 5 ] },
|
137
|
+
{ baz: 'bop', deeper: [ 5, 6, 4, 3, 2 ] },
|
138
|
+
]},
|
139
|
+
dest: { Pool: [
|
140
|
+
{ foo: 'bar', Operational: 'wibble', deeper: [ 1, 2, 3, 4, 5 ] },
|
141
|
+
{ baz: 'bop', Operational: 'wobble', deeper: [ 6, 5, 4, 3, 2 ] },
|
142
|
+
]},
|
143
|
+
output: [
|
144
|
+
["+", "Pool[1].deeper[0]", 6],
|
145
|
+
["-", "Pool[1].deeper[2]", 6]
|
146
|
+
]
|
147
|
+
},
|
148
|
+
|
149
|
+
]
|
150
|
+
|
151
|
+
test_cases.each do |test_case|
|
152
|
+
it "#{test_case[:title]}" do
|
153
|
+
differ = LoadBalancerConfigurationDiffer.new(test_case[:src], test_case[:dest])
|
154
|
+
expect(differ.diff).to eq(test_case[:output])
|
155
|
+
end
|
156
|
+
end
|
157
|
+
|
158
|
+
end
|
159
|
+
end
|
160
|
+
end
|
@@ -129,22 +129,20 @@ module Vcloud
|
|
129
129
|
expect(validator.valid?).to be_true
|
130
130
|
end
|
131
131
|
|
132
|
-
it "should
|
132
|
+
it "should be ok if no pools are specified" do
|
133
133
|
input = {
|
134
134
|
virtual_servers: []
|
135
135
|
}
|
136
136
|
validator = ConfigValidator.validate(:base, input, Vcloud::Schema::LOAD_BALANCER_SERVICE)
|
137
|
-
expect(validator.
|
138
|
-
expect(validator.valid?).to be_false
|
137
|
+
expect(validator.valid?).to be_true
|
139
138
|
end
|
140
139
|
|
141
|
-
it "should
|
140
|
+
it "should be ok if no virtual_servers are specified" do
|
142
141
|
input = {
|
143
142
|
pools: []
|
144
143
|
}
|
145
144
|
validator = ConfigValidator.validate(:base, input, Vcloud::Schema::LOAD_BALANCER_SERVICE)
|
146
|
-
expect(validator.
|
147
|
-
expect(validator.valid?).to be_false
|
145
|
+
expect(validator.valid?).to be_true
|
148
146
|
end
|
149
147
|
|
150
148
|
end
|
data/vcloud-edge_gateway.gemspec
CHANGED
@@ -22,7 +22,7 @@ Gem::Specification.new do |s|
|
|
22
22
|
s.required_ruby_version = '>= 1.9.2'
|
23
23
|
|
24
24
|
s.add_runtime_dependency 'fog', '>= 1.19.0'
|
25
|
-
s.add_runtime_dependency 'vcloud-core'
|
25
|
+
s.add_runtime_dependency 'vcloud-core', '>= 0.0.6'
|
26
26
|
s.add_runtime_dependency 'hashdiff'
|
27
27
|
s.add_development_dependency 'rake'
|
28
28
|
s.add_development_dependency 'rspec', '~> 2.14.1'
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: vcloud-edge_gateway
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.0
|
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-02-
|
12
|
+
date: 2014-02-20 00:00:00.000000000 Z
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: fog
|
@@ -34,7 +34,7 @@ dependencies:
|
|
34
34
|
requirements:
|
35
35
|
- - ! '>='
|
36
36
|
- !ruby/object:Gem::Version
|
37
|
-
version:
|
37
|
+
version: 0.0.6
|
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:
|
45
|
+
version: 0.0.6
|
46
46
|
- !ruby/object:Gem::Dependency
|
47
47
|
name: hashdiff
|
48
48
|
requirement: !ruby/object:Gem::Requirement
|
@@ -132,12 +132,14 @@ extensions: []
|
|
132
132
|
extra_rdoc_files: []
|
133
133
|
files:
|
134
134
|
- .gitignore
|
135
|
+
- CHANGELOG.md
|
135
136
|
- Gemfile
|
136
137
|
- LICENSE.txt
|
137
138
|
- README.md
|
138
139
|
- Rakefile
|
139
140
|
- bin/vcloud-edge
|
140
141
|
- jenkins.sh
|
142
|
+
- jenkins_integration_tests.sh
|
141
143
|
- lib/vcloud/config_loader.rb
|
142
144
|
- lib/vcloud/config_validator.rb
|
143
145
|
- lib/vcloud/edge_gateway.rb
|
@@ -147,6 +149,7 @@ files:
|
|
147
149
|
- lib/vcloud/edge_gateway/configuration_generator/load_balancer_service.rb
|
148
150
|
- lib/vcloud/edge_gateway/configuration_generator/nat_service.rb
|
149
151
|
- lib/vcloud/edge_gateway/edge_gateway_configuration.rb
|
152
|
+
- lib/vcloud/edge_gateway/load_balancer_configuration_differ.rb
|
150
153
|
- lib/vcloud/edge_gateway/version.rb
|
151
154
|
- lib/vcloud/edge_gateway_services.rb
|
152
155
|
- lib/vcloud/schema/edge_gateway.rb
|
@@ -160,10 +163,17 @@ files:
|
|
160
163
|
- spec/integration/edge_gateway/data/firewall_rule_order_test.yaml.erb
|
161
164
|
- spec/integration/edge_gateway/data/hairpin_nat_config.yaml.erb
|
162
165
|
- spec/integration/edge_gateway/data/incorrect_firewall_config.yaml
|
166
|
+
- spec/integration/edge_gateway/data/load_balancer_config.yaml.erb
|
167
|
+
- spec/integration/edge_gateway/data/load_balancer_empty.yaml.erb
|
168
|
+
- spec/integration/edge_gateway/data/load_balancer_single_pool.yaml.erb
|
169
|
+
- spec/integration/edge_gateway/data/load_balancer_single_virtual_server_invalid_pool.yaml.erb
|
170
|
+
- spec/integration/edge_gateway/data/load_balancer_single_virtual_server_missing_pool.yaml.erb
|
163
171
|
- spec/integration/edge_gateway/data/nat_and_firewall_config.yaml.erb
|
172
|
+
- spec/integration/edge_gateway/data/nat_and_firewall_plus_load_balancer_config.yaml.erb
|
164
173
|
- spec/integration/edge_gateway/data/nat_config.yaml.erb
|
165
174
|
- spec/integration/edge_gateway/edge_gateway_services_spec.rb
|
166
175
|
- spec/integration/edge_gateway/firewall_service_spec.rb
|
176
|
+
- spec/integration/edge_gateway/load_balancer_service_spec.rb
|
167
177
|
- spec/integration/edge_gateway/nat_service_spec.rb
|
168
178
|
- spec/spec_helper.rb
|
169
179
|
- spec/vcloud/config_loader_spec.rb
|
@@ -185,6 +195,7 @@ files:
|
|
185
195
|
- spec/vcloud/edge_gateway/configuration_generator/nat_service_spec.rb
|
186
196
|
- spec/vcloud/edge_gateway/edge_gateway_configuration_spec.rb
|
187
197
|
- spec/vcloud/edge_gateway/firewall_schema_validation_spec.rb
|
198
|
+
- spec/vcloud/edge_gateway/load_balancer_configuration_differ_spec.rb
|
188
199
|
- spec/vcloud/edge_gateway/load_balancer_schema_validation_spec.rb
|
189
200
|
- spec/vcloud/edge_gateway/nat_schema_validation_spec.rb
|
190
201
|
- vcloud-edge_gateway.gemspec
|
@@ -209,7 +220,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
209
220
|
version: '0'
|
210
221
|
segments:
|
211
222
|
- 0
|
212
|
-
hash: -
|
223
|
+
hash: -2116252486927951456
|
213
224
|
requirements: []
|
214
225
|
rubyforge_project:
|
215
226
|
rubygems_version: 1.8.23
|
@@ -223,10 +234,17 @@ test_files:
|
|
223
234
|
- spec/integration/edge_gateway/data/firewall_rule_order_test.yaml.erb
|
224
235
|
- spec/integration/edge_gateway/data/hairpin_nat_config.yaml.erb
|
225
236
|
- spec/integration/edge_gateway/data/incorrect_firewall_config.yaml
|
237
|
+
- spec/integration/edge_gateway/data/load_balancer_config.yaml.erb
|
238
|
+
- spec/integration/edge_gateway/data/load_balancer_empty.yaml.erb
|
239
|
+
- spec/integration/edge_gateway/data/load_balancer_single_pool.yaml.erb
|
240
|
+
- spec/integration/edge_gateway/data/load_balancer_single_virtual_server_invalid_pool.yaml.erb
|
241
|
+
- spec/integration/edge_gateway/data/load_balancer_single_virtual_server_missing_pool.yaml.erb
|
226
242
|
- spec/integration/edge_gateway/data/nat_and_firewall_config.yaml.erb
|
243
|
+
- spec/integration/edge_gateway/data/nat_and_firewall_plus_load_balancer_config.yaml.erb
|
227
244
|
- spec/integration/edge_gateway/data/nat_config.yaml.erb
|
228
245
|
- spec/integration/edge_gateway/edge_gateway_services_spec.rb
|
229
246
|
- spec/integration/edge_gateway/firewall_service_spec.rb
|
247
|
+
- spec/integration/edge_gateway/load_balancer_service_spec.rb
|
230
248
|
- spec/integration/edge_gateway/nat_service_spec.rb
|
231
249
|
- spec/spec_helper.rb
|
232
250
|
- spec/vcloud/config_loader_spec.rb
|
@@ -248,5 +266,6 @@ test_files:
|
|
248
266
|
- spec/vcloud/edge_gateway/configuration_generator/nat_service_spec.rb
|
249
267
|
- spec/vcloud/edge_gateway/edge_gateway_configuration_spec.rb
|
250
268
|
- spec/vcloud/edge_gateway/firewall_schema_validation_spec.rb
|
269
|
+
- spec/vcloud/edge_gateway/load_balancer_configuration_differ_spec.rb
|
251
270
|
- spec/vcloud/edge_gateway/load_balancer_schema_validation_spec.rb
|
252
271
|
- spec/vcloud/edge_gateway/nat_schema_validation_spec.rb
|