chef-apply 0.4.6 → 0.4.9
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.
- checksums.yaml +4 -4
- data/Gemfile +1 -7
- data/chef-apply.gemspec +3 -3
- data/lib/chef_apply/version.rb +1 -1
- metadata +3 -38
- data/README.md +0 -62
- data/spec/fixtures/custom_config.toml +0 -2
- data/spec/integration/chef-run_spec.rb +0 -41
- data/spec/integration/fixtures/chef_help.out +0 -70
- data/spec/integration/fixtures/chef_version.out +0 -1
- data/spec/integration/spec_helper.rb +0 -55
- data/spec/spec_helper.rb +0 -154
- data/spec/support/matchers/output_to_terminal.rb +0 -36
- data/spec/unit/action/base_spec.rb +0 -60
- data/spec/unit/action/converge_target/ccr_failure_mapper_spec.rb +0 -106
- data/spec/unit/action/converge_target_spec.rb +0 -400
- data/spec/unit/action/generate_local_policy_spec.rb +0 -114
- data/spec/unit/action/generate_temp_cookbook/recipe_lookup_spec.rb +0 -122
- data/spec/unit/action/generate_temp_cookbook/temp_cookbook_spec.rb +0 -198
- data/spec/unit/action/generate_temp_cookbook_spec.rb +0 -73
- data/spec/unit/action/install_chef/minimum_chef_version_spec.rb +0 -90
- data/spec/unit/action/install_chef_spec.rb +0 -164
- data/spec/unit/cli/options_spec.rb +0 -75
- data/spec/unit/cli/validation_spec.rb +0 -81
- data/spec/unit/cli_spec.rb +0 -475
- data/spec/unit/config_spec.rb +0 -70
- data/spec/unit/file_fetcher_spec.rb +0 -40
- data/spec/unit/fixtures/multi-error.out +0 -2
- data/spec/unit/log_spec.rb +0 -37
- data/spec/unit/startup_spec.rb +0 -323
- data/spec/unit/target_host/linux_spec.rb +0 -57
- data/spec/unit/target_host/windows_spec.rb +0 -43
- data/spec/unit/target_host_spec.rb +0 -297
- data/spec/unit/target_resolver_spec.rb +0 -380
- data/spec/unit/telemeter/sender_spec.rb +0 -140
- data/spec/unit/telemeter_spec.rb +0 -191
- data/spec/unit/text/error_translation_spec.rb +0 -109
- data/spec/unit/ui/error_printer_spec.rb +0 -196
- data/spec/unit/ui/terminal_spec.rb +0 -119
- data/spec/unit/version_spec.rb +0 -31
@@ -1,119 +0,0 @@
|
|
1
|
-
#
|
2
|
-
# Copyright:: Copyright (c) 2018 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_apply/ui/terminal"
|
20
|
-
|
21
|
-
RSpec.describe ChefApply::UI::Terminal do
|
22
|
-
Terminal = ChefApply::UI::Terminal
|
23
|
-
# Lets send our Terminal output somewhere so it does not clutter the
|
24
|
-
# test output
|
25
|
-
Terminal.location = StringIO.new
|
26
|
-
|
27
|
-
it "correctly outputs a message" do
|
28
|
-
expect { Terminal.output("test") }
|
29
|
-
.to output("test\n").to_terminal
|
30
|
-
end
|
31
|
-
|
32
|
-
context "#render_job" do
|
33
|
-
it "executes the provided block" do
|
34
|
-
@ran = false
|
35
|
-
job = Terminal::Job.new("prefix", nil) do
|
36
|
-
@ran = true
|
37
|
-
end
|
38
|
-
Terminal.render_job("a message", job)
|
39
|
-
expect(@ran).to eq true
|
40
|
-
end
|
41
|
-
end
|
42
|
-
|
43
|
-
context "#render_parallel_jobs" do
|
44
|
-
it "executes the provided job instances" do
|
45
|
-
@job1ran = false
|
46
|
-
@job2ran = false
|
47
|
-
job1 = Terminal::Job.new("prefix", nil) do
|
48
|
-
@job1ran = true
|
49
|
-
end
|
50
|
-
job2 = Terminal::Job.new("prefix", nil) do
|
51
|
-
@job2ran = true
|
52
|
-
end
|
53
|
-
Terminal.render_parallel_jobs("a message", [job1, job2])
|
54
|
-
expect(@job1ran).to eq true
|
55
|
-
expect(@job2ran).to eq true
|
56
|
-
end
|
57
|
-
it "always resets the cursor to visible" do
|
58
|
-
job1 = Terminal::Job.new("prefix", nil) do
|
59
|
-
raise "Cursor should be set visible"
|
60
|
-
end
|
61
|
-
expect(Terminal).to receive(:show_cursor)
|
62
|
-
Terminal.render_parallel_jobs("a message", [job1])
|
63
|
-
end
|
64
|
-
end
|
65
|
-
|
66
|
-
describe ChefApply::UI::Terminal::Job do
|
67
|
-
subject { ChefApply::UI::Terminal::Job }
|
68
|
-
context "#exception" do
|
69
|
-
context "when no exception occurs in execution" do
|
70
|
-
context "and it's been invoked directly" do
|
71
|
-
it "exception is nil" do
|
72
|
-
job = subject.new("", nil) { 0 }
|
73
|
-
job.run(ChefApply::MockReporter.new)
|
74
|
-
expect(job.exception).to eq nil
|
75
|
-
end
|
76
|
-
end
|
77
|
-
context "and it's running in a thread alongside other jobs" do
|
78
|
-
it "exception is nil for each job" do
|
79
|
-
job1 = subject.new("", nil) { 0 }
|
80
|
-
job2 = subject.new("", nil) { 0 }
|
81
|
-
threads = []
|
82
|
-
threads << Thread.new { job1.run(ChefApply::MockReporter.new) }
|
83
|
-
threads << Thread.new { job2.run(ChefApply::MockReporter.new) }
|
84
|
-
threads.each(&:join)
|
85
|
-
expect(job1.exception).to eq nil
|
86
|
-
expect(job2.exception).to eq nil
|
87
|
-
|
88
|
-
end
|
89
|
-
end
|
90
|
-
end
|
91
|
-
context "when an exception occurs in execution" do
|
92
|
-
context "and it's been invoked directly" do
|
93
|
-
it "captures the exception in #exception" do
|
94
|
-
expected_exception = StandardError.new("exception 1")
|
95
|
-
job = subject.new("", nil) { |arg| raise expected_exception }
|
96
|
-
job.run(ChefApply::MockReporter.new)
|
97
|
-
expect(job.exception).to eq expected_exception
|
98
|
-
end
|
99
|
-
end
|
100
|
-
|
101
|
-
context "and it's running in a thread alongside other jobs" do
|
102
|
-
it "each job holds its own exception" do
|
103
|
-
e1 = StandardError.new("exception 1")
|
104
|
-
e2 = StandardError.new("exception 2")
|
105
|
-
|
106
|
-
job1 = subject.new("", nil) { |_| raise e1 }
|
107
|
-
job2 = subject.new("", nil) { |_| raise e2 }
|
108
|
-
threads = []
|
109
|
-
threads << Thread.new { job1.run(ChefApply::MockReporter.new) }
|
110
|
-
threads << Thread.new { job2.run(ChefApply::MockReporter.new) }
|
111
|
-
threads.each(&:join)
|
112
|
-
expect(job1.exception).to eq e1
|
113
|
-
expect(job2.exception).to eq e2
|
114
|
-
end
|
115
|
-
end
|
116
|
-
end
|
117
|
-
end
|
118
|
-
end
|
119
|
-
end
|
data/spec/unit/version_spec.rb
DELETED
@@ -1,31 +0,0 @@
|
|
1
|
-
#
|
2
|
-
# Copyright:: Copyright (c) 2018 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_apply/version"
|
20
|
-
|
21
|
-
RSpec.describe ChefApply::VERSION do
|
22
|
-
subject(:version) do
|
23
|
-
ChefApply::VERSION
|
24
|
-
end
|
25
|
-
|
26
|
-
context "VERSION" do
|
27
|
-
it "returns the version" do
|
28
|
-
expect(Gem::Version.correct?(version)).to be_truthy
|
29
|
-
end
|
30
|
-
end
|
31
|
-
end
|