test-kitchen 1.2.1 → 1.3.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.cane +1 -1
- data/.rubocop.yml +3 -0
- data/.travis.yml +20 -9
- data/CHANGELOG.md +219 -108
- data/Gemfile +10 -6
- data/Guardfile +38 -9
- data/README.md +11 -1
- data/Rakefile +21 -37
- data/bin/kitchen +4 -4
- data/features/kitchen_action_commands.feature +161 -0
- data/features/kitchen_console_command.feature +34 -0
- data/features/kitchen_diagnose_command.feature +64 -0
- data/features/kitchen_init_command.feature +29 -17
- data/features/kitchen_list_command.feature +2 -2
- data/features/kitchen_login_command.feature +56 -0
- data/features/{sink_command.feature → kitchen_sink_command.feature} +0 -0
- data/features/kitchen_test_command.feature +88 -0
- data/features/step_definitions/gem_steps.rb +8 -6
- data/features/step_definitions/git_steps.rb +4 -2
- data/features/step_definitions/output_steps.rb +5 -0
- data/features/support/env.rb +12 -9
- data/lib/kitchen.rb +60 -38
- data/lib/kitchen/base64_stream.rb +55 -0
- data/lib/kitchen/busser.rb +124 -58
- data/lib/kitchen/cli.rb +121 -38
- data/lib/kitchen/collection.rb +3 -3
- data/lib/kitchen/color.rb +4 -4
- data/lib/kitchen/command.rb +78 -11
- data/lib/kitchen/command/action.rb +3 -2
- data/lib/kitchen/command/console.rb +12 -5
- data/lib/kitchen/command/diagnose.rb +17 -3
- data/lib/kitchen/command/driver_discover.rb +26 -7
- data/lib/kitchen/command/exec.rb +41 -0
- data/lib/kitchen/command/list.rb +44 -14
- data/lib/kitchen/command/login.rb +2 -1
- data/lib/kitchen/command/sink.rb +2 -1
- data/lib/kitchen/command/test.rb +5 -4
- data/lib/kitchen/config.rb +146 -14
- data/lib/kitchen/configurable.rb +314 -0
- data/lib/kitchen/data_munger.rb +522 -18
- data/lib/kitchen/diagnostic.rb +43 -4
- data/lib/kitchen/driver.rb +4 -4
- data/lib/kitchen/driver/base.rb +80 -115
- data/lib/kitchen/driver/dummy.rb +34 -6
- data/lib/kitchen/driver/proxy.rb +14 -3
- data/lib/kitchen/driver/ssh_base.rb +61 -7
- data/lib/kitchen/errors.rb +109 -9
- data/lib/kitchen/generator/driver_create.rb +39 -5
- data/lib/kitchen/generator/init.rb +130 -45
- data/lib/kitchen/instance.rb +162 -28
- data/lib/kitchen/lazy_hash.rb +79 -7
- data/lib/kitchen/loader/yaml.rb +159 -27
- data/lib/kitchen/logger.rb +267 -21
- data/lib/kitchen/logging.rb +30 -3
- data/lib/kitchen/login_command.rb +11 -2
- data/lib/kitchen/metadata_chopper.rb +2 -2
- data/lib/kitchen/provisioner.rb +4 -4
- data/lib/kitchen/provisioner/base.rb +107 -103
- data/lib/kitchen/provisioner/chef/berkshelf.rb +36 -8
- data/lib/kitchen/provisioner/chef/librarian.rb +40 -11
- data/lib/kitchen/provisioner/chef_base.rb +206 -167
- data/lib/kitchen/provisioner/chef_solo.rb +25 -7
- data/lib/kitchen/provisioner/chef_zero.rb +105 -29
- data/lib/kitchen/provisioner/dummy.rb +1 -1
- data/lib/kitchen/provisioner/shell.rb +21 -6
- data/lib/kitchen/rake_tasks.rb +8 -3
- data/lib/kitchen/shell_out.rb +15 -18
- data/lib/kitchen/ssh.rb +122 -27
- data/lib/kitchen/state_file.rb +24 -7
- data/lib/kitchen/thor_tasks.rb +9 -4
- data/lib/kitchen/util.rb +43 -118
- data/lib/kitchen/version.rb +1 -1
- data/lib/vendor/hash_recursive_merge.rb +10 -2
- data/spec/kitchen/base64_stream_spec.rb +77 -0
- data/spec/kitchen/busser_spec.rb +490 -0
- data/spec/kitchen/collection_spec.rb +10 -10
- data/spec/kitchen/color_spec.rb +2 -2
- data/spec/kitchen/config_spec.rb +234 -62
- data/spec/kitchen/configurable_spec.rb +490 -0
- data/spec/kitchen/data_munger_spec.rb +1070 -862
- data/spec/kitchen/diagnostic_spec.rb +79 -0
- data/spec/kitchen/driver/base_spec.rb +80 -85
- data/spec/kitchen/driver/dummy_spec.rb +43 -14
- data/spec/kitchen/driver/proxy_spec.rb +134 -0
- data/spec/kitchen/driver/ssh_base_spec.rb +644 -0
- data/spec/kitchen/driver_spec.rb +15 -15
- data/spec/kitchen/errors_spec.rb +309 -0
- data/spec/kitchen/instance_spec.rb +143 -46
- data/spec/kitchen/lazy_hash_spec.rb +36 -9
- data/spec/kitchen/loader/yaml_spec.rb +237 -226
- data/spec/kitchen/logger_spec.rb +419 -0
- data/spec/kitchen/logging_spec.rb +59 -0
- data/spec/kitchen/login_command_spec.rb +49 -0
- data/spec/kitchen/metadata_chopper_spec.rb +82 -0
- data/spec/kitchen/platform_spec.rb +4 -4
- data/spec/kitchen/provisioner/base_spec.rb +65 -125
- data/spec/kitchen/provisioner/chef_base_spec.rb +798 -0
- data/spec/kitchen/provisioner/chef_solo_spec.rb +316 -0
- data/spec/kitchen/provisioner/chef_zero_spec.rb +624 -0
- data/spec/kitchen/provisioner/shell_spec.rb +269 -0
- data/spec/kitchen/provisioner_spec.rb +6 -6
- data/spec/kitchen/shell_out_spec.rb +143 -0
- data/spec/kitchen/ssh_spec.rb +683 -0
- data/spec/kitchen/state_file_spec.rb +28 -21
- data/spec/kitchen/suite_spec.rb +7 -7
- data/spec/kitchen/util_spec.rb +68 -10
- data/spec/kitchen_spec.rb +107 -0
- data/spec/spec_helper.rb +18 -13
- data/support/chef-client-zero.rb +10 -9
- data/support/chef_helpers.sh +16 -0
- data/support/download_helpers.sh +109 -0
- data/test-kitchen.gemspec +42 -33
- metadata +107 -33
@@ -16,9 +16,9 @@
|
|
16
16
|
# See the License for the specific language governing permissions and
|
17
17
|
# limitations under the License.
|
18
18
|
|
19
|
-
require_relative
|
19
|
+
require_relative "../spec_helper"
|
20
20
|
|
21
|
-
require
|
21
|
+
require "kitchen/data_munger"
|
22
22
|
|
23
23
|
module Kitchen
|
24
24
|
|
@@ -27,7 +27,7 @@ module Kitchen
|
|
27
27
|
describe "#platform_data" do
|
28
28
|
|
29
29
|
it "returns an array of platform data" do
|
30
|
-
DataMunger.new(
|
30
|
+
DataMunger.new(
|
31
31
|
:platforms => [
|
32
32
|
{
|
33
33
|
:name => "one",
|
@@ -38,15 +38,15 @@ module Kitchen
|
|
38
38
|
:misc => "things"
|
39
39
|
}
|
40
40
|
]
|
41
|
-
|
42
|
-
|
43
|
-
|
44
|
-
|
45
|
-
|
46
|
-
|
47
|
-
|
48
|
-
|
49
|
-
|
41
|
+
).platform_data.must_equal([
|
42
|
+
{
|
43
|
+
:name => "one",
|
44
|
+
:stuff => "junk"
|
45
|
+
},
|
46
|
+
{
|
47
|
+
:name => "two",
|
48
|
+
:misc => "things"
|
49
|
+
}
|
50
50
|
])
|
51
51
|
end
|
52
52
|
|
@@ -58,7 +58,7 @@ module Kitchen
|
|
58
58
|
describe "#suite_data" do
|
59
59
|
|
60
60
|
it "returns an array of suite data" do
|
61
|
-
DataMunger.new(
|
61
|
+
DataMunger.new(
|
62
62
|
:suites => [
|
63
63
|
{
|
64
64
|
:name => "one",
|
@@ -69,15 +69,15 @@ module Kitchen
|
|
69
69
|
:misc => "things"
|
70
70
|
}
|
71
71
|
]
|
72
|
-
|
73
|
-
|
74
|
-
|
75
|
-
|
76
|
-
|
77
|
-
|
78
|
-
|
79
|
-
|
80
|
-
|
72
|
+
).suite_data.must_equal([
|
73
|
+
{
|
74
|
+
:name => "one",
|
75
|
+
:stuff => "junk"
|
76
|
+
},
|
77
|
+
{
|
78
|
+
:name => "two",
|
79
|
+
:misc => "things"
|
80
|
+
}
|
81
81
|
])
|
82
82
|
end
|
83
83
|
|
@@ -99,179 +99,217 @@ module Kitchen
|
|
99
99
|
describe "from single source" do
|
100
100
|
|
101
101
|
it "returns empty hash if no common #{key} hash is provided" do
|
102
|
-
DataMunger.new(
|
103
|
-
|
104
|
-
|
102
|
+
DataMunger.new(
|
103
|
+
{},
|
104
|
+
{}
|
105
|
+
).public_send("#{key}_data_for", "suite", "platform").must_equal({})
|
105
106
|
end
|
106
107
|
|
107
108
|
it "drops common #{key} if hash is nil" do
|
108
|
-
DataMunger.new(
|
109
|
-
|
110
|
-
|
109
|
+
DataMunger.new(
|
110
|
+
{
|
111
|
+
key => nil
|
112
|
+
},
|
113
|
+
{}
|
114
|
+
).public_send("#{key}_data_for", "suite", "plat").must_equal({})
|
111
115
|
end
|
112
116
|
|
113
117
|
it "returns kitchen config #{key} name" do
|
114
|
-
DataMunger.new(
|
115
|
-
|
116
|
-
|
117
|
-
|
118
|
+
DataMunger.new(
|
119
|
+
{},
|
120
|
+
{
|
121
|
+
:defaults => {
|
122
|
+
key => "thenoseknows"
|
123
|
+
}
|
118
124
|
}
|
119
|
-
|
125
|
+
).public_send("#{key}_data_for", "suite", "platform").must_equal(
|
120
126
|
default_key => "thenoseknows"
|
121
|
-
|
127
|
+
)
|
122
128
|
end
|
123
129
|
|
124
130
|
it "returns common #{key} name" do
|
125
|
-
DataMunger.new(
|
126
|
-
|
127
|
-
|
131
|
+
DataMunger.new(
|
132
|
+
{
|
133
|
+
key => "starship"
|
134
|
+
},
|
135
|
+
{}
|
136
|
+
).public_send("#{key}_data_for", "suite", "platform").must_equal(
|
128
137
|
default_key => "starship"
|
129
|
-
|
138
|
+
)
|
130
139
|
end
|
131
140
|
|
132
141
|
it "returns common #{key} config" do
|
133
|
-
DataMunger.new(
|
134
|
-
|
135
|
-
|
136
|
-
|
137
|
-
|
138
|
-
|
142
|
+
DataMunger.new(
|
143
|
+
{
|
144
|
+
key => {
|
145
|
+
default_key => "starship",
|
146
|
+
:speed => 42
|
147
|
+
}
|
148
|
+
},
|
149
|
+
{}
|
150
|
+
).public_send("#{key}_data_for", "suite", "platform").must_equal(
|
139
151
|
default_key => "starship",
|
140
152
|
:speed => 42
|
141
|
-
|
153
|
+
)
|
142
154
|
end
|
143
155
|
|
144
156
|
it "returns empty hash if platform config doesn't have #{key} hash" do
|
145
|
-
DataMunger.new(
|
146
|
-
|
147
|
-
|
148
|
-
|
149
|
-
|
157
|
+
DataMunger.new(
|
158
|
+
{
|
159
|
+
:platforms => [
|
160
|
+
{ :name => "plat" }
|
161
|
+
]
|
162
|
+
},
|
163
|
+
{}
|
164
|
+
).public_send("#{key}_data_for", "suite", "plat").must_equal({})
|
150
165
|
end
|
151
166
|
|
152
167
|
it "drops platform #{key} if hash is nil" do
|
153
|
-
DataMunger.new(
|
154
|
-
|
155
|
-
|
156
|
-
|
157
|
-
|
158
|
-
|
159
|
-
|
160
|
-
|
168
|
+
DataMunger.new(
|
169
|
+
{
|
170
|
+
:platforms => [
|
171
|
+
{
|
172
|
+
:name => "plat",
|
173
|
+
key => nil
|
174
|
+
}
|
175
|
+
]
|
176
|
+
},
|
177
|
+
{}
|
178
|
+
).public_send("#{key}_data_for", "suite", "plat").must_equal({})
|
161
179
|
end
|
162
180
|
|
163
181
|
it "returns platform #{key} name" do
|
164
|
-
DataMunger.new(
|
165
|
-
|
166
|
-
|
167
|
-
|
168
|
-
|
169
|
-
|
170
|
-
|
171
|
-
|
182
|
+
DataMunger.new(
|
183
|
+
{
|
184
|
+
:platforms => [
|
185
|
+
{
|
186
|
+
:name => "plat",
|
187
|
+
key => "flip"
|
188
|
+
}
|
189
|
+
]
|
190
|
+
},
|
191
|
+
{}
|
192
|
+
).public_send("#{key}_data_for", "suite", "plat").must_equal(
|
172
193
|
default_key => "flip"
|
173
|
-
|
194
|
+
)
|
174
195
|
end
|
175
196
|
|
176
197
|
it "returns platform config containing #{key} hash" do
|
177
|
-
DataMunger.new(
|
178
|
-
|
179
|
-
|
180
|
-
|
181
|
-
|
182
|
-
|
183
|
-
|
198
|
+
DataMunger.new(
|
199
|
+
{
|
200
|
+
:platforms => [
|
201
|
+
{
|
202
|
+
:name => "plat",
|
203
|
+
key => {
|
204
|
+
default_key => "flip",
|
205
|
+
:flop => "yep"
|
206
|
+
}
|
184
207
|
}
|
185
|
-
|
186
|
-
|
187
|
-
|
208
|
+
]
|
209
|
+
},
|
210
|
+
{}
|
211
|
+
).public_send("#{key}_data_for", "suite", "plat").must_equal(
|
188
212
|
default_key => "flip",
|
189
213
|
:flop => "yep"
|
190
|
-
|
214
|
+
)
|
191
215
|
end
|
192
216
|
|
193
217
|
it "returns empty hash if suite config doesn't have #{key} hash" do
|
194
|
-
DataMunger.new(
|
195
|
-
|
196
|
-
|
197
|
-
|
198
|
-
|
199
|
-
|
218
|
+
DataMunger.new(
|
219
|
+
{
|
220
|
+
:suites => [
|
221
|
+
{ :name => "sweet" }
|
222
|
+
]
|
223
|
+
},
|
224
|
+
{}
|
225
|
+
).public_send("#{key}_data_for", "sweet", "platform").must_equal({})
|
200
226
|
end
|
201
227
|
|
202
228
|
it "drops suite #{key} hash is nil" do
|
203
|
-
DataMunger.new(
|
204
|
-
|
205
|
-
|
206
|
-
|
207
|
-
|
208
|
-
|
209
|
-
|
210
|
-
|
229
|
+
DataMunger.new(
|
230
|
+
{
|
231
|
+
:suites => [
|
232
|
+
{
|
233
|
+
:name => "suite",
|
234
|
+
key => nil
|
235
|
+
}
|
236
|
+
]
|
237
|
+
},
|
238
|
+
{}
|
239
|
+
).public_send("#{key}_data_for", "suite", "plat").must_equal({})
|
211
240
|
end
|
212
241
|
|
213
242
|
it "returns suite #{key} name" do
|
214
|
-
DataMunger.new(
|
215
|
-
|
216
|
-
|
217
|
-
|
218
|
-
|
219
|
-
|
220
|
-
|
221
|
-
|
243
|
+
DataMunger.new(
|
244
|
+
{
|
245
|
+
:suites => [
|
246
|
+
{
|
247
|
+
:name => "sweet",
|
248
|
+
key => "waz"
|
249
|
+
}
|
250
|
+
]
|
251
|
+
},
|
252
|
+
{}
|
253
|
+
).public_send("#{key}_data_for", "sweet", "platform").must_equal(
|
222
254
|
default_key => "waz"
|
223
|
-
|
255
|
+
)
|
224
256
|
end
|
225
257
|
|
226
258
|
it "returns suite config containing #{key} hash" do
|
227
|
-
DataMunger.new(
|
228
|
-
|
229
|
-
|
230
|
-
|
231
|
-
|
232
|
-
|
233
|
-
|
259
|
+
DataMunger.new(
|
260
|
+
{
|
261
|
+
:suites => [
|
262
|
+
{
|
263
|
+
:name => "sweet",
|
264
|
+
key => {
|
265
|
+
default_key => "waz",
|
266
|
+
:up => "nope"
|
267
|
+
}
|
234
268
|
}
|
235
|
-
|
236
|
-
|
237
|
-
|
269
|
+
]
|
270
|
+
},
|
271
|
+
{}
|
272
|
+
).public_send("#{key}_data_for", "sweet", "platform").must_equal(
|
238
273
|
default_key => "waz",
|
239
274
|
:up => "nope"
|
240
|
-
|
275
|
+
)
|
241
276
|
end
|
242
277
|
end
|
243
278
|
|
244
279
|
describe "from multiple sources merging" do
|
245
280
|
|
246
281
|
it "suite into platform into common" do
|
247
|
-
DataMunger.new(
|
248
|
-
|
249
|
-
|
250
|
-
|
251
|
-
|
252
|
-
|
253
|
-
|
254
|
-
|
255
|
-
|
256
|
-
|
257
|
-
|
258
|
-
|
259
|
-
|
260
|
-
|
282
|
+
DataMunger.new(
|
283
|
+
{
|
284
|
+
key => {
|
285
|
+
default_key => "commony",
|
286
|
+
:color => "purple",
|
287
|
+
:fruit => %w[apple pear],
|
288
|
+
:deep => { :common => "junk" }
|
289
|
+
},
|
290
|
+
:platforms => [
|
291
|
+
{
|
292
|
+
:name => "plat",
|
293
|
+
key => {
|
294
|
+
default_key => "platformy",
|
295
|
+
:fruit => ["banana"],
|
296
|
+
:deep => { :platform => "stuff" }
|
297
|
+
}
|
261
298
|
}
|
262
|
-
|
263
|
-
|
264
|
-
|
265
|
-
|
266
|
-
|
267
|
-
|
268
|
-
|
269
|
-
|
270
|
-
|
299
|
+
],
|
300
|
+
:suites => [
|
301
|
+
{
|
302
|
+
:name => "sweet",
|
303
|
+
key => {
|
304
|
+
default_key => "suitey",
|
305
|
+
:vehicle => "car",
|
306
|
+
:deep => { :suite => "things" }
|
307
|
+
}
|
271
308
|
}
|
272
|
-
|
273
|
-
|
274
|
-
|
309
|
+
]
|
310
|
+
},
|
311
|
+
{}
|
312
|
+
).public_send("#{key}_data_for", "sweet", "plat").must_equal(
|
275
313
|
default_key => "suitey",
|
276
314
|
:color => "purple",
|
277
315
|
:fruit => ["banana"],
|
@@ -281,28 +319,31 @@ module Kitchen
|
|
281
319
|
:platform => "stuff",
|
282
320
|
:suite => "things"
|
283
321
|
}
|
284
|
-
|
322
|
+
)
|
285
323
|
end
|
286
324
|
|
287
325
|
it "platform into common" do
|
288
|
-
DataMunger.new(
|
289
|
-
|
290
|
-
|
291
|
-
|
292
|
-
|
293
|
-
|
294
|
-
|
295
|
-
|
296
|
-
|
297
|
-
|
298
|
-
|
299
|
-
|
300
|
-
|
301
|
-
|
326
|
+
DataMunger.new(
|
327
|
+
{
|
328
|
+
key => {
|
329
|
+
default_key => "commony",
|
330
|
+
:color => "purple",
|
331
|
+
:fruit => %w[apple pear],
|
332
|
+
:deep => { :common => "junk" }
|
333
|
+
},
|
334
|
+
:platforms => [
|
335
|
+
{
|
336
|
+
:name => "plat",
|
337
|
+
key => {
|
338
|
+
default_key => "platformy",
|
339
|
+
:fruit => ["banana"],
|
340
|
+
:deep => { :platform => "stuff" }
|
341
|
+
}
|
302
342
|
}
|
303
|
-
|
304
|
-
|
305
|
-
|
343
|
+
]
|
344
|
+
},
|
345
|
+
{}
|
346
|
+
).public_send("#{key}_data_for", "sweet", "plat").must_equal(
|
306
347
|
default_key => "platformy",
|
307
348
|
:color => "purple",
|
308
349
|
:fruit => ["banana"],
|
@@ -310,62 +351,68 @@ module Kitchen
|
|
310
351
|
:common => "junk",
|
311
352
|
:platform => "stuff"
|
312
353
|
}
|
313
|
-
|
354
|
+
)
|
314
355
|
end
|
315
356
|
|
316
357
|
it "suite into common" do
|
317
|
-
DataMunger.new(
|
318
|
-
|
319
|
-
|
320
|
-
|
321
|
-
|
322
|
-
|
323
|
-
|
324
|
-
|
325
|
-
|
326
|
-
|
327
|
-
|
328
|
-
|
329
|
-
|
330
|
-
|
358
|
+
DataMunger.new(
|
359
|
+
{
|
360
|
+
key => {
|
361
|
+
default_key => "commony",
|
362
|
+
:color => "purple",
|
363
|
+
:fruit => %w[apple pear],
|
364
|
+
:deep => { :common => "junk" }
|
365
|
+
},
|
366
|
+
:suites => [
|
367
|
+
{
|
368
|
+
:name => "sweet",
|
369
|
+
key => {
|
370
|
+
default_key => "suitey",
|
371
|
+
:vehicle => "car",
|
372
|
+
:deep => { :suite => "things" }
|
373
|
+
}
|
331
374
|
}
|
332
|
-
|
333
|
-
|
334
|
-
|
375
|
+
]
|
376
|
+
},
|
377
|
+
{}
|
378
|
+
).public_send("#{key}_data_for", "sweet", "plat").must_equal(
|
335
379
|
default_key => "suitey",
|
336
380
|
:color => "purple",
|
337
|
-
:fruit => [
|
381
|
+
:fruit => %w[apple pear],
|
338
382
|
:vehicle => "car",
|
339
383
|
:deep => {
|
340
384
|
:common => "junk",
|
341
385
|
:suite => "things"
|
342
386
|
}
|
343
|
-
|
387
|
+
)
|
344
388
|
end
|
345
389
|
|
346
390
|
it "suite into platform" do
|
347
|
-
DataMunger.new(
|
348
|
-
|
349
|
-
|
350
|
-
|
351
|
-
|
352
|
-
|
353
|
-
|
354
|
-
|
391
|
+
DataMunger.new(
|
392
|
+
{
|
393
|
+
:platforms => [
|
394
|
+
{
|
395
|
+
:name => "plat",
|
396
|
+
key => {
|
397
|
+
default_key => "platformy",
|
398
|
+
:fruit => ["banana"],
|
399
|
+
:deep => { :platform => "stuff" }
|
400
|
+
}
|
355
401
|
}
|
356
|
-
|
357
|
-
|
358
|
-
|
359
|
-
|
360
|
-
|
361
|
-
|
362
|
-
|
363
|
-
|
364
|
-
|
402
|
+
],
|
403
|
+
:suites => [
|
404
|
+
{
|
405
|
+
:name => "sweet",
|
406
|
+
key => {
|
407
|
+
default_key => "suitey",
|
408
|
+
:vehicle => "car",
|
409
|
+
:deep => { :suite => "things" }
|
410
|
+
}
|
365
411
|
}
|
366
|
-
|
367
|
-
|
368
|
-
|
412
|
+
]
|
413
|
+
},
|
414
|
+
{}
|
415
|
+
).public_send("#{key}_data_for", "sweet", "plat").must_equal(
|
369
416
|
default_key => "suitey",
|
370
417
|
:fruit => ["banana"],
|
371
418
|
:vehicle => "car",
|
@@ -373,7 +420,7 @@ module Kitchen
|
|
373
420
|
:platform => "stuff",
|
374
421
|
:suite => "things"
|
375
422
|
}
|
376
|
-
|
423
|
+
)
|
377
424
|
end
|
378
425
|
end
|
379
426
|
end
|
@@ -384,243 +431,288 @@ module Kitchen
|
|
384
431
|
describe "in a suite" do
|
385
432
|
|
386
433
|
it "moves attributes into provisioner" do
|
387
|
-
DataMunger.new(
|
388
|
-
|
389
|
-
|
390
|
-
|
391
|
-
|
392
|
-
|
393
|
-
|
394
|
-
|
395
|
-
|
434
|
+
DataMunger.new(
|
435
|
+
{
|
436
|
+
:provisioner => "chefy",
|
437
|
+
:suites => [
|
438
|
+
{
|
439
|
+
:name => "sweet",
|
440
|
+
:attributes => { :one => "two" }
|
441
|
+
}
|
442
|
+
]
|
443
|
+
},
|
444
|
+
{}
|
445
|
+
).provisioner_data_for("sweet", "plat").must_equal(
|
396
446
|
:name => "chefy",
|
397
447
|
:attributes => { :one => "two" }
|
398
|
-
|
448
|
+
)
|
399
449
|
end
|
400
450
|
|
401
451
|
it "moves run_list into provisioner" do
|
402
|
-
DataMunger.new(
|
403
|
-
|
404
|
-
|
405
|
-
|
406
|
-
|
407
|
-
|
408
|
-
|
409
|
-
|
410
|
-
|
452
|
+
DataMunger.new(
|
453
|
+
{
|
454
|
+
:provisioner => "chefy",
|
455
|
+
:suites => [
|
456
|
+
{
|
457
|
+
:name => "sweet",
|
458
|
+
:run_list => %w[one two]
|
459
|
+
}
|
460
|
+
]
|
461
|
+
},
|
462
|
+
{}
|
463
|
+
).provisioner_data_for("sweet", "plat").must_equal(
|
411
464
|
:name => "chefy",
|
412
|
-
:run_list => [
|
413
|
-
|
465
|
+
:run_list => %w[one two]
|
466
|
+
)
|
414
467
|
end
|
415
468
|
|
416
469
|
it "maintains run_list in provisioner" do
|
417
|
-
DataMunger.new(
|
418
|
-
|
419
|
-
|
420
|
-
|
421
|
-
|
422
|
-
|
423
|
-
:
|
470
|
+
DataMunger.new(
|
471
|
+
{
|
472
|
+
:provisioner => "chefy",
|
473
|
+
:suites => [
|
474
|
+
{
|
475
|
+
:name => "sweet",
|
476
|
+
:provisioner => {
|
477
|
+
:run_list => %w[one two]
|
478
|
+
}
|
424
479
|
}
|
425
|
-
|
426
|
-
|
427
|
-
|
480
|
+
]
|
481
|
+
},
|
482
|
+
{}
|
483
|
+
).provisioner_data_for("sweet", "plat").must_equal(
|
428
484
|
:name => "chefy",
|
429
|
-
:run_list => [
|
430
|
-
|
485
|
+
:run_list => %w[one two]
|
486
|
+
)
|
431
487
|
end
|
432
488
|
|
433
489
|
it "merge provisioner into attributes if provisioner exists" do
|
434
|
-
DataMunger.new(
|
435
|
-
|
436
|
-
|
437
|
-
|
438
|
-
|
439
|
-
|
440
|
-
|
441
|
-
|
442
|
-
|
490
|
+
DataMunger.new(
|
491
|
+
{
|
492
|
+
:suites => [
|
493
|
+
{
|
494
|
+
:name => "sweet",
|
495
|
+
:attributes => { :one => "two" },
|
496
|
+
:provisioner => "chefy"
|
497
|
+
}
|
498
|
+
]
|
499
|
+
},
|
500
|
+
{}
|
501
|
+
).provisioner_data_for("sweet", "plat").must_equal(
|
443
502
|
:name => "chefy",
|
444
503
|
:attributes => { :one => "two" }
|
445
|
-
|
504
|
+
)
|
446
505
|
end
|
447
506
|
|
448
507
|
it "merge provisioner into run_list if provisioner exists" do
|
449
|
-
DataMunger.new(
|
450
|
-
|
451
|
-
|
452
|
-
|
453
|
-
|
454
|
-
|
455
|
-
|
456
|
-
|
457
|
-
|
508
|
+
DataMunger.new(
|
509
|
+
{
|
510
|
+
:suites => [
|
511
|
+
{
|
512
|
+
:name => "sweet",
|
513
|
+
:run_list => %w[one two],
|
514
|
+
:provisioner => "chefy"
|
515
|
+
}
|
516
|
+
]
|
517
|
+
},
|
518
|
+
{}
|
519
|
+
).provisioner_data_for("sweet", "plat").must_equal(
|
458
520
|
:name => "chefy",
|
459
|
-
:run_list => [
|
460
|
-
|
521
|
+
:run_list => %w[one two]
|
522
|
+
)
|
461
523
|
end
|
462
524
|
|
463
525
|
it "drops nil run_list" do
|
464
|
-
DataMunger.new(
|
465
|
-
|
466
|
-
|
467
|
-
|
468
|
-
|
469
|
-
|
470
|
-
|
471
|
-
|
472
|
-
|
526
|
+
DataMunger.new(
|
527
|
+
{
|
528
|
+
:suites => [
|
529
|
+
{
|
530
|
+
:name => "sweet",
|
531
|
+
:run_list => nil,
|
532
|
+
:provisioner => "chefy"
|
533
|
+
}
|
534
|
+
]
|
535
|
+
},
|
536
|
+
{}
|
537
|
+
).provisioner_data_for("sweet", "plat").must_equal(
|
473
538
|
:name => "chefy"
|
474
|
-
|
539
|
+
)
|
475
540
|
end
|
476
541
|
|
477
542
|
it "drops nil attributes" do
|
478
|
-
DataMunger.new(
|
479
|
-
|
480
|
-
|
481
|
-
|
482
|
-
|
483
|
-
|
484
|
-
|
485
|
-
|
486
|
-
|
543
|
+
DataMunger.new(
|
544
|
+
{
|
545
|
+
:suites => [
|
546
|
+
{
|
547
|
+
:name => "sweet",
|
548
|
+
:attributes => nil,
|
549
|
+
:provisioner => "chefy"
|
550
|
+
}
|
551
|
+
]
|
552
|
+
},
|
553
|
+
{}
|
554
|
+
).provisioner_data_for("sweet", "plat").must_equal(
|
487
555
|
:name => "chefy"
|
488
|
-
|
556
|
+
)
|
489
557
|
end
|
490
558
|
end
|
491
559
|
|
492
560
|
describe "in a platform" do
|
493
561
|
|
494
562
|
it "moves attributes into provisioner" do
|
495
|
-
DataMunger.new(
|
496
|
-
|
497
|
-
|
498
|
-
|
499
|
-
|
500
|
-
|
501
|
-
|
502
|
-
|
503
|
-
|
563
|
+
DataMunger.new(
|
564
|
+
{
|
565
|
+
:provisioner => "chefy",
|
566
|
+
:platforms => [
|
567
|
+
{
|
568
|
+
:name => "plat",
|
569
|
+
:attributes => { :one => "two" }
|
570
|
+
}
|
571
|
+
]
|
572
|
+
},
|
573
|
+
{}
|
574
|
+
).provisioner_data_for("sweet", "plat").must_equal(
|
504
575
|
:name => "chefy",
|
505
576
|
:attributes => { :one => "two" }
|
506
|
-
|
577
|
+
)
|
507
578
|
end
|
508
579
|
|
509
580
|
it "moves run_list into provisioner" do
|
510
|
-
DataMunger.new(
|
511
|
-
|
512
|
-
|
513
|
-
|
514
|
-
|
515
|
-
|
516
|
-
|
517
|
-
|
518
|
-
|
581
|
+
DataMunger.new(
|
582
|
+
{
|
583
|
+
:provisioner => "chefy",
|
584
|
+
:platforms => [
|
585
|
+
{
|
586
|
+
:name => "plat",
|
587
|
+
:run_list => %w[one two]
|
588
|
+
}
|
589
|
+
]
|
590
|
+
},
|
591
|
+
{}
|
592
|
+
).provisioner_data_for("sweet", "plat").must_equal(
|
519
593
|
:name => "chefy",
|
520
|
-
:run_list => [
|
521
|
-
|
594
|
+
:run_list => %w[one two]
|
595
|
+
)
|
522
596
|
end
|
523
597
|
|
524
598
|
it "maintains run_list in provisioner" do
|
525
|
-
DataMunger.new(
|
526
|
-
|
527
|
-
|
528
|
-
|
529
|
-
|
530
|
-
|
531
|
-
:
|
599
|
+
DataMunger.new(
|
600
|
+
{
|
601
|
+
:provisioner => "chefy",
|
602
|
+
:platforms => [
|
603
|
+
{
|
604
|
+
:name => "plat",
|
605
|
+
:provisioner => {
|
606
|
+
:run_list => %w[one two]
|
607
|
+
}
|
532
608
|
}
|
533
|
-
|
534
|
-
|
535
|
-
|
609
|
+
]
|
610
|
+
},
|
611
|
+
{}
|
612
|
+
).provisioner_data_for("sweet", "plat").must_equal(
|
536
613
|
:name => "chefy",
|
537
|
-
:run_list => [
|
538
|
-
|
614
|
+
:run_list => %w[one two]
|
615
|
+
)
|
539
616
|
end
|
540
617
|
|
541
618
|
it "merge provisioner into attributes if provisioner exists" do
|
542
|
-
DataMunger.new(
|
543
|
-
|
544
|
-
|
545
|
-
|
546
|
-
|
547
|
-
|
548
|
-
|
549
|
-
|
550
|
-
|
619
|
+
DataMunger.new(
|
620
|
+
{
|
621
|
+
:platforms => [
|
622
|
+
{
|
623
|
+
:name => "plat",
|
624
|
+
:attributes => { :one => "two" },
|
625
|
+
:provisioner => "chefy"
|
626
|
+
}
|
627
|
+
]
|
628
|
+
},
|
629
|
+
{}
|
630
|
+
).provisioner_data_for("sweet", "plat").must_equal(
|
551
631
|
:name => "chefy",
|
552
632
|
:attributes => { :one => "two" }
|
553
|
-
|
633
|
+
)
|
554
634
|
end
|
555
635
|
|
556
636
|
it "merge provisioner into run_list if provisioner exists" do
|
557
|
-
DataMunger.new(
|
558
|
-
|
559
|
-
|
560
|
-
|
561
|
-
|
562
|
-
|
563
|
-
|
564
|
-
|
565
|
-
|
637
|
+
DataMunger.new(
|
638
|
+
{
|
639
|
+
:platforms => [
|
640
|
+
{
|
641
|
+
:name => "plat",
|
642
|
+
:run_list => %w[one two],
|
643
|
+
:provisioner => "chefy"
|
644
|
+
}
|
645
|
+
]
|
646
|
+
},
|
647
|
+
{}
|
648
|
+
).provisioner_data_for("sweet", "plat").must_equal(
|
566
649
|
:name => "chefy",
|
567
|
-
:run_list => [
|
568
|
-
|
650
|
+
:run_list => %w[one two]
|
651
|
+
)
|
569
652
|
end
|
570
653
|
|
571
654
|
it "drops nil run_list" do
|
572
|
-
DataMunger.new(
|
573
|
-
|
574
|
-
|
575
|
-
|
576
|
-
|
577
|
-
|
578
|
-
|
579
|
-
|
580
|
-
|
655
|
+
DataMunger.new(
|
656
|
+
{
|
657
|
+
:platforms => [
|
658
|
+
{
|
659
|
+
:name => "plat",
|
660
|
+
:run_list => nil,
|
661
|
+
:provisioner => "chefy"
|
662
|
+
}
|
663
|
+
]
|
664
|
+
},
|
665
|
+
{}
|
666
|
+
).provisioner_data_for("sweet", "plat").must_equal(
|
581
667
|
:name => "chefy"
|
582
|
-
|
668
|
+
)
|
583
669
|
end
|
584
670
|
|
585
671
|
it "drops nil attributes" do
|
586
|
-
DataMunger.new(
|
587
|
-
|
588
|
-
|
589
|
-
|
590
|
-
|
591
|
-
|
592
|
-
|
593
|
-
|
594
|
-
|
672
|
+
DataMunger.new(
|
673
|
+
{
|
674
|
+
:platforms => [
|
675
|
+
{
|
676
|
+
:name => "plat",
|
677
|
+
:attributes => nil,
|
678
|
+
:provisioner => "chefy"
|
679
|
+
}
|
680
|
+
]
|
681
|
+
},
|
682
|
+
{}
|
683
|
+
).provisioner_data_for("sweet", "plat").must_equal(
|
595
684
|
:name => "chefy"
|
596
|
-
|
685
|
+
)
|
597
686
|
end
|
598
687
|
end
|
599
688
|
|
600
689
|
describe "in a suite and platform" do
|
601
690
|
|
602
691
|
it "merges suite attributes into platform attributes" do
|
603
|
-
DataMunger.new(
|
604
|
-
|
605
|
-
|
606
|
-
|
607
|
-
|
608
|
-
|
609
|
-
:
|
610
|
-
|
692
|
+
DataMunger.new(
|
693
|
+
{
|
694
|
+
:provisioner => "chefy",
|
695
|
+
:platforms => [
|
696
|
+
{
|
697
|
+
:name => "plat",
|
698
|
+
:attributes => {
|
699
|
+
:color => "blue",
|
700
|
+
:deep => { :platform => "much" }
|
701
|
+
}
|
611
702
|
}
|
612
|
-
|
613
|
-
|
614
|
-
|
615
|
-
|
616
|
-
|
617
|
-
|
618
|
-
|
619
|
-
|
703
|
+
],
|
704
|
+
:suites => [
|
705
|
+
{
|
706
|
+
:name => "sweet",
|
707
|
+
:attributes => {
|
708
|
+
:color => "pink",
|
709
|
+
:deep => { :suite => "wow" }
|
710
|
+
}
|
620
711
|
}
|
621
|
-
|
622
|
-
|
623
|
-
|
712
|
+
]
|
713
|
+
},
|
714
|
+
{}
|
715
|
+
).provisioner_data_for("sweet", "plat").must_equal(
|
624
716
|
:name => "chefy",
|
625
717
|
:attributes => {
|
626
718
|
:color => "pink",
|
@@ -629,124 +721,139 @@ module Kitchen
|
|
629
721
|
:platform => "much"
|
630
722
|
}
|
631
723
|
}
|
632
|
-
|
724
|
+
)
|
633
725
|
end
|
634
726
|
|
635
727
|
it "concats suite run_list to platform run_list" do
|
636
|
-
DataMunger.new(
|
637
|
-
|
638
|
-
|
639
|
-
|
640
|
-
|
641
|
-
|
642
|
-
|
643
|
-
|
644
|
-
|
645
|
-
|
646
|
-
|
647
|
-
|
648
|
-
|
649
|
-
|
650
|
-
|
728
|
+
DataMunger.new(
|
729
|
+
{
|
730
|
+
:provisioner => "chefy",
|
731
|
+
:platforms => [
|
732
|
+
{
|
733
|
+
:name => "plat",
|
734
|
+
:run_list => %w[one two]
|
735
|
+
}
|
736
|
+
],
|
737
|
+
:suites => [
|
738
|
+
{
|
739
|
+
:name => "sweet",
|
740
|
+
:run_list => %w[three four]
|
741
|
+
}
|
742
|
+
]
|
743
|
+
},
|
744
|
+
{}
|
745
|
+
).provisioner_data_for("sweet", "plat").must_equal(
|
651
746
|
:name => "chefy",
|
652
|
-
:run_list => [
|
653
|
-
|
747
|
+
:run_list => %w[one two three four]
|
748
|
+
)
|
654
749
|
end
|
655
750
|
|
656
751
|
it "concats suite run_list in provisioner to platform run_list" do
|
657
|
-
DataMunger.new(
|
658
|
-
|
659
|
-
|
660
|
-
|
661
|
-
|
662
|
-
|
663
|
-
|
664
|
-
],
|
665
|
-
:suites => [
|
666
|
-
{
|
667
|
-
:name => "sweet",
|
668
|
-
:provisioner => {
|
669
|
-
:run_list => ["three", "four"]
|
752
|
+
DataMunger.new(
|
753
|
+
{
|
754
|
+
:provisioner => "chefy",
|
755
|
+
:platforms => [
|
756
|
+
{
|
757
|
+
:name => "plat",
|
758
|
+
:run_list => %w[one two]
|
670
759
|
}
|
671
|
-
|
672
|
-
|
673
|
-
|
760
|
+
],
|
761
|
+
:suites => [
|
762
|
+
{
|
763
|
+
:name => "sweet",
|
764
|
+
:provisioner => {
|
765
|
+
:run_list => %w[three four]
|
766
|
+
}
|
767
|
+
}
|
768
|
+
]
|
769
|
+
},
|
770
|
+
{}
|
771
|
+
).provisioner_data_for("sweet", "plat").must_equal(
|
674
772
|
:name => "chefy",
|
675
|
-
:run_list => [
|
676
|
-
|
773
|
+
:run_list => %w[one two three four]
|
774
|
+
)
|
677
775
|
end
|
678
776
|
|
679
777
|
it "concats suite run_list to platform run_list in provisioner" do
|
680
|
-
DataMunger.new(
|
681
|
-
|
682
|
-
|
683
|
-
|
684
|
-
|
685
|
-
|
686
|
-
:
|
778
|
+
DataMunger.new(
|
779
|
+
{
|
780
|
+
:provisioner => "chefy",
|
781
|
+
:platforms => [
|
782
|
+
{
|
783
|
+
:name => "plat",
|
784
|
+
:provisioner => {
|
785
|
+
:run_list => %w[one two]
|
786
|
+
}
|
687
787
|
}
|
688
|
-
|
689
|
-
|
690
|
-
|
691
|
-
|
692
|
-
|
693
|
-
|
694
|
-
|
695
|
-
|
696
|
-
|
788
|
+
],
|
789
|
+
:suites => [
|
790
|
+
{
|
791
|
+
:name => "sweet",
|
792
|
+
:run_list => %w[three four]
|
793
|
+
}
|
794
|
+
]
|
795
|
+
},
|
796
|
+
{}
|
797
|
+
).provisioner_data_for("sweet", "plat").must_equal(
|
697
798
|
:name => "chefy",
|
698
|
-
:run_list => [
|
699
|
-
|
799
|
+
:run_list => %w[one two three four]
|
800
|
+
)
|
700
801
|
end
|
701
802
|
|
702
803
|
it "concats to nil run_lists into an empty Array" do
|
703
|
-
DataMunger.new(
|
704
|
-
|
705
|
-
|
706
|
-
|
707
|
-
|
708
|
-
|
804
|
+
DataMunger.new(
|
805
|
+
{
|
806
|
+
:provisioner => "chefy",
|
807
|
+
:platforms => [
|
808
|
+
{
|
809
|
+
:name => "plat",
|
810
|
+
:provisioner => {
|
811
|
+
:run_list => nil
|
812
|
+
}
|
813
|
+
}
|
814
|
+
],
|
815
|
+
:suites => [
|
816
|
+
{
|
817
|
+
:name => "sweet",
|
709
818
|
:run_list => nil
|
710
819
|
}
|
711
|
-
|
712
|
-
|
713
|
-
|
714
|
-
|
715
|
-
:name => "sweet",
|
716
|
-
:run_list => nil
|
717
|
-
}
|
718
|
-
]
|
719
|
-
}).provisioner_data_for("sweet", "plat").must_equal({
|
820
|
+
]
|
821
|
+
},
|
822
|
+
{}
|
823
|
+
).provisioner_data_for("sweet", "plat").must_equal(
|
720
824
|
:name => "chefy",
|
721
825
|
:run_list => []
|
722
|
-
|
826
|
+
)
|
723
827
|
end
|
724
828
|
|
725
829
|
it "does not corrupt run_list data for multiple suite/platform pairs" do
|
726
|
-
munger = DataMunger.new(
|
727
|
-
|
728
|
-
|
729
|
-
|
730
|
-
|
731
|
-
|
732
|
-
|
733
|
-
|
734
|
-
|
735
|
-
|
736
|
-
],
|
737
|
-
:suites => [
|
738
|
-
{
|
739
|
-
:name => "s1",
|
740
|
-
:run_list => ["alpha", "beta"]
|
741
|
-
},
|
742
|
-
{
|
743
|
-
:name => "s2",
|
744
|
-
:provisioner => {
|
745
|
-
:run_list => ["three", "four"]
|
830
|
+
munger = DataMunger.new(
|
831
|
+
{
|
832
|
+
:provisioner => "chefy",
|
833
|
+
:platforms => [
|
834
|
+
{
|
835
|
+
:name => "p1"
|
836
|
+
},
|
837
|
+
{
|
838
|
+
:name => "p2",
|
839
|
+
:run_list => %w[one two]
|
746
840
|
}
|
747
|
-
|
748
|
-
|
749
|
-
|
841
|
+
],
|
842
|
+
:suites => [
|
843
|
+
{
|
844
|
+
:name => "s1",
|
845
|
+
:run_list => %w[alpha beta]
|
846
|
+
},
|
847
|
+
{
|
848
|
+
:name => "s2",
|
849
|
+
:provisioner => {
|
850
|
+
:run_list => %w[three four]
|
851
|
+
}
|
852
|
+
}
|
853
|
+
]
|
854
|
+
},
|
855
|
+
{}
|
856
|
+
)
|
750
857
|
|
751
858
|
# call munger for other data to cause any necessary internal
|
752
859
|
# data mutation
|
@@ -754,10 +861,10 @@ module Kitchen
|
|
754
861
|
munger.provisioner_data_for("s1", "p2")
|
755
862
|
munger.provisioner_data_for("s2", "p1")
|
756
863
|
|
757
|
-
munger.provisioner_data_for("s2", "p2").must_equal(
|
864
|
+
munger.provisioner_data_for("s2", "p2").must_equal(
|
758
865
|
:name => "chefy",
|
759
|
-
:run_list => [
|
760
|
-
|
866
|
+
:run_list => %w[one two three four]
|
867
|
+
)
|
761
868
|
end
|
762
869
|
end
|
763
870
|
end
|
@@ -771,225 +878,261 @@ module Kitchen
|
|
771
878
|
describe "for #driver_data_for" do
|
772
879
|
|
773
880
|
it "is returned when provided" do
|
774
|
-
DataMunger.new(
|
775
|
-
|
776
|
-
|
777
|
-
|
778
|
-
|
779
|
-
|
780
|
-
|
781
|
-
|
782
|
-
|
783
|
-
|
784
|
-
|
881
|
+
DataMunger.new(
|
882
|
+
{
|
883
|
+
:driver => "chefy",
|
884
|
+
:platforms => [
|
885
|
+
{ :name => "plat" }
|
886
|
+
],
|
887
|
+
:suites => [
|
888
|
+
{ :name => "sweet" }
|
889
|
+
]
|
890
|
+
},
|
891
|
+
{
|
892
|
+
key => "datvalue"
|
893
|
+
}
|
894
|
+
).driver_data_for("sweet", "plat").must_equal(
|
785
895
|
:name => "chefy",
|
786
896
|
key => "datvalue"
|
787
|
-
|
897
|
+
)
|
788
898
|
end
|
789
899
|
|
790
900
|
it "is returned when provided in user data" do
|
791
|
-
DataMunger.new(
|
792
|
-
|
793
|
-
|
901
|
+
DataMunger.new(
|
902
|
+
{
|
903
|
+
:kitchen => {
|
904
|
+
key => "datvalue"
|
905
|
+
},
|
906
|
+
:driver => "chefy",
|
907
|
+
:platforms => [
|
908
|
+
{ :name => "plat" }
|
909
|
+
],
|
910
|
+
:suites => [
|
911
|
+
{ :name => "sweet" }
|
912
|
+
]
|
794
913
|
},
|
795
|
-
|
796
|
-
|
797
|
-
{ :name => "plat" }
|
798
|
-
],
|
799
|
-
:suites => [
|
800
|
-
{ :name => "sweet" }
|
801
|
-
]
|
802
|
-
}).driver_data_for("sweet", "plat").must_equal({
|
914
|
+
{}
|
915
|
+
).driver_data_for("sweet", "plat").must_equal(
|
803
916
|
:name => "chefy",
|
804
917
|
key => "datvalue"
|
805
|
-
|
918
|
+
)
|
806
919
|
end
|
807
920
|
|
808
921
|
it "user data value beats provided value" do
|
809
|
-
DataMunger.new(
|
810
|
-
|
811
|
-
|
922
|
+
DataMunger.new(
|
923
|
+
{
|
924
|
+
:kitchen => {
|
925
|
+
key => "datvalue"
|
926
|
+
},
|
927
|
+
:driver => "chefy",
|
928
|
+
:platforms => [
|
929
|
+
{ :name => "plat" }
|
930
|
+
],
|
931
|
+
:suites => [
|
932
|
+
{ :name => "sweet" }
|
933
|
+
]
|
812
934
|
},
|
813
|
-
|
814
|
-
|
815
|
-
|
816
|
-
|
817
|
-
:suites => [
|
818
|
-
{ :name => "sweet" }
|
819
|
-
]
|
820
|
-
}, {
|
821
|
-
key => "ilose"
|
822
|
-
}).driver_data_for("sweet", "plat").must_equal({
|
935
|
+
{
|
936
|
+
key => "ilose"
|
937
|
+
}
|
938
|
+
).driver_data_for("sweet", "plat").must_equal(
|
823
939
|
:name => "chefy",
|
824
940
|
key => "datvalue"
|
825
|
-
|
941
|
+
)
|
826
942
|
end
|
827
943
|
|
828
944
|
it "rejects any value in driver data" do
|
829
|
-
DataMunger.new(
|
830
|
-
|
831
|
-
:
|
832
|
-
|
945
|
+
DataMunger.new(
|
946
|
+
{
|
947
|
+
:driver => {
|
948
|
+
:name => "chefy",
|
949
|
+
key => "imevil"
|
950
|
+
},
|
951
|
+
:platforms => [
|
952
|
+
{ :name => "plat" }
|
953
|
+
],
|
954
|
+
:suites => [
|
955
|
+
{ :name => "sweet" }
|
956
|
+
]
|
833
957
|
},
|
834
|
-
|
835
|
-
|
836
|
-
],
|
837
|
-
:suites => [
|
838
|
-
{ :name => "sweet" }
|
839
|
-
]
|
840
|
-
}).driver_data_for("sweet", "plat").must_equal({
|
958
|
+
{}
|
959
|
+
).driver_data_for("sweet", "plat").must_equal(
|
841
960
|
:name => "chefy"
|
842
|
-
|
961
|
+
)
|
843
962
|
end
|
844
963
|
end
|
845
964
|
|
846
965
|
describe "for #provisioner_data_for" do
|
847
966
|
|
848
967
|
it "is returned when provided" do
|
849
|
-
DataMunger.new(
|
850
|
-
|
851
|
-
|
852
|
-
|
853
|
-
|
854
|
-
|
855
|
-
|
856
|
-
|
857
|
-
|
858
|
-
|
859
|
-
|
968
|
+
DataMunger.new(
|
969
|
+
{
|
970
|
+
:provisioner => "chefy",
|
971
|
+
:platforms => [
|
972
|
+
{ :name => "plat" }
|
973
|
+
],
|
974
|
+
:suites => [
|
975
|
+
{ :name => "sweet" }
|
976
|
+
]
|
977
|
+
},
|
978
|
+
{
|
979
|
+
key => "datvalue"
|
980
|
+
}
|
981
|
+
).provisioner_data_for("sweet", "plat").must_equal(
|
860
982
|
:name => "chefy",
|
861
983
|
key => "datvalue"
|
862
|
-
|
984
|
+
)
|
863
985
|
end
|
864
986
|
|
865
987
|
it "is returned when provided in user data" do
|
866
|
-
DataMunger.new(
|
867
|
-
|
868
|
-
|
988
|
+
DataMunger.new(
|
989
|
+
{
|
990
|
+
:kitchen => {
|
991
|
+
key => "datvalue"
|
992
|
+
},
|
993
|
+
:provisioner => "chefy",
|
994
|
+
:platforms => [
|
995
|
+
{ :name => "plat" }
|
996
|
+
],
|
997
|
+
:suites => [
|
998
|
+
{ :name => "sweet" }
|
999
|
+
]
|
869
1000
|
},
|
870
|
-
|
871
|
-
|
872
|
-
{ :name => "plat" }
|
873
|
-
],
|
874
|
-
:suites => [
|
875
|
-
{ :name => "sweet" }
|
876
|
-
]
|
877
|
-
}).provisioner_data_for("sweet", "plat").must_equal({
|
1001
|
+
{}
|
1002
|
+
).provisioner_data_for("sweet", "plat").must_equal(
|
878
1003
|
:name => "chefy",
|
879
1004
|
key => "datvalue"
|
880
|
-
|
1005
|
+
)
|
881
1006
|
end
|
882
1007
|
|
883
1008
|
it "user data value beats provided value" do
|
884
|
-
DataMunger.new(
|
885
|
-
|
886
|
-
|
1009
|
+
DataMunger.new(
|
1010
|
+
{
|
1011
|
+
:kitchen => {
|
1012
|
+
key => "datvalue"
|
1013
|
+
},
|
1014
|
+
:provisioner => "chefy",
|
1015
|
+
:platforms => [
|
1016
|
+
{ :name => "plat" }
|
1017
|
+
],
|
1018
|
+
:suites => [
|
1019
|
+
{ :name => "sweet" }
|
1020
|
+
]
|
887
1021
|
},
|
888
|
-
|
889
|
-
|
890
|
-
|
891
|
-
|
892
|
-
:suites => [
|
893
|
-
{ :name => "sweet" }
|
894
|
-
]
|
895
|
-
}, {
|
896
|
-
key => "ilose"
|
897
|
-
}).provisioner_data_for("sweet", "plat").must_equal({
|
1022
|
+
{
|
1023
|
+
key => "ilose"
|
1024
|
+
}
|
1025
|
+
).provisioner_data_for("sweet", "plat").must_equal(
|
898
1026
|
:name => "chefy",
|
899
1027
|
key => "datvalue"
|
900
|
-
|
1028
|
+
)
|
901
1029
|
end
|
902
1030
|
|
903
1031
|
it "rejects any value in provisioner data" do
|
904
|
-
DataMunger.new(
|
905
|
-
|
906
|
-
:
|
907
|
-
|
1032
|
+
DataMunger.new(
|
1033
|
+
{
|
1034
|
+
:provisioner => {
|
1035
|
+
:name => "chefy",
|
1036
|
+
key => "imevil"
|
1037
|
+
},
|
1038
|
+
:platforms => [
|
1039
|
+
{ :name => "plat" }
|
1040
|
+
],
|
1041
|
+
:suites => [
|
1042
|
+
{ :name => "sweet" }
|
1043
|
+
]
|
908
1044
|
},
|
909
|
-
|
910
|
-
|
911
|
-
],
|
912
|
-
:suites => [
|
913
|
-
{ :name => "sweet" }
|
914
|
-
]
|
915
|
-
}).provisioner_data_for("sweet", "plat").must_equal({
|
1045
|
+
{}
|
1046
|
+
).provisioner_data_for("sweet", "plat").must_equal(
|
916
1047
|
:name => "chefy"
|
917
|
-
|
1048
|
+
)
|
918
1049
|
end
|
919
1050
|
end
|
920
1051
|
|
921
1052
|
describe "for #busser_data_for" do
|
922
1053
|
|
923
1054
|
it "is returned when provided" do
|
924
|
-
DataMunger.new(
|
925
|
-
|
926
|
-
|
927
|
-
|
928
|
-
|
929
|
-
|
930
|
-
|
931
|
-
|
932
|
-
|
933
|
-
|
934
|
-
|
1055
|
+
DataMunger.new(
|
1056
|
+
{
|
1057
|
+
:busser => "chefy",
|
1058
|
+
:platforms => [
|
1059
|
+
{ :name => "plat" }
|
1060
|
+
],
|
1061
|
+
:suites => [
|
1062
|
+
{ :name => "sweet" }
|
1063
|
+
]
|
1064
|
+
},
|
1065
|
+
{
|
1066
|
+
key => "datvalue"
|
1067
|
+
}
|
1068
|
+
).busser_data_for("sweet", "plat").must_equal(
|
935
1069
|
:version => "chefy",
|
936
1070
|
key => "datvalue"
|
937
|
-
|
1071
|
+
)
|
938
1072
|
end
|
939
1073
|
|
940
1074
|
it "is returned when provided in user data" do
|
941
|
-
DataMunger.new(
|
942
|
-
|
943
|
-
|
1075
|
+
DataMunger.new(
|
1076
|
+
{
|
1077
|
+
:kitchen => {
|
1078
|
+
key => "datvalue"
|
1079
|
+
},
|
1080
|
+
:busser => "chefy",
|
1081
|
+
:platforms => [
|
1082
|
+
{ :name => "plat" }
|
1083
|
+
],
|
1084
|
+
:suites => [
|
1085
|
+
{ :name => "sweet" }
|
1086
|
+
]
|
944
1087
|
},
|
945
|
-
|
946
|
-
|
947
|
-
{ :name => "plat" }
|
948
|
-
],
|
949
|
-
:suites => [
|
950
|
-
{ :name => "sweet" }
|
951
|
-
]
|
952
|
-
}).busser_data_for("sweet", "plat").must_equal({
|
1088
|
+
{}
|
1089
|
+
).busser_data_for("sweet", "plat").must_equal(
|
953
1090
|
:version => "chefy",
|
954
1091
|
key => "datvalue"
|
955
|
-
|
1092
|
+
)
|
956
1093
|
end
|
957
1094
|
|
958
1095
|
it "user data value beats provided value" do
|
959
|
-
DataMunger.new(
|
960
|
-
|
961
|
-
|
1096
|
+
DataMunger.new(
|
1097
|
+
{
|
1098
|
+
:kitchen => {
|
1099
|
+
key => "datvalue"
|
1100
|
+
},
|
1101
|
+
:busser => "chefy",
|
1102
|
+
:platforms => [
|
1103
|
+
{ :name => "plat" }
|
1104
|
+
],
|
1105
|
+
:suites => [
|
1106
|
+
{ :name => "sweet" }
|
1107
|
+
]
|
962
1108
|
},
|
963
|
-
|
964
|
-
|
965
|
-
|
966
|
-
|
967
|
-
:suites => [
|
968
|
-
{ :name => "sweet" }
|
969
|
-
]
|
970
|
-
}, {
|
971
|
-
key => "ilose"
|
972
|
-
}).busser_data_for("sweet", "plat").must_equal({
|
1109
|
+
{
|
1110
|
+
key => "ilose"
|
1111
|
+
}
|
1112
|
+
).busser_data_for("sweet", "plat").must_equal(
|
973
1113
|
:version => "chefy",
|
974
1114
|
key => "datvalue"
|
975
|
-
|
1115
|
+
)
|
976
1116
|
end
|
977
1117
|
|
978
1118
|
it "rejects any value in busser data" do
|
979
|
-
DataMunger.new(
|
980
|
-
|
981
|
-
:
|
982
|
-
|
1119
|
+
DataMunger.new(
|
1120
|
+
{
|
1121
|
+
:busser => {
|
1122
|
+
:version => "chefy",
|
1123
|
+
key => "imevil"
|
1124
|
+
},
|
1125
|
+
:platforms => [
|
1126
|
+
{ :name => "plat" }
|
1127
|
+
],
|
1128
|
+
:suites => [
|
1129
|
+
{ :name => "sweet" }
|
1130
|
+
]
|
983
1131
|
},
|
984
|
-
|
985
|
-
|
986
|
-
],
|
987
|
-
:suites => [
|
988
|
-
{ :name => "sweet" }
|
989
|
-
]
|
990
|
-
}).busser_data_for("sweet", "plat").must_equal({
|
1132
|
+
{}
|
1133
|
+
).busser_data_for("sweet", "plat").must_equal(
|
991
1134
|
:version => "chefy"
|
992
|
-
|
1135
|
+
)
|
993
1136
|
end
|
994
1137
|
end
|
995
1138
|
end
|
@@ -1001,156 +1144,186 @@ module Kitchen
|
|
1001
1144
|
describe "from a single source" do
|
1002
1145
|
|
1003
1146
|
it "returns common driver name" do
|
1004
|
-
DataMunger.new(
|
1005
|
-
|
1006
|
-
|
1147
|
+
DataMunger.new(
|
1148
|
+
{
|
1149
|
+
:driver_plugin => "starship"
|
1150
|
+
},
|
1151
|
+
{}
|
1152
|
+
).driver_data_for("suite", "platform").must_equal(
|
1007
1153
|
:name => "starship"
|
1008
|
-
|
1154
|
+
)
|
1009
1155
|
end
|
1010
1156
|
|
1011
1157
|
it "merges driver into driver_plugin if driver exists" do
|
1012
|
-
DataMunger.new(
|
1013
|
-
|
1014
|
-
|
1015
|
-
|
1158
|
+
DataMunger.new(
|
1159
|
+
{
|
1160
|
+
:driver_plugin => "starship",
|
1161
|
+
:driver => "zappa"
|
1162
|
+
},
|
1163
|
+
{}
|
1164
|
+
).driver_data_for("suite", "platform").must_equal(
|
1016
1165
|
:name => "zappa"
|
1017
|
-
|
1166
|
+
)
|
1018
1167
|
end
|
1019
1168
|
|
1020
1169
|
it "returns common driver config" do
|
1021
|
-
DataMunger.new(
|
1022
|
-
|
1023
|
-
|
1024
|
-
:
|
1025
|
-
|
1026
|
-
|
1170
|
+
DataMunger.new(
|
1171
|
+
{
|
1172
|
+
:driver_plugin => "starship",
|
1173
|
+
:driver_config => {
|
1174
|
+
:speed => 42
|
1175
|
+
}
|
1176
|
+
},
|
1177
|
+
{}
|
1178
|
+
).driver_data_for("suite", "platform").must_equal(
|
1027
1179
|
:name => "starship",
|
1028
1180
|
:speed => 42
|
1029
|
-
|
1181
|
+
)
|
1030
1182
|
end
|
1031
1183
|
|
1032
1184
|
it "merges driver into driver_config if driver with name exists" do
|
1033
|
-
DataMunger.new(
|
1034
|
-
|
1035
|
-
:
|
1185
|
+
DataMunger.new(
|
1186
|
+
{
|
1187
|
+
:driver_config => {
|
1188
|
+
:eh => "yep"
|
1189
|
+
},
|
1190
|
+
:driver => "zappa"
|
1036
1191
|
},
|
1037
|
-
|
1038
|
-
|
1192
|
+
{}
|
1193
|
+
).driver_data_for("suite", "platform").must_equal(
|
1039
1194
|
:name => "zappa",
|
1040
1195
|
:eh => "yep"
|
1041
|
-
|
1196
|
+
)
|
1042
1197
|
end
|
1043
1198
|
|
1044
1199
|
it "merges driver into driver_config if driver exists" do
|
1045
|
-
DataMunger.new(
|
1046
|
-
|
1047
|
-
|
1048
|
-
:
|
1049
|
-
|
1200
|
+
DataMunger.new(
|
1201
|
+
{
|
1202
|
+
:driver_plugin => "imold",
|
1203
|
+
:driver_config => {
|
1204
|
+
:eh => "yep",
|
1205
|
+
:color => "pink"
|
1206
|
+
},
|
1207
|
+
:driver => {
|
1208
|
+
:name => "zappa",
|
1209
|
+
:color => "black"
|
1210
|
+
}
|
1050
1211
|
},
|
1051
|
-
|
1052
|
-
|
1053
|
-
:color => "black"
|
1054
|
-
}
|
1055
|
-
}).driver_data_for("suite", "platform").must_equal({
|
1212
|
+
{}
|
1213
|
+
).driver_data_for("suite", "platform").must_equal(
|
1056
1214
|
:name => "zappa",
|
1057
1215
|
:eh => "yep",
|
1058
1216
|
:color => "black"
|
1059
|
-
|
1217
|
+
)
|
1060
1218
|
end
|
1061
1219
|
|
1062
1220
|
it "returns platform driver name" do
|
1063
|
-
DataMunger.new(
|
1064
|
-
|
1065
|
-
|
1066
|
-
|
1067
|
-
|
1068
|
-
|
1069
|
-
|
1070
|
-
|
1221
|
+
DataMunger.new(
|
1222
|
+
{
|
1223
|
+
:platforms => [
|
1224
|
+
{
|
1225
|
+
:name => "plat",
|
1226
|
+
:driver_plugin => "flip"
|
1227
|
+
}
|
1228
|
+
]
|
1229
|
+
},
|
1230
|
+
{}
|
1231
|
+
).driver_data_for("suite", "plat").must_equal(
|
1071
1232
|
:name => "flip"
|
1072
|
-
|
1233
|
+
)
|
1073
1234
|
end
|
1074
1235
|
|
1075
1236
|
it "returns platform config containing driver hash" do
|
1076
|
-
DataMunger.new(
|
1077
|
-
|
1078
|
-
|
1079
|
-
|
1080
|
-
|
1081
|
-
|
1082
|
-
:
|
1237
|
+
DataMunger.new(
|
1238
|
+
{
|
1239
|
+
:platforms => [
|
1240
|
+
{
|
1241
|
+
:name => "plat",
|
1242
|
+
:driver_plugin => "flip",
|
1243
|
+
:driver_config => {
|
1244
|
+
:flop => "yep"
|
1245
|
+
}
|
1083
1246
|
}
|
1084
|
-
|
1085
|
-
|
1086
|
-
|
1247
|
+
]
|
1248
|
+
},
|
1249
|
+
{}
|
1250
|
+
).driver_data_for("suite", "plat").must_equal(
|
1087
1251
|
:name => "flip",
|
1088
1252
|
:flop => "yep"
|
1089
|
-
|
1253
|
+
)
|
1090
1254
|
end
|
1091
1255
|
|
1092
1256
|
it "returns suite driver name" do
|
1093
|
-
DataMunger.new(
|
1094
|
-
|
1095
|
-
|
1096
|
-
|
1097
|
-
|
1098
|
-
|
1099
|
-
|
1100
|
-
|
1257
|
+
DataMunger.new(
|
1258
|
+
{
|
1259
|
+
:suites => [
|
1260
|
+
{
|
1261
|
+
:name => "sweet",
|
1262
|
+
:driver_plugin => "waz"
|
1263
|
+
}
|
1264
|
+
]
|
1265
|
+
},
|
1266
|
+
{}
|
1267
|
+
).driver_data_for("sweet", "platform").must_equal(
|
1101
1268
|
:name => "waz"
|
1102
|
-
|
1269
|
+
)
|
1103
1270
|
end
|
1104
1271
|
|
1105
1272
|
it "returns suite config containing driver hash" do
|
1106
|
-
DataMunger.new(
|
1107
|
-
|
1108
|
-
|
1109
|
-
|
1110
|
-
|
1111
|
-
|
1112
|
-
:
|
1273
|
+
DataMunger.new(
|
1274
|
+
{
|
1275
|
+
:suites => [
|
1276
|
+
{
|
1277
|
+
:name => "sweet",
|
1278
|
+
:driver_plugin => "waz",
|
1279
|
+
:driver_config => {
|
1280
|
+
:up => "nope"
|
1281
|
+
}
|
1113
1282
|
}
|
1114
|
-
|
1115
|
-
|
1116
|
-
|
1283
|
+
]
|
1284
|
+
},
|
1285
|
+
{}
|
1286
|
+
).driver_data_for("sweet", "platform").must_equal(
|
1117
1287
|
:name => "waz",
|
1118
1288
|
:up => "nope"
|
1119
|
-
|
1289
|
+
)
|
1120
1290
|
end
|
1121
1291
|
end
|
1122
1292
|
|
1123
1293
|
describe "from multiple sources" do
|
1124
1294
|
|
1125
1295
|
it "suite into platform into common" do
|
1126
|
-
DataMunger.new(
|
1127
|
-
|
1128
|
-
|
1129
|
-
:
|
1130
|
-
|
1131
|
-
|
1132
|
-
|
1133
|
-
|
1134
|
-
|
1135
|
-
|
1136
|
-
|
1137
|
-
|
1138
|
-
:
|
1139
|
-
|
1296
|
+
DataMunger.new(
|
1297
|
+
{
|
1298
|
+
:driver_plugin => "commony",
|
1299
|
+
:driver_config => {
|
1300
|
+
:color => "purple",
|
1301
|
+
:fruit => %w[apple pear],
|
1302
|
+
:deep => { :common => "junk" }
|
1303
|
+
},
|
1304
|
+
:platforms => [
|
1305
|
+
{
|
1306
|
+
:name => "plat",
|
1307
|
+
:driver_plugin => "platformy",
|
1308
|
+
:driver_config => {
|
1309
|
+
:fruit => ["banana"],
|
1310
|
+
:deep => { :platform => "stuff" }
|
1311
|
+
}
|
1140
1312
|
}
|
1141
|
-
|
1142
|
-
|
1143
|
-
|
1144
|
-
|
1145
|
-
|
1146
|
-
|
1147
|
-
|
1148
|
-
|
1149
|
-
|
1313
|
+
],
|
1314
|
+
:suites => [
|
1315
|
+
{
|
1316
|
+
:name => "sweet",
|
1317
|
+
:driver_plugin => "suitey",
|
1318
|
+
:driver_config => {
|
1319
|
+
:vehicle => "car",
|
1320
|
+
:deep => { :suite => "things" }
|
1321
|
+
}
|
1150
1322
|
}
|
1151
|
-
|
1152
|
-
|
1153
|
-
|
1323
|
+
]
|
1324
|
+
},
|
1325
|
+
{}
|
1326
|
+
).driver_data_for("sweet", "plat").must_equal(
|
1154
1327
|
:name => "suitey",
|
1155
1328
|
:color => "purple",
|
1156
1329
|
:fruit => ["banana"],
|
@@ -1160,28 +1333,31 @@ module Kitchen
|
|
1160
1333
|
:platform => "stuff",
|
1161
1334
|
:suite => "things"
|
1162
1335
|
}
|
1163
|
-
|
1336
|
+
)
|
1164
1337
|
end
|
1165
1338
|
|
1166
1339
|
it "platform into common" do
|
1167
|
-
DataMunger.new(
|
1168
|
-
|
1169
|
-
|
1170
|
-
:
|
1171
|
-
|
1172
|
-
|
1173
|
-
|
1174
|
-
|
1175
|
-
|
1176
|
-
|
1177
|
-
|
1178
|
-
|
1179
|
-
:
|
1180
|
-
|
1340
|
+
DataMunger.new(
|
1341
|
+
{
|
1342
|
+
:driver_plugin => "commony",
|
1343
|
+
:driver_config => {
|
1344
|
+
:color => "purple",
|
1345
|
+
:fruit => %w[apple pear],
|
1346
|
+
:deep => { :common => "junk" }
|
1347
|
+
},
|
1348
|
+
:platforms => [
|
1349
|
+
{
|
1350
|
+
:name => "plat",
|
1351
|
+
:driver_plugin => "platformy",
|
1352
|
+
:driver_config => {
|
1353
|
+
:fruit => ["banana"],
|
1354
|
+
:deep => { :platform => "stuff" }
|
1355
|
+
}
|
1181
1356
|
}
|
1182
|
-
|
1183
|
-
|
1184
|
-
|
1357
|
+
]
|
1358
|
+
},
|
1359
|
+
{}
|
1360
|
+
).driver_data_for("sweet", "plat").must_equal(
|
1185
1361
|
:name => "platformy",
|
1186
1362
|
:color => "purple",
|
1187
1363
|
:fruit => ["banana"],
|
@@ -1189,62 +1365,68 @@ module Kitchen
|
|
1189
1365
|
:common => "junk",
|
1190
1366
|
:platform => "stuff"
|
1191
1367
|
}
|
1192
|
-
|
1368
|
+
)
|
1193
1369
|
end
|
1194
1370
|
|
1195
1371
|
it "suite into common" do
|
1196
|
-
DataMunger.new(
|
1197
|
-
|
1198
|
-
|
1199
|
-
:
|
1200
|
-
|
1201
|
-
|
1202
|
-
|
1203
|
-
|
1204
|
-
|
1205
|
-
|
1206
|
-
|
1207
|
-
|
1208
|
-
:
|
1209
|
-
|
1372
|
+
DataMunger.new(
|
1373
|
+
{
|
1374
|
+
:driver_plugin => "commony",
|
1375
|
+
:driver_config => {
|
1376
|
+
:color => "purple",
|
1377
|
+
:fruit => %w[apple pear],
|
1378
|
+
:deep => { :common => "junk" }
|
1379
|
+
},
|
1380
|
+
:suites => [
|
1381
|
+
{
|
1382
|
+
:name => "sweet",
|
1383
|
+
:driver_plugin => "suitey",
|
1384
|
+
:driver_config => {
|
1385
|
+
:vehicle => "car",
|
1386
|
+
:deep => { :suite => "things" }
|
1387
|
+
}
|
1210
1388
|
}
|
1211
|
-
|
1212
|
-
|
1213
|
-
|
1389
|
+
]
|
1390
|
+
},
|
1391
|
+
{}
|
1392
|
+
).driver_data_for("sweet", "plat").must_equal(
|
1214
1393
|
:name => "suitey",
|
1215
1394
|
:color => "purple",
|
1216
|
-
:fruit => [
|
1395
|
+
:fruit => %w[apple pear],
|
1217
1396
|
:vehicle => "car",
|
1218
1397
|
:deep => {
|
1219
1398
|
:common => "junk",
|
1220
1399
|
:suite => "things"
|
1221
1400
|
}
|
1222
|
-
|
1401
|
+
)
|
1223
1402
|
end
|
1224
1403
|
|
1225
1404
|
it "suite into platform" do
|
1226
|
-
DataMunger.new(
|
1227
|
-
|
1228
|
-
|
1229
|
-
|
1230
|
-
|
1231
|
-
|
1232
|
-
:
|
1233
|
-
|
1405
|
+
DataMunger.new(
|
1406
|
+
{
|
1407
|
+
:platforms => [
|
1408
|
+
{
|
1409
|
+
:name => "plat",
|
1410
|
+
:driver_plugin => "platformy",
|
1411
|
+
:driver_config => {
|
1412
|
+
:fruit => ["banana"],
|
1413
|
+
:deep => { :platform => "stuff" }
|
1414
|
+
}
|
1234
1415
|
}
|
1235
|
-
|
1236
|
-
|
1237
|
-
|
1238
|
-
|
1239
|
-
|
1240
|
-
|
1241
|
-
|
1242
|
-
|
1243
|
-
|
1416
|
+
],
|
1417
|
+
:suites => [
|
1418
|
+
{
|
1419
|
+
:name => "sweet",
|
1420
|
+
:driver_plugin => "suitey",
|
1421
|
+
:driver_config => {
|
1422
|
+
:vehicle => "car",
|
1423
|
+
:deep => { :suite => "things" }
|
1424
|
+
}
|
1244
1425
|
}
|
1245
|
-
|
1246
|
-
|
1247
|
-
|
1426
|
+
]
|
1427
|
+
},
|
1428
|
+
{}
|
1429
|
+
).driver_data_for("sweet", "plat").must_equal(
|
1248
1430
|
:name => "suitey",
|
1249
1431
|
:fruit => ["banana"],
|
1250
1432
|
:vehicle => "car",
|
@@ -1252,46 +1434,54 @@ module Kitchen
|
|
1252
1434
|
:platform => "stuff",
|
1253
1435
|
:suite => "things"
|
1254
1436
|
}
|
1255
|
-
|
1437
|
+
)
|
1256
1438
|
end
|
1257
1439
|
end
|
1258
1440
|
end
|
1259
1441
|
|
1260
1442
|
describe "legacy chef paths from suite" do
|
1261
1443
|
|
1262
|
-
LEGACY_CHEF_PATHS = [
|
1263
|
-
:
|
1444
|
+
LEGACY_CHEF_PATHS = [
|
1445
|
+
:data_path, :data_bags_path, :environments_path,
|
1446
|
+
:nodes_path, :roles_path, :encrypted_data_bag_secret_key_path
|
1447
|
+
]
|
1264
1448
|
|
1265
1449
|
LEGACY_CHEF_PATHS.each do |key|
|
1266
1450
|
|
1267
1451
|
it "moves #{key} into provisioner" do
|
1268
|
-
DataMunger.new(
|
1269
|
-
|
1270
|
-
|
1271
|
-
|
1272
|
-
|
1273
|
-
|
1274
|
-
|
1275
|
-
|
1276
|
-
|
1452
|
+
DataMunger.new(
|
1453
|
+
{
|
1454
|
+
:provisioner => "chefy",
|
1455
|
+
:suites => [
|
1456
|
+
{
|
1457
|
+
:name => "sweet",
|
1458
|
+
key => "mypath"
|
1459
|
+
}
|
1460
|
+
]
|
1461
|
+
},
|
1462
|
+
{}
|
1463
|
+
).provisioner_data_for("sweet", "plat").must_equal(
|
1277
1464
|
:name => "chefy",
|
1278
1465
|
key => "mypath"
|
1279
|
-
|
1466
|
+
)
|
1280
1467
|
end
|
1281
1468
|
|
1282
1469
|
it "merges provisioner into data_path if provisioner exists" do
|
1283
|
-
DataMunger.new(
|
1284
|
-
|
1285
|
-
|
1286
|
-
|
1287
|
-
|
1288
|
-
|
1289
|
-
|
1290
|
-
|
1291
|
-
|
1470
|
+
DataMunger.new(
|
1471
|
+
{
|
1472
|
+
:suites => [
|
1473
|
+
{
|
1474
|
+
:name => "sweet",
|
1475
|
+
key => "mypath",
|
1476
|
+
:provisioner => "chefy"
|
1477
|
+
}
|
1478
|
+
]
|
1479
|
+
},
|
1480
|
+
{}
|
1481
|
+
).provisioner_data_for("sweet", "plat").must_equal(
|
1292
1482
|
:name => "chefy",
|
1293
1483
|
key => "mypath"
|
1294
|
-
|
1484
|
+
)
|
1295
1485
|
end
|
1296
1486
|
end
|
1297
1487
|
end
|
@@ -1301,110 +1491,128 @@ module Kitchen
|
|
1301
1491
|
describe "from a single source" do
|
1302
1492
|
|
1303
1493
|
it "common driver value moves into provisioner" do
|
1304
|
-
DataMunger.new(
|
1305
|
-
|
1306
|
-
|
1307
|
-
:
|
1308
|
-
|
1309
|
-
|
1310
|
-
|
1494
|
+
DataMunger.new(
|
1495
|
+
{
|
1496
|
+
:provisioner => "chefy",
|
1497
|
+
:driver => {
|
1498
|
+
:name => "starship",
|
1499
|
+
:require_chef_omnibus => "it's probably fine"
|
1500
|
+
}
|
1501
|
+
},
|
1502
|
+
{}
|
1503
|
+
).provisioner_data_for("suite", "platform").must_equal(
|
1311
1504
|
:name => "chefy",
|
1312
1505
|
:require_chef_omnibus => "it's probably fine"
|
1313
|
-
|
1506
|
+
)
|
1314
1507
|
end
|
1315
1508
|
|
1316
1509
|
it "common driver value loses to existing provisioner value" do
|
1317
|
-
DataMunger.new(
|
1318
|
-
|
1319
|
-
:
|
1320
|
-
|
1510
|
+
DataMunger.new(
|
1511
|
+
{
|
1512
|
+
:provisioner => {
|
1513
|
+
:name => "chefy",
|
1514
|
+
:require_chef_omnibus => "it's probably fine"
|
1515
|
+
},
|
1516
|
+
:driver => {
|
1517
|
+
:name => "starship",
|
1518
|
+
:require_chef_omnibus => "dragons"
|
1519
|
+
}
|
1321
1520
|
},
|
1322
|
-
|
1323
|
-
|
1324
|
-
:require_chef_omnibus => "dragons"
|
1325
|
-
}
|
1326
|
-
}).provisioner_data_for("suite", "platform").must_equal({
|
1521
|
+
{}
|
1522
|
+
).provisioner_data_for("suite", "platform").must_equal(
|
1327
1523
|
:name => "chefy",
|
1328
1524
|
:require_chef_omnibus => "it's probably fine"
|
1329
|
-
|
1525
|
+
)
|
1330
1526
|
end
|
1331
1527
|
|
1332
1528
|
it "suite driver value moves into provisioner" do
|
1333
|
-
DataMunger.new(
|
1334
|
-
|
1335
|
-
|
1336
|
-
|
1337
|
-
|
1338
|
-
|
1339
|
-
:
|
1340
|
-
|
1529
|
+
DataMunger.new(
|
1530
|
+
{
|
1531
|
+
:suites => [
|
1532
|
+
{
|
1533
|
+
:name => "sweet",
|
1534
|
+
:provisioner => "chefy",
|
1535
|
+
:driver => {
|
1536
|
+
:name => "starship",
|
1537
|
+
:require_chef_omnibus => "it's probably fine"
|
1538
|
+
}
|
1341
1539
|
}
|
1342
|
-
|
1343
|
-
|
1344
|
-
|
1540
|
+
]
|
1541
|
+
},
|
1542
|
+
{}
|
1543
|
+
).provisioner_data_for("sweet", "platform").must_equal(
|
1345
1544
|
:name => "chefy",
|
1346
1545
|
:require_chef_omnibus => "it's probably fine"
|
1347
|
-
|
1546
|
+
)
|
1348
1547
|
end
|
1349
1548
|
|
1350
1549
|
it "suite driver value loses to existing provisioner value" do
|
1351
|
-
DataMunger.new(
|
1352
|
-
|
1353
|
-
|
1354
|
-
|
1355
|
-
|
1356
|
-
:
|
1357
|
-
|
1358
|
-
|
1359
|
-
|
1360
|
-
:
|
1361
|
-
|
1550
|
+
DataMunger.new(
|
1551
|
+
{
|
1552
|
+
:suites => [
|
1553
|
+
{
|
1554
|
+
:name => "sweet",
|
1555
|
+
:provisioner => {
|
1556
|
+
:name => "chefy",
|
1557
|
+
:require_chef_omnibus => "it's probably fine"
|
1558
|
+
},
|
1559
|
+
:driver => {
|
1560
|
+
:name => "starship",
|
1561
|
+
:require_chef_omnibus => "dragons"
|
1562
|
+
}
|
1362
1563
|
}
|
1363
|
-
|
1364
|
-
|
1365
|
-
|
1564
|
+
]
|
1565
|
+
},
|
1566
|
+
{}
|
1567
|
+
).provisioner_data_for("sweet", "platform").must_equal(
|
1366
1568
|
:name => "chefy",
|
1367
1569
|
:require_chef_omnibus => "it's probably fine"
|
1368
|
-
|
1570
|
+
)
|
1369
1571
|
end
|
1370
1572
|
|
1371
1573
|
it "platform driver value moves into provisioner" do
|
1372
|
-
DataMunger.new(
|
1373
|
-
|
1374
|
-
|
1375
|
-
|
1376
|
-
|
1377
|
-
|
1378
|
-
:
|
1379
|
-
|
1574
|
+
DataMunger.new(
|
1575
|
+
{
|
1576
|
+
:platforms => [
|
1577
|
+
{
|
1578
|
+
:name => "plat",
|
1579
|
+
:provisioner => "chefy",
|
1580
|
+
:driver => {
|
1581
|
+
:name => "starship",
|
1582
|
+
:require_chef_omnibus => "it's probably fine"
|
1583
|
+
}
|
1380
1584
|
}
|
1381
|
-
|
1382
|
-
|
1383
|
-
|
1585
|
+
]
|
1586
|
+
},
|
1587
|
+
{}
|
1588
|
+
).provisioner_data_for("suite", "plat").must_equal(
|
1384
1589
|
:name => "chefy",
|
1385
1590
|
:require_chef_omnibus => "it's probably fine"
|
1386
|
-
|
1591
|
+
)
|
1387
1592
|
end
|
1388
1593
|
|
1389
1594
|
it "platform driver value loses to existing provisioner value" do
|
1390
|
-
DataMunger.new(
|
1391
|
-
|
1392
|
-
|
1393
|
-
|
1394
|
-
|
1395
|
-
:
|
1396
|
-
|
1397
|
-
|
1398
|
-
|
1399
|
-
:
|
1400
|
-
|
1595
|
+
DataMunger.new(
|
1596
|
+
{
|
1597
|
+
:platforms => [
|
1598
|
+
{
|
1599
|
+
:name => "plat",
|
1600
|
+
:provisioner => {
|
1601
|
+
:name => "chefy",
|
1602
|
+
:require_chef_omnibus => "it's probably fine"
|
1603
|
+
},
|
1604
|
+
:driver => {
|
1605
|
+
:name => "starship",
|
1606
|
+
:require_chef_omnibus => "dragons"
|
1607
|
+
}
|
1401
1608
|
}
|
1402
|
-
|
1403
|
-
|
1404
|
-
|
1609
|
+
]
|
1610
|
+
},
|
1611
|
+
{}
|
1612
|
+
).provisioner_data_for("suite", "plat").must_equal(
|
1405
1613
|
:name => "chefy",
|
1406
1614
|
:require_chef_omnibus => "it's probably fine"
|
1407
|
-
|
1615
|
+
)
|
1408
1616
|
end
|
1409
1617
|
end
|
1410
1618
|
end
|