|
11 | 11 | require 'bolt/task' |
12 | 12 |
|
13 | 13 | describe 'apply_prep' do |
14 | | - include PuppetlabsSpec::Fixtures |
15 | | - |
16 | 14 | let(:applicator) { mock('Bolt::Applicator') } |
17 | 15 | let(:config) { Bolt::Config.default } |
18 | 16 | let(:executor) { Bolt::Executor.new } |
|
32 | 30 | end |
33 | 31 |
|
34 | 32 | context 'with targets' do |
35 | | - let(:hostnames) { %w[a.b.com winrm://x.y.com pcp://foo] } |
| 33 | + let(:hostnames) { %w[a.b.com winrm://x.y.com remote://foo] } |
36 | 34 | let(:targets) { hostnames.map { |h| inventory.get_target(h) } } |
37 | | - let(:unknown_targets) { targets.reject { |target| target.protocol == 'pcp' } } |
38 | 35 | let(:fact) { { 'osfamily' => 'none' } } |
39 | 36 | let(:custom_facts_task) { Bolt::Task.new('custom_facts_task') } |
40 | 37 | let(:version_task) { Bolt::Task.new('openvox_bootstrap::check') } |
|
74 | 71 |
|
75 | 72 | is_expected.to run.with_params(hostnames.join(',')) |
76 | 73 | targets.each do |target| |
77 | | - expect(inventory.features(target)).to include('puppet-agent') unless target.transport == 'pcp' |
| 74 | + expect(inventory.features(target)).to include('puppet-agent') unless target.transport == 'remote' |
78 | 75 | expect(inventory.facts(target)).to eq(fact) |
79 | 76 | end |
80 | 77 | end |
|
92 | 89 |
|
93 | 90 | is_expected.to run.with_params(hostnames, '_run_as' => 'root') |
94 | 91 | targets.each do |target| |
95 | | - expect(inventory.features(target)).to include('puppet-agent') unless target.transport == 'pcp' |
| 92 | + expect(inventory.features(target)).to include('puppet-agent') unless target.transport == 'remote' |
96 | 93 | expect(inventory.facts(target)).to eq(fact) |
97 | 94 | end |
98 | 95 | end |
|
110 | 107 |
|
111 | 108 | is_expected.to run.with_params(hostnames, '_noop' => true) |
112 | 109 | targets.each do |target| |
113 | | - expect(inventory.features(target)).to include('puppet-agent') unless target.transport == 'pcp' |
| 110 | + expect(inventory.features(target)).to include('puppet-agent') unless target.transport == 'remote' |
114 | 111 | expect(inventory.facts(target)).to eq(fact) |
115 | 112 | end |
116 | 113 | end |
|
199 | 196 | end |
200 | 197 | end |
201 | 198 |
|
202 | | - context 'with only pcp targets' do |
203 | | - let(:hostnames) { %w[pcp://foo pcp://bar] } |
204 | | - let(:targets) { hostnames.map { |h| inventory.get_target(h) } } |
205 | | - let(:fact) { { 'osfamily' => 'none' } } |
206 | | - let(:custom_facts_task) { Bolt::Task.new('custom_facts_task') } |
207 | | - |
208 | | - before(:each) do |
209 | | - applicator.stubs(:build_plugin_tarball).returns(:tarball) |
210 | | - applicator.stubs(:custom_facts_task).returns(custom_facts_task) |
211 | | - end |
212 | | - |
213 | | - it 'sets feature and gathers facts' do |
214 | | - facts = Bolt::ResultSet.new(targets.map { |t| Bolt::Result.new(t, value: fact) }) |
215 | | - executor.expects(:run_task) |
216 | | - .with(targets, custom_facts_task, includes('plugins'), {}) |
217 | | - .returns(facts) |
218 | | - |
219 | | - is_expected.to run.with_params(hostnames.join(',')) |
220 | | - targets.each do |target| |
221 | | - expect(inventory.features(target)).to include('puppet-agent') unless target.transport == 'pcp' |
222 | | - expect(inventory.facts(target)).to eq(fact) |
223 | | - end |
224 | | - end |
225 | | - end |
226 | | - |
227 | 199 | context 'with targets assigned the puppet-agent feature' do |
228 | 200 | let(:hostnames) { %w[foo bar] } |
229 | 201 | let(:targets) { hostnames.map { |h| inventory.get_target(h) } } |
|
0 commit comments