chef-dk 0.12.0 → 0.13.21
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/Gemfile +87 -30
- data/Gemfile.lock +721 -0
- data/Gemfile.windows +34 -0
- data/Gemfile.windows.lock +936 -0
- data/README.md +458 -307
- data/Rakefile +22 -29
- data/acceptance/.shared/kitchen_acceptance/.kitchen.ec2.yml +7 -3
- data/acceptance/Gemfile +10 -11
- data/acceptance/Gemfile.lock +242 -0
- data/chef-dk.gemspec +67 -64
- data/lib/chef-dk/builtin_commands.rb +60 -60
- data/lib/chef-dk/command/verify.rb +564 -534
- data/lib/chef-dk/commands_map.rb +115 -115
- data/lib/chef-dk/component_test.rb +198 -194
- data/lib/chef-dk/version.rb +20 -20
- data/lib/kitchen/provisioner/policyfile_zero.rb +3 -2
- data/omnibus_overrides.rb +11 -0
- data/spec/unit/command/verify_spec.rb +334 -325
- data/tasks/bin/bundle-platform +15 -0
- data/tasks/bin/bundle-platform.bat +2 -0
- data/tasks/bundle.rb +80 -0
- data/tasks/bundle_util.rb +93 -0
- data/tasks/dependencies.rb +175 -0
- data/tasks/gemfile_util.rb +99 -0
- data/tasks/github_changelog_generator.rb +31 -0
- data/tasks/version.rb +48 -0
- data/version_policy.rb +112 -0
- metadata +17 -3
data/lib/chef-dk/version.rb
CHANGED
@@ -1,20 +1,20 @@
|
|
1
|
-
#
|
2
|
-
# Copyright:: Copyright (c) 2014 Chef Software Inc.
|
3
|
-
# License:: Apache License, Version 2.0
|
4
|
-
#
|
5
|
-
# Licensed under the Apache License, Version 2.0 (the "License");
|
6
|
-
# you may not use this file except in compliance with the License.
|
7
|
-
# You may obtain a copy of the License at
|
8
|
-
#
|
9
|
-
# http://www.apache.org/licenses/LICENSE-2.0
|
10
|
-
#
|
11
|
-
# Unless required by applicable law or agreed to in writing, software
|
12
|
-
# distributed under the License is distributed on an "AS IS" BASIS,
|
13
|
-
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
14
|
-
# See the License for the specific language governing permissions and
|
15
|
-
# limitations under the License.
|
16
|
-
#
|
17
|
-
|
18
|
-
module ChefDK
|
19
|
-
VERSION = "0.
|
20
|
-
end
|
1
|
+
#
|
2
|
+
# Copyright:: Copyright (c) 2014 Chef Software Inc.
|
3
|
+
# License:: Apache License, Version 2.0
|
4
|
+
#
|
5
|
+
# Licensed under the Apache License, Version 2.0 (the "License");
|
6
|
+
# you may not use this file except in compliance with the License.
|
7
|
+
# You may obtain a copy of the License at
|
8
|
+
#
|
9
|
+
# http://www.apache.org/licenses/LICENSE-2.0
|
10
|
+
#
|
11
|
+
# Unless required by applicable law or agreed to in writing, software
|
12
|
+
# distributed under the License is distributed on an "AS IS" BASIS,
|
13
|
+
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
14
|
+
# See the License for the specific language governing permissions and
|
15
|
+
# limitations under the License.
|
16
|
+
#
|
17
|
+
|
18
|
+
module ChefDK
|
19
|
+
VERSION = "0.13.21"
|
20
|
+
end
|
@@ -96,9 +96,10 @@ module Kitchen
|
|
96
96
|
# (see Base#run_command)
|
97
97
|
def run_command
|
98
98
|
level = config[:log_level] == :info ? :auto : config[:log_level]
|
99
|
-
|
99
|
+
|
100
|
+
cmd = "#{sudo(config[:chef_client_path])} --local-mode".
|
101
|
+
tap { |str| str.insert(0, "& ") if powershell_shell? }
|
100
102
|
|
101
|
-
cmd = "#{chef_client_bin} --local-mode"
|
102
103
|
args = [
|
103
104
|
"--config #{config[:root_path]}/client.rb",
|
104
105
|
"--log_level #{level}",
|
@@ -0,0 +1,11 @@
|
|
1
|
+
# Generated by "rake dependencies". Do not edit.
|
2
|
+
override :rubygems, version: "2.6.3"
|
3
|
+
override :bundler, version: "1.11.2"
|
4
|
+
override :libedit, version: "20130712-3.1"
|
5
|
+
override :libtool, version: "2.4.2"
|
6
|
+
override :libxslt, version: "1.1.28"
|
7
|
+
override :makedepend, version: "1.0.5"
|
8
|
+
override :ruby, version: "2.1.8"
|
9
|
+
override :"util-macros", version: "1.19.0"
|
10
|
+
override :xproto, version: "7.0.28"
|
11
|
+
override :zlib, version: "1.2.8"
|
@@ -1,325 +1,334 @@
|
|
1
|
-
#
|
2
|
-
# Copyright:: Copyright (c) 2014 Chef Software Inc.
|
3
|
-
# License:: Apache License, Version 2.0
|
4
|
-
#
|
5
|
-
# Licensed under the Apache License, Version 2.0 (the "License");
|
6
|
-
# you may not use this file except in compliance with the License.
|
7
|
-
# You may obtain a copy of the License at
|
8
|
-
#
|
9
|
-
# http://www.apache.org/licenses/LICENSE-2.0
|
10
|
-
#
|
11
|
-
# Unless required by applicable law or agreed to in writing, software
|
12
|
-
# distributed under the License is distributed on an "AS IS" BASIS,
|
13
|
-
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
14
|
-
# See the License for the specific language governing permissions and
|
15
|
-
# limitations under the License.
|
16
|
-
#
|
17
|
-
|
18
|
-
require 'spec_helper'
|
19
|
-
require 'chef-dk/command/verify'
|
20
|
-
|
21
|
-
module Gem
|
22
|
-
|
23
|
-
# We stub Gem.ruby because `verify` uses it to locate the omnibus directory,
|
24
|
-
# but we also use it in some of the "test commands" in these tests.
|
25
|
-
class << self
|
26
|
-
alias :real_ruby :ruby
|
27
|
-
end
|
28
|
-
end
|
29
|
-
|
30
|
-
describe ChefDK::Command::Verify do
|
31
|
-
let(:command_instance) { ChefDK::Command::Verify.new() }
|
32
|
-
|
33
|
-
let(:command_options) { [] }
|
34
|
-
|
35
|
-
let(:components) { {} }
|
36
|
-
|
37
|
-
let(:default_components) do
|
38
|
-
[
|
39
|
-
"berkshelf",
|
40
|
-
"test-kitchen",
|
41
|
-
"tk-policyfile-provisioner",
|
42
|
-
"chef-client",
|
43
|
-
"chef-dk",
|
44
|
-
"chef-provisioning",
|
45
|
-
"chefspec",
|
46
|
-
"generated-cookbooks-pass-chefspec",
|
47
|
-
"rubocop",
|
48
|
-
"fauxhai",
|
49
|
-
"knife-spork",
|
50
|
-
"kitchen-vagrant",
|
51
|
-
"package installation",
|
52
|
-
"openssl",
|
53
|
-
"inspec"
|
54
|
-
]
|
55
|
-
end
|
56
|
-
|
57
|
-
def run_command(expected_exit_code)
|
58
|
-
expect(command_instance.run(command_options)).to eq(expected_exit_code)
|
59
|
-
end
|
60
|
-
|
61
|
-
it "defines berks, tk, chef and chef-dk components by default" do
|
62
|
-
expect(command_instance.components).not_to be_empty
|
63
|
-
expect(command_instance.components.map(&:name)).to match_array(default_components)
|
64
|
-
end
|
65
|
-
|
66
|
-
it "has a usage banner" do
|
67
|
-
expect(command_instance.banner).to eq("Usage: chef verify [component, ...] [options]")
|
68
|
-
end
|
69
|
-
|
70
|
-
describe "when locating omnibus directory" do
|
71
|
-
it "should find omnibus app directory from ruby path" do
|
72
|
-
allow(Gem).to receive(:ruby).and_return(File.join(fixtures_path, "eg_omnibus_dir/valid/embedded/bin/ruby"))
|
73
|
-
expect(command_instance.omnibus_apps_dir).to include("eg_omnibus_dir/valid/embedded")
|
74
|
-
end
|
75
|
-
|
76
|
-
it "should raise OmnibusInstallNotFound if directory is not looking like omnibus" do
|
77
|
-
allow(Gem).to receive(:ruby).and_return(File.join(fixtures_path,".rbenv/versions/2.1.1/bin/ruby"))
|
78
|
-
expect{command_instance.omnibus_apps_dir}.to raise_error(ChefDK::OmnibusInstallNotFound)
|
79
|
-
end
|
80
|
-
|
81
|
-
it "raises OmnibusInstallNotFound if omnibus directory doesn't exist" do
|
82
|
-
allow(Gem).to receive(:ruby).and_return(File.join(fixtures_path,"eg_omnibus_dir/missing_apps/embedded/bin/ruby"))
|
83
|
-
expect{command_instance.omnibus_apps_dir}.to raise_error(ChefDK::OmnibusInstallNotFound)
|
84
|
-
end
|
85
|
-
|
86
|
-
|
87
|
-
|
88
|
-
|
89
|
-
|
90
|
-
|
91
|
-
|
92
|
-
|
93
|
-
|
94
|
-
|
95
|
-
|
96
|
-
|
97
|
-
|
98
|
-
|
99
|
-
|
100
|
-
|
101
|
-
|
102
|
-
|
103
|
-
|
104
|
-
|
105
|
-
|
106
|
-
|
107
|
-
|
108
|
-
|
109
|
-
|
110
|
-
|
111
|
-
|
112
|
-
|
113
|
-
end
|
114
|
-
|
115
|
-
let(:
|
116
|
-
ChefDK::ComponentTest.new("
|
117
|
-
c.base_dir = "
|
118
|
-
c.unit_test(&run_unit_test)
|
119
|
-
c.
|
120
|
-
|
121
|
-
|
122
|
-
|
123
|
-
|
124
|
-
|
125
|
-
|
126
|
-
c.
|
127
|
-
c.
|
128
|
-
|
129
|
-
|
130
|
-
|
131
|
-
|
132
|
-
|
133
|
-
|
134
|
-
|
135
|
-
|
136
|
-
|
137
|
-
|
138
|
-
|
139
|
-
|
140
|
-
|
141
|
-
|
142
|
-
|
143
|
-
|
144
|
-
|
145
|
-
|
146
|
-
|
147
|
-
|
148
|
-
|
149
|
-
|
150
|
-
|
151
|
-
|
152
|
-
|
153
|
-
|
154
|
-
|
155
|
-
|
156
|
-
|
157
|
-
|
158
|
-
|
159
|
-
|
160
|
-
|
161
|
-
|
162
|
-
|
163
|
-
|
164
|
-
|
165
|
-
|
166
|
-
|
167
|
-
|
168
|
-
|
169
|
-
|
170
|
-
|
171
|
-
|
172
|
-
|
173
|
-
|
174
|
-
|
175
|
-
|
176
|
-
|
177
|
-
|
178
|
-
|
179
|
-
|
180
|
-
|
181
|
-
|
182
|
-
|
183
|
-
|
184
|
-
|
185
|
-
|
186
|
-
|
187
|
-
|
188
|
-
|
189
|
-
|
190
|
-
|
191
|
-
|
192
|
-
|
193
|
-
|
194
|
-
|
195
|
-
|
196
|
-
|
197
|
-
|
198
|
-
|
199
|
-
end
|
200
|
-
|
201
|
-
|
202
|
-
|
203
|
-
|
204
|
-
|
205
|
-
|
206
|
-
|
207
|
-
|
208
|
-
|
209
|
-
|
210
|
-
|
211
|
-
|
212
|
-
|
213
|
-
|
214
|
-
|
215
|
-
|
216
|
-
|
217
|
-
|
218
|
-
|
219
|
-
|
220
|
-
|
221
|
-
|
222
|
-
|
223
|
-
|
224
|
-
|
225
|
-
end
|
226
|
-
|
227
|
-
context "and --
|
228
|
-
|
229
|
-
let(:command_options) { %w{--
|
230
|
-
|
231
|
-
it "
|
232
|
-
expect(stdout).
|
233
|
-
end
|
234
|
-
|
235
|
-
|
236
|
-
|
237
|
-
|
238
|
-
|
239
|
-
|
240
|
-
|
241
|
-
|
242
|
-
|
243
|
-
|
244
|
-
|
245
|
-
|
246
|
-
|
247
|
-
|
248
|
-
|
249
|
-
|
250
|
-
|
251
|
-
|
252
|
-
|
253
|
-
|
254
|
-
|
255
|
-
|
256
|
-
|
257
|
-
|
258
|
-
|
259
|
-
|
260
|
-
|
261
|
-
|
262
|
-
|
263
|
-
|
264
|
-
|
265
|
-
|
266
|
-
|
267
|
-
|
268
|
-
|
269
|
-
|
270
|
-
|
271
|
-
|
272
|
-
|
273
|
-
|
274
|
-
|
275
|
-
|
276
|
-
|
277
|
-
|
278
|
-
|
279
|
-
|
280
|
-
|
281
|
-
end
|
282
|
-
|
283
|
-
|
284
|
-
|
285
|
-
|
286
|
-
|
287
|
-
|
288
|
-
|
289
|
-
|
290
|
-
|
291
|
-
|
292
|
-
|
293
|
-
|
294
|
-
|
295
|
-
|
296
|
-
|
297
|
-
|
298
|
-
|
299
|
-
|
300
|
-
|
301
|
-
|
302
|
-
|
303
|
-
|
304
|
-
|
305
|
-
|
306
|
-
|
307
|
-
|
308
|
-
|
309
|
-
|
310
|
-
|
311
|
-
|
312
|
-
|
313
|
-
|
314
|
-
|
315
|
-
|
316
|
-
|
317
|
-
|
318
|
-
|
319
|
-
|
320
|
-
|
321
|
-
|
322
|
-
|
323
|
-
|
324
|
-
|
325
|
-
|
1
|
+
#
|
2
|
+
# Copyright:: Copyright (c) 2014 Chef Software Inc.
|
3
|
+
# License:: Apache License, Version 2.0
|
4
|
+
#
|
5
|
+
# Licensed under the Apache License, Version 2.0 (the "License");
|
6
|
+
# you may not use this file except in compliance with the License.
|
7
|
+
# You may obtain a copy of the License at
|
8
|
+
#
|
9
|
+
# http://www.apache.org/licenses/LICENSE-2.0
|
10
|
+
#
|
11
|
+
# Unless required by applicable law or agreed to in writing, software
|
12
|
+
# distributed under the License is distributed on an "AS IS" BASIS,
|
13
|
+
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
14
|
+
# See the License for the specific language governing permissions and
|
15
|
+
# limitations under the License.
|
16
|
+
#
|
17
|
+
|
18
|
+
require 'spec_helper'
|
19
|
+
require 'chef-dk/command/verify'
|
20
|
+
|
21
|
+
module Gem
|
22
|
+
|
23
|
+
# We stub Gem.ruby because `verify` uses it to locate the omnibus directory,
|
24
|
+
# but we also use it in some of the "test commands" in these tests.
|
25
|
+
class << self
|
26
|
+
alias :real_ruby :ruby
|
27
|
+
end
|
28
|
+
end
|
29
|
+
|
30
|
+
describe ChefDK::Command::Verify do
|
31
|
+
let(:command_instance) { ChefDK::Command::Verify.new() }
|
32
|
+
|
33
|
+
let(:command_options) { [] }
|
34
|
+
|
35
|
+
let(:components) { {} }
|
36
|
+
|
37
|
+
let(:default_components) do
|
38
|
+
[
|
39
|
+
"berkshelf",
|
40
|
+
"test-kitchen",
|
41
|
+
"tk-policyfile-provisioner",
|
42
|
+
"chef-client",
|
43
|
+
"chef-dk",
|
44
|
+
"chef-provisioning",
|
45
|
+
"chefspec",
|
46
|
+
"generated-cookbooks-pass-chefspec",
|
47
|
+
"rubocop",
|
48
|
+
"fauxhai",
|
49
|
+
"knife-spork",
|
50
|
+
"kitchen-vagrant",
|
51
|
+
"package installation",
|
52
|
+
"openssl",
|
53
|
+
"inspec"
|
54
|
+
]
|
55
|
+
end
|
56
|
+
|
57
|
+
def run_command(expected_exit_code)
|
58
|
+
expect(command_instance.run(command_options)).to eq(expected_exit_code)
|
59
|
+
end
|
60
|
+
|
61
|
+
it "defines berks, tk, chef and chef-dk components by default" do
|
62
|
+
expect(command_instance.components).not_to be_empty
|
63
|
+
expect(command_instance.components.map(&:name)).to match_array(default_components)
|
64
|
+
end
|
65
|
+
|
66
|
+
it "has a usage banner" do
|
67
|
+
expect(command_instance.banner).to eq("Usage: chef verify [component, ...] [options]")
|
68
|
+
end
|
69
|
+
|
70
|
+
describe "when locating omnibus directory" do
|
71
|
+
it "should find omnibus app directory from ruby path" do
|
72
|
+
allow(Gem).to receive(:ruby).and_return(File.join(fixtures_path, "eg_omnibus_dir/valid/embedded/bin/ruby"))
|
73
|
+
expect(command_instance.omnibus_apps_dir).to include("eg_omnibus_dir/valid/embedded")
|
74
|
+
end
|
75
|
+
|
76
|
+
it "should raise OmnibusInstallNotFound if directory is not looking like omnibus" do
|
77
|
+
allow(Gem).to receive(:ruby).and_return(File.join(fixtures_path,".rbenv/versions/2.1.1/bin/ruby"))
|
78
|
+
expect{command_instance.omnibus_apps_dir}.to raise_error(ChefDK::OmnibusInstallNotFound)
|
79
|
+
end
|
80
|
+
|
81
|
+
it "raises OmnibusInstallNotFound if omnibus directory doesn't exist" do
|
82
|
+
allow(Gem).to receive(:ruby).and_return(File.join(fixtures_path,"eg_omnibus_dir/missing_apps/embedded/bin/ruby"))
|
83
|
+
expect{command_instance.omnibus_apps_dir}.to raise_error(ChefDK::OmnibusInstallNotFound)
|
84
|
+
end
|
85
|
+
|
86
|
+
context "and a component's gem is not installed" do
|
87
|
+
before do
|
88
|
+
component_map = ChefDK::Command::Verify.component_map.dup
|
89
|
+
component_map["cucumber"] = ChefDK::ComponentTest.new("cucumber")
|
90
|
+
component_map["cucumber"].gem_base_dir = "cucumber"
|
91
|
+
allow(ChefDK::Command::Verify).to receive(:component_map).and_return(component_map)
|
92
|
+
end
|
93
|
+
|
94
|
+
it "raises MissingComponentError when a component doesn't exist" do
|
95
|
+
allow(Gem).to receive(:ruby).and_return(File.join(fixtures_path,"eg_omnibus_dir/missing_component/embedded/bin/ruby"))
|
96
|
+
expect{command_instance.validate_components!}.to raise_error(ChefDK::MissingComponentError)
|
97
|
+
end
|
98
|
+
end
|
99
|
+
end
|
100
|
+
|
101
|
+
describe "when running verify command" do
|
102
|
+
let(:stdout_io) { StringIO.new }
|
103
|
+
let(:ruby_path) { File.join(fixtures_path, "eg_omnibus_dir/valid/embedded/bin/ruby") }
|
104
|
+
|
105
|
+
def run_unit_test
|
106
|
+
# Set rubyopt to empty to prevent bundler from infecting the ruby
|
107
|
+
# subcommands (and loading a bunch of extra gems).
|
108
|
+
lambda { |_self| sh("#{Gem.real_ruby} verify_me", env: { "RUBYOPT" => ""}) }
|
109
|
+
end
|
110
|
+
|
111
|
+
def run_integration_test
|
112
|
+
lambda { |_self| sh("#{Gem.real_ruby} integration_test", env: { "RUBYOPT" => ""}) }
|
113
|
+
end
|
114
|
+
|
115
|
+
let(:all_tests_ok) do
|
116
|
+
ChefDK::ComponentTest.new("successful_comp").tap do |c|
|
117
|
+
c.base_dir = "berkshelf"
|
118
|
+
c.unit_test(&run_unit_test)
|
119
|
+
c.integration_test(&run_integration_test)
|
120
|
+
c.smoke_test { sh("exit 0") }
|
121
|
+
end
|
122
|
+
end
|
123
|
+
|
124
|
+
let(:all_tests_ok_2) do
|
125
|
+
ChefDK::ComponentTest.new("successful_comp_2").tap do |c|
|
126
|
+
c.base_dir = "test-kitchen"
|
127
|
+
c.unit_test(&run_unit_test)
|
128
|
+
c.smoke_test { sh("exit 0") }
|
129
|
+
end
|
130
|
+
end
|
131
|
+
|
132
|
+
let(:failing_unit_test) do
|
133
|
+
ChefDK::ComponentTest.new("failing_comp").tap do |c|
|
134
|
+
c.base_dir = "chef"
|
135
|
+
c.unit_test(&run_unit_test)
|
136
|
+
c.smoke_test { sh("exit 0") }
|
137
|
+
end
|
138
|
+
end
|
139
|
+
|
140
|
+
let(:passing_smoke_test_only) do
|
141
|
+
component = failing_unit_test.dup
|
142
|
+
component.smoke_test { sh("exit 0") }
|
143
|
+
component
|
144
|
+
end
|
145
|
+
|
146
|
+
let(:failing_smoke_test_only) do
|
147
|
+
component = all_tests_ok.dup
|
148
|
+
component.smoke_test { sh("exit 1") }
|
149
|
+
component
|
150
|
+
end
|
151
|
+
|
152
|
+
let(:component_without_integration_tests) do
|
153
|
+
ChefDK::ComponentTest.new("successful_comp").tap do |c|
|
154
|
+
c.base_dir = "berkshelf"
|
155
|
+
c.unit_test { sh("./verify_me") }
|
156
|
+
c.smoke_test { sh("exit 0") }
|
157
|
+
end
|
158
|
+
end
|
159
|
+
|
160
|
+
def stdout
|
161
|
+
stdout_io.string
|
162
|
+
end
|
163
|
+
|
164
|
+
before do
|
165
|
+
allow(Gem).to receive(:ruby).and_return(ruby_path)
|
166
|
+
allow(command_instance).to receive(:stdout).and_return(stdout_io)
|
167
|
+
allow(command_instance).to receive(:components).and_return(components)
|
168
|
+
end
|
169
|
+
|
170
|
+
context "when running smoke tests only" do
|
171
|
+
describe "with single command with success" do
|
172
|
+
let(:components) do
|
173
|
+
[ passing_smoke_test_only ]
|
174
|
+
end
|
175
|
+
|
176
|
+
before do
|
177
|
+
run_command(0)
|
178
|
+
end
|
179
|
+
|
180
|
+
it "should report the success of the command" do
|
181
|
+
expect(stdout).to include("Verification of component 'failing_comp' succeeded.")
|
182
|
+
end
|
183
|
+
|
184
|
+
end
|
185
|
+
|
186
|
+
describe "with single command with failure" do
|
187
|
+
let(:components) do
|
188
|
+
[ failing_smoke_test_only ]
|
189
|
+
end
|
190
|
+
|
191
|
+
before do
|
192
|
+
run_command(1)
|
193
|
+
end
|
194
|
+
|
195
|
+
it "should report the failure of the command" do
|
196
|
+
expect(stdout).to include("Verification of component 'successful_comp' failed.")
|
197
|
+
end
|
198
|
+
|
199
|
+
end
|
200
|
+
end
|
201
|
+
|
202
|
+
context "when running unit tests" do
|
203
|
+
|
204
|
+
let(:command_options) { %w{--unit --verbose} }
|
205
|
+
|
206
|
+
let(:components) do
|
207
|
+
[ all_tests_ok ]
|
208
|
+
end
|
209
|
+
|
210
|
+
describe "with single command with success" do
|
211
|
+
before do
|
212
|
+
run_command(0)
|
213
|
+
end
|
214
|
+
|
215
|
+
it "should have embedded/bin on the PATH" do
|
216
|
+
expect(stdout).to include(File.join(fixtures_path, "eg_omnibus_dir/valid/embedded/bin"))
|
217
|
+
end
|
218
|
+
|
219
|
+
it "should report the success of the command" do
|
220
|
+
expect(stdout).to include("Verification of component 'successful_comp' succeeded.")
|
221
|
+
end
|
222
|
+
|
223
|
+
it "reports the component test output" do
|
224
|
+
expect(stdout).to include("you are good to go...")
|
225
|
+
end
|
226
|
+
|
227
|
+
context "and --verbose is not enabled" do
|
228
|
+
|
229
|
+
let(:command_options) { %w{--unit} }
|
230
|
+
|
231
|
+
it "omits the component test output" do
|
232
|
+
expect(stdout).to_not include("you are good to go...")
|
233
|
+
end
|
234
|
+
end
|
235
|
+
|
236
|
+
context "and --integration flag is given" do
|
237
|
+
|
238
|
+
let(:command_options) { %w{--integration --verbose} }
|
239
|
+
|
240
|
+
it "should run the integration command also" do
|
241
|
+
expect(stdout).to include("integration tests OK")
|
242
|
+
end
|
243
|
+
|
244
|
+
context "and no integration test command is specifed for the component" do
|
245
|
+
|
246
|
+
let(:components) do
|
247
|
+
[ component_without_integration_tests ]
|
248
|
+
end
|
249
|
+
|
250
|
+
it "skips the integration test and succeeds" do
|
251
|
+
expect(stdout).to include("Verification of component 'successful_comp' succeeded.")
|
252
|
+
end
|
253
|
+
|
254
|
+
end
|
255
|
+
|
256
|
+
end
|
257
|
+
|
258
|
+
end
|
259
|
+
|
260
|
+
describe "with single command with failure" do
|
261
|
+
let(:components) do
|
262
|
+
[ failing_unit_test ]
|
263
|
+
end
|
264
|
+
|
265
|
+
before do
|
266
|
+
run_command(1)
|
267
|
+
end
|
268
|
+
|
269
|
+
it "should report the failure of the command" do
|
270
|
+
expect(stdout).to include("Verification of component 'failing_comp' failed.")
|
271
|
+
end
|
272
|
+
|
273
|
+
it "reports the component test output" do
|
274
|
+
expect(stdout).to include("i'm not feeling good today...")
|
275
|
+
end
|
276
|
+
end
|
277
|
+
|
278
|
+
describe "with multiple commands with success" do
|
279
|
+
let(:components) do
|
280
|
+
[ all_tests_ok, all_tests_ok_2 ]
|
281
|
+
end
|
282
|
+
|
283
|
+
before do
|
284
|
+
run_command(0)
|
285
|
+
end
|
286
|
+
|
287
|
+
it "should report the success of the command" do
|
288
|
+
expect(stdout).to include("Verification of component 'successful_comp' succeeded.")
|
289
|
+
expect(stdout).to include("Verification of component 'successful_comp_2' succeeded.")
|
290
|
+
end
|
291
|
+
|
292
|
+
it "reports the component test outputs" do
|
293
|
+
expect(stdout).to include("you are good to go...")
|
294
|
+
expect(stdout).to include("my friend everything is good...")
|
295
|
+
end
|
296
|
+
|
297
|
+
context "and components are filtered by CLI args" do
|
298
|
+
|
299
|
+
let(:command_options) { [ "successful_comp_2" ] }
|
300
|
+
|
301
|
+
it "verifies only the desired component" do
|
302
|
+
expect(stdout).to_not include("Verification of component 'successful_comp_1' succeeded.")
|
303
|
+
expect(stdout).to include("Verification of component 'successful_comp_2' succeeded.")
|
304
|
+
end
|
305
|
+
|
306
|
+
end
|
307
|
+
end
|
308
|
+
|
309
|
+
describe "with multiple commands with failures" do
|
310
|
+
let(:components) do
|
311
|
+
[ all_tests_ok, all_tests_ok_2, failing_unit_test ]
|
312
|
+
end
|
313
|
+
|
314
|
+
before do
|
315
|
+
run_command(1)
|
316
|
+
end
|
317
|
+
|
318
|
+
it "should report the success and failure of the commands" do
|
319
|
+
expect(stdout).to include("Verification of component 'successful_comp' succeeded.")
|
320
|
+
expect(stdout).to include("Verification of component 'successful_comp_2' succeeded.")
|
321
|
+
expect(stdout).to include("Verification of component 'failing_comp' failed.")
|
322
|
+
end
|
323
|
+
|
324
|
+
it "reports the component test outputs" do
|
325
|
+
expect(stdout).to include("you are good to go...")
|
326
|
+
expect(stdout).to include("my friend everything is good...")
|
327
|
+
expect(stdout).to include("i'm not feeling good today...")
|
328
|
+
end
|
329
|
+
end
|
330
|
+
|
331
|
+
end
|
332
|
+
end
|
333
|
+
|
334
|
+
end
|