puppet_litmus 0.26.1 → 0.28.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/exe/matrix_from_metadata_v2 +2 -1
- data/lib/puppet_litmus/inventory_manipulation.rb +2 -2
- data/lib/puppet_litmus/puppet_helpers.rb +11 -11
- data/lib/puppet_litmus/rake_helper.rb +1 -1
- data/lib/puppet_litmus/rake_tasks.rb +4 -4
- data/lib/puppet_litmus/version.rb +1 -1
- data/spec/lib/puppet_litmus/puppet_helpers_spec.rb +32 -22
- metadata +8 -8
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 51e321964b54828b1e0c5602fd6038e8efe1fcd0190bd9c1ada036954b66e8db
|
4
|
+
data.tar.gz: f5179463919201def0ff7a033f061dea91755a91c035b5fffc6222cdb8ce1359
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: ff4f3114a21e708537908e577ce0d3361c6075d980eb1bd3bb13f680d526e0eaa2e6ecf64291864e8042e43b18e4a9df88b0098c53c3879a5d79390ffff1ddf6
|
7
|
+
data.tar.gz: 0a3177a69170a3687e33820f8fbe21c89b6a00fc999ad800ecf2921b2f0452e06644833df5a5a98e3f3aa51cbdcca87d3e0a8f85476d4bcf9d7dde09ce5441a2
|
data/exe/matrix_from_metadata_v2
CHANGED
@@ -19,9 +19,10 @@ DOCKER_PLATFORMS = {
|
|
19
19
|
'CentOS-6' => 'litmusimage/centos:6',
|
20
20
|
'CentOS-7' => 'litmusimage/centos:7',
|
21
21
|
'CentOS-8' => 'litmusimage/centos:8',
|
22
|
-
'Debian-10' => 'litmusimage/debian:10',
|
23
22
|
# 'Debian-8' => 'litmusimage/debian:8', Removing from testing: https://puppet.com/docs/pe/2021.0/supported_operating_systems.html
|
24
23
|
'Debian-9' => 'litmusimage/debian:9',
|
24
|
+
'Debian-10' => 'litmusimage/debian:10',
|
25
|
+
'Debian-11' => 'litmusimage/debian:11',
|
25
26
|
'OracleLinux-6' => 'litmusimage/oraclelinux:6',
|
26
27
|
'OracleLinux-7' => 'litmusimage/oraclelinux:7',
|
27
28
|
'Scientific-6' => 'litmusimage/scientificlinux:6',
|
@@ -6,8 +6,8 @@ module PuppetLitmus; end # rubocop:disable Style/Documentation
|
|
6
6
|
module PuppetLitmus::InventoryManipulation
|
7
7
|
# Creates an inventory hash from the inventory.yaml.
|
8
8
|
#
|
9
|
-
# @param inventory_full_path [String] path to the
|
10
|
-
# @return [Hash] hash of the
|
9
|
+
# @param inventory_full_path [String] path to the litmus_inventory.yaml file
|
10
|
+
# @return [Hash] hash of the litmus_inventory.yaml file.
|
11
11
|
def inventory_hash_from_inventory_file(inventory_full_path = nil)
|
12
12
|
require 'yaml'
|
13
13
|
inventory_full_path = if inventory_full_path.nil?
|
@@ -69,8 +69,8 @@ module PuppetLitmus::PuppetHelpers
|
|
69
69
|
end
|
70
70
|
|
71
71
|
manifest_file_location = opts[:manifest_file_location] || create_manifest_file(manifest)
|
72
|
-
inventory_hash = File.exist?('
|
73
|
-
raise "Target '#{target_node_name}' not found in
|
72
|
+
inventory_hash = File.exist?('spec/fixtures/litmus_inventory.yaml') ? inventory_hash_from_inventory_file : localhost_inventory_hash
|
73
|
+
raise "Target '#{target_node_name}' not found in spec/fixtures/litmus_inventory.yaml" unless target_in_inventory?(inventory_hash, target_node_name)
|
74
74
|
|
75
75
|
span.add_field('litmus.node_name', target_node_name)
|
76
76
|
add_platform_field(inventory_hash, target_node_name)
|
@@ -213,8 +213,8 @@ module PuppetLitmus::PuppetHelpers
|
|
213
213
|
span.add_field('litmus.opts', opts)
|
214
214
|
|
215
215
|
target_node_name = targeting_localhost? ? 'litmus_localhost' : ENV['TARGET_HOST']
|
216
|
-
inventory_hash = File.exist?('
|
217
|
-
raise "Target '#{target_node_name}' not found in
|
216
|
+
inventory_hash = File.exist?('spec/fixtures/litmus_inventory.yaml') ? inventory_hash_from_inventory_file : localhost_inventory_hash
|
217
|
+
raise "Target '#{target_node_name}' not found in spec/fixtures/litmus_inventory.yaml" unless target_in_inventory?(inventory_hash, target_node_name)
|
218
218
|
|
219
219
|
span.add_field('litmus.node_name', target_node_name)
|
220
220
|
add_platform_field(inventory_hash, target_node_name)
|
@@ -252,8 +252,8 @@ module PuppetLitmus::PuppetHelpers
|
|
252
252
|
span.add_field('litmus.options', options)
|
253
253
|
|
254
254
|
target_node_name = targeting_localhost? ? 'litmus_localhost' : ENV['TARGET_HOST']
|
255
|
-
inventory_hash = File.exist?('
|
256
|
-
raise "Target '#{target_node_name}' not found in
|
255
|
+
inventory_hash = File.exist?('spec/fixtures/litmus_inventory.yaml') ? inventory_hash_from_inventory_file : localhost_inventory_hash
|
256
|
+
raise "Target '#{target_node_name}' not found in spec/fixtures/litmus_inventory.yaml" unless target_in_inventory?(inventory_hash, target_node_name)
|
257
257
|
|
258
258
|
span.add_field('litmus.node_name', target_node_name)
|
259
259
|
add_platform_field(inventory_hash, target_node_name)
|
@@ -306,12 +306,12 @@ module PuppetLitmus::PuppetHelpers
|
|
306
306
|
target_node_name = targeting_localhost? ? 'litmus_localhost' : ENV['TARGET_HOST']
|
307
307
|
inventory_hash = if !opts[:inventory_file].nil? && File.exist?(opts[:inventory_file])
|
308
308
|
inventory_hash_from_inventory_file(opts[:inventory_file])
|
309
|
-
elsif File.exist?('
|
310
|
-
inventory_hash_from_inventory_file('
|
309
|
+
elsif File.exist?('spec/fixtures/litmus_inventory.yaml')
|
310
|
+
inventory_hash_from_inventory_file('spec/fixtures/litmus_inventory.yaml')
|
311
311
|
else
|
312
312
|
localhost_inventory_hash
|
313
313
|
end
|
314
|
-
raise "Target '#{target_node_name}' not found in
|
314
|
+
raise "Target '#{target_node_name}' not found in spec/fixtures/litmus_inventory.yaml" unless target_in_inventory?(inventory_hash, target_node_name)
|
315
315
|
|
316
316
|
span.add_field('litmus.node_name', target_node_name)
|
317
317
|
add_platform_field(inventory_hash, target_node_name)
|
@@ -371,8 +371,8 @@ module PuppetLitmus::PuppetHelpers
|
|
371
371
|
span.add_field('litmus.arguments', arguments)
|
372
372
|
|
373
373
|
target_node_name = targeting_localhost? ? 'litmus_localhost' : ENV['TARGET_HOST']
|
374
|
-
inventory_hash = File.exist?('
|
375
|
-
raise "Target '#{target_node_name}' not found in
|
374
|
+
inventory_hash = File.exist?('spec/fixtures/litmus_inventory.yaml') ? inventory_hash_from_inventory_file : localhost_inventory_hash
|
375
|
+
raise "Target '#{target_node_name}' not found in spec/fixtures/litmus_inventory.yaml" unless target_in_inventory?(inventory_hash, target_node_name)
|
376
376
|
|
377
377
|
span.add_field('litmus.node_name', target_node_name)
|
378
378
|
add_platform_field(inventory_hash, target_node_name)
|
@@ -464,7 +464,7 @@ module PuppetLitmus::RakeHelper
|
|
464
464
|
|
465
465
|
class LitmusTimeoutError < StandardError; end
|
466
466
|
|
467
|
-
def with_retries(options: { tries: Float::INFINITY }, max_wait_minutes:
|
467
|
+
def with_retries(options: { tries: Float::INFINITY }, max_wait_minutes: 15)
|
468
468
|
stop = Time.now + (max_wait_minutes * 60)
|
469
469
|
Retryable.retryable(options.merge(not: [LitmusTimeoutError])) do
|
470
470
|
raise LitmusTimeoutError if Time.now > stop
|
@@ -125,7 +125,7 @@ namespace :litmus do
|
|
125
125
|
|
126
126
|
results = install_agent(args[:collection], targets, inventory_hash)
|
127
127
|
results.each do |result|
|
128
|
-
command_to_run = "bolt task run puppet_agent::install --targets #{result['target']} --inventoryfile
|
128
|
+
command_to_run = "bolt task run puppet_agent::install --targets #{result['target']} --inventoryfile spec/fixtures/litmus_inventory.yaml --modulepath #{DEFAULT_CONFIG_DATA['modulepath']}"
|
129
129
|
raise "Failed on #{result['target']}\n#{result}\ntry running '#{command_to_run}'" if result['status'] != 'success'
|
130
130
|
|
131
131
|
# validate successful install
|
@@ -157,7 +157,7 @@ namespace :litmus do
|
|
157
157
|
end
|
158
158
|
|
159
159
|
# update the inventory with the puppet-agent feature set per node
|
160
|
-
write_to_inventory_file(inventory_hash, '
|
160
|
+
write_to_inventory_file(inventory_hash, 'spec/fixtures/litmus_inventory.yaml')
|
161
161
|
end
|
162
162
|
|
163
163
|
# Add a given feature to a selection of nodes
|
@@ -182,7 +182,7 @@ namespace :litmus do
|
|
182
182
|
inventory_hash = add_feature_to_node(inventory_hash, args[:added_feature], target)
|
183
183
|
end
|
184
184
|
|
185
|
-
write_to_inventory_file(inventory_hash, '
|
185
|
+
write_to_inventory_file(inventory_hash, 'spec/fixtures/litmus_inventory.yaml')
|
186
186
|
|
187
187
|
puts 'Feature added'
|
188
188
|
end
|
@@ -336,7 +336,7 @@ namespace :litmus do
|
|
336
336
|
|
337
337
|
namespace :acceptance do
|
338
338
|
require 'rspec/core/rake_task'
|
339
|
-
if File.file?('
|
339
|
+
if File.file?('spec/fixtures/litmus_inventory.yaml')
|
340
340
|
inventory_hash = inventory_hash_from_inventory_file
|
341
341
|
targets = find_targets(inventory_hash, nil)
|
342
342
|
|
@@ -14,7 +14,7 @@ RSpec.describe PuppetLitmus::PuppetHelpers do
|
|
14
14
|
|
15
15
|
it 'calls all functions' do
|
16
16
|
expect(self).to receive(:create_manifest_file).with(manifest).and_return('/bla.pp')
|
17
|
-
expect(self).to receive(:apply_manifest).with(nil,
|
17
|
+
expect(self).to receive(:apply_manifest).with(nil, catch_failures: true, manifest_file_location: '/bla.pp')
|
18
18
|
expect(self).to receive(:apply_manifest).with(nil, catch_changes: true, manifest_file_location: '/bla.pp')
|
19
19
|
idempotent_apply(manifest)
|
20
20
|
end
|
@@ -24,10 +24,15 @@ RSpec.describe PuppetLitmus::PuppetHelpers do
|
|
24
24
|
context 'when specifying a hiera config' do
|
25
25
|
let(:manifest) { "include '::doot'" }
|
26
26
|
let(:result) { ['value' => { 'exit_code' => 0, 'stdout' => nil, 'stderr' => nil }] }
|
27
|
-
let
|
27
|
+
let :os do
|
28
|
+
{
|
29
|
+
family: 'redhat',
|
30
|
+
}
|
31
|
+
end
|
32
|
+
let(:command) { "LC_ALL=en_US.UTF-8 puppet apply /bla.pp --trace --modulepath #{Dir.pwd}/spec/fixtures/modules --hiera_config='/hiera.yaml'" }
|
28
33
|
|
29
34
|
it 'passes the --hiera_config flag if the :hiera_config opt is specified' do
|
30
|
-
expect(File).to receive(:exist?).with('
|
35
|
+
expect(File).to receive(:exist?).with('spec/fixtures/litmus_inventory.yaml').and_return(false)
|
31
36
|
expect(self).to receive(:target_in_inventory?).and_return(true)
|
32
37
|
expect(self).to receive(:create_manifest_file).with(manifest).and_return('/bla.pp')
|
33
38
|
expect(self).to receive(:run_command).with(command, 'litmus_localhost', config: nil, inventory: localhost_inventory_hash).and_return(result)
|
@@ -38,10 +43,15 @@ RSpec.describe PuppetLitmus::PuppetHelpers do
|
|
38
43
|
context 'when using detailed-exitcodes' do
|
39
44
|
let(:manifest) { "include '::doot'" }
|
40
45
|
let(:result) { ['value' => { 'exit_code' => 0, 'stdout' => nil, 'stderr' => nil }] }
|
41
|
-
let(:command) { "
|
46
|
+
let(:command) { "LC_ALL=en_US.UTF-8 puppet apply /bla.pp --trace --modulepath #{Dir.pwd}/spec/fixtures/modules --detailed-exitcodes" }
|
47
|
+
let :os do
|
48
|
+
{
|
49
|
+
family: 'redhat',
|
50
|
+
}
|
51
|
+
end
|
42
52
|
|
43
53
|
it 'uses detailed-exitcodes with expect_failures' do
|
44
|
-
expect(File).to receive(:exist?).with('
|
54
|
+
expect(File).to receive(:exist?).with('spec/fixtures/litmus_inventory.yaml').and_return(false)
|
45
55
|
expect(self).to receive(:target_in_inventory?).and_return(true)
|
46
56
|
expect(self).to receive(:create_manifest_file).with(manifest).and_return('/bla.pp')
|
47
57
|
expect(self).to receive(:run_command).with(command, 'litmus_localhost', config: nil, inventory: localhost_inventory_hash).and_return(result)
|
@@ -49,7 +59,7 @@ RSpec.describe PuppetLitmus::PuppetHelpers do
|
|
49
59
|
end
|
50
60
|
|
51
61
|
it 'uses detailed-exitcodes with catch_failures' do
|
52
|
-
expect(File).to receive(:exist?).with('
|
62
|
+
expect(File).to receive(:exist?).with('spec/fixtures/litmus_inventory.yaml').and_return(false)
|
53
63
|
expect(self).to receive(:target_in_inventory?).and_return(true)
|
54
64
|
expect(self).to receive(:create_manifest_file).with(manifest).and_return('/bla.pp')
|
55
65
|
expect(self).to receive(:run_command).with(command, 'litmus_localhost', config: nil, inventory: localhost_inventory_hash).and_return(result)
|
@@ -57,7 +67,7 @@ RSpec.describe PuppetLitmus::PuppetHelpers do
|
|
57
67
|
end
|
58
68
|
|
59
69
|
it 'uses detailed-exitcodes with expect_changes' do
|
60
|
-
expect(File).to receive(:exist?).with('
|
70
|
+
expect(File).to receive(:exist?).with('spec/fixtures/litmus_inventory.yaml').and_return(false)
|
61
71
|
expect(self).to receive(:target_in_inventory?).and_return(true)
|
62
72
|
expect(self).to receive(:create_manifest_file).with(manifest).and_return('/bla.pp')
|
63
73
|
expect(self).to receive(:run_command).with(command, 'litmus_localhost', config: nil, inventory: localhost_inventory_hash).and_return(result)
|
@@ -65,7 +75,7 @@ RSpec.describe PuppetLitmus::PuppetHelpers do
|
|
65
75
|
end
|
66
76
|
|
67
77
|
it 'uses detailed-exitcodes with catch_changes' do
|
68
|
-
expect(File).to receive(:exist?).with('
|
78
|
+
expect(File).to receive(:exist?).with('spec/fixtures/litmus_inventory.yaml').and_return(false)
|
69
79
|
expect(self).to receive(:target_in_inventory?).and_return(true)
|
70
80
|
expect(self).to receive(:create_manifest_file).with(manifest).and_return('/bla.pp')
|
71
81
|
expect(self).to receive(:run_command).with(command, 'litmus_localhost', config: nil, inventory: localhost_inventory_hash).and_return(result)
|
@@ -90,7 +100,7 @@ RSpec.describe PuppetLitmus::PuppetHelpers do
|
|
90
100
|
context 'when running against localhost and no inventory.yaml file' do
|
91
101
|
it 'does run_shell against localhost without error' do
|
92
102
|
stub_const('ENV', ENV.to_hash.merge('TARGET_HOST' => 'localhost'))
|
93
|
-
expect(File).to receive(:exist?).with('
|
103
|
+
expect(File).to receive(:exist?).with('spec/fixtures/litmus_inventory.yaml').and_return(false)
|
94
104
|
expect(self).to receive(:target_in_inventory?).and_return(true)
|
95
105
|
expect(self).to receive(:run_command).with(command_to_run, 'litmus_localhost', config: nil, inventory: localhost_inventory_hash).and_return(result)
|
96
106
|
expect { run_shell(command_to_run) }.not_to raise_error
|
@@ -100,7 +110,7 @@ RSpec.describe PuppetLitmus::PuppetHelpers do
|
|
100
110
|
context 'when running against remote host' do
|
101
111
|
it 'does run_shell against remote host without error' do
|
102
112
|
stub_const('ENV', ENV.to_hash.merge('TARGET_HOST' => 'some.host'))
|
103
|
-
expect(File).to receive(:exist?).with('
|
113
|
+
expect(File).to receive(:exist?).with('spec/fixtures/litmus_inventory.yaml').and_return(true)
|
104
114
|
expect(self).to receive(:inventory_hash_from_inventory_file).and_return(inventory_hash)
|
105
115
|
expect(self).to receive(:target_in_inventory?).and_return(true)
|
106
116
|
expect(self).to receive(:run_command).with(command_to_run, 'some.host', config: nil, inventory: inventory_hash).and_return(result)
|
@@ -125,7 +135,7 @@ RSpec.describe PuppetLitmus::PuppetHelpers do
|
|
125
135
|
context 'when upload returns success' do
|
126
136
|
it 'does upload_file against remote host without error' do
|
127
137
|
stub_const('ENV', ENV.to_hash.merge('TARGET_HOST' => 'some.host'))
|
128
|
-
expect(File).to receive(:exist?).with('
|
138
|
+
expect(File).to receive(:exist?).with('spec/fixtures/litmus_inventory.yaml').and_return(true)
|
129
139
|
expect(self).to receive(:inventory_hash_from_inventory_file).and_return(inventory_hash)
|
130
140
|
expect(self).to receive(:target_in_inventory?).and_return(true)
|
131
141
|
expect(self).to receive(:upload_file).with(local, remote, 'some.host', options: {}, config: nil, inventory: inventory_hash).and_return(result_success)
|
@@ -134,7 +144,7 @@ RSpec.describe PuppetLitmus::PuppetHelpers do
|
|
134
144
|
|
135
145
|
it 'does upload_file against localhost without error' do
|
136
146
|
stub_const('ENV', ENV.to_hash.merge('TARGET_HOST' => 'localhost'))
|
137
|
-
expect(File).to receive(:exist?).with('
|
147
|
+
expect(File).to receive(:exist?).with('spec/fixtures/litmus_inventory.yaml').and_return(false)
|
138
148
|
expect(self).not_to receive(:inventory_hash_from_inventory_file)
|
139
149
|
expect(self).to receive(:target_in_inventory?).and_return(true)
|
140
150
|
expect(self).to receive(:upload_file).with(local, remote, 'litmus_localhost', options: {}, config: nil, inventory: localhost_inventory_hash).and_return(result_success)
|
@@ -145,7 +155,7 @@ RSpec.describe PuppetLitmus::PuppetHelpers do
|
|
145
155
|
context 'when upload returns failure' do
|
146
156
|
it 'does upload_file gives runtime error for failure' do
|
147
157
|
stub_const('ENV', ENV.to_hash.merge('TARGET_HOST' => 'some.host'))
|
148
|
-
expect(File).to receive(:exist?).with('
|
158
|
+
expect(File).to receive(:exist?).with('spec/fixtures/litmus_inventory.yaml').and_return(true)
|
149
159
|
expect(self).to receive(:inventory_hash_from_inventory_file).and_return(inventory_hash)
|
150
160
|
expect(self).to receive(:target_in_inventory?).and_return(true)
|
151
161
|
expect(self).to receive(:upload_file).with(local, remote, 'some.host', options: {}, config: nil, inventory: inventory_hash).and_return(result_failure)
|
@@ -154,7 +164,7 @@ RSpec.describe PuppetLitmus::PuppetHelpers do
|
|
154
164
|
|
155
165
|
it 'returns the exit code and error message when expecting failure' do
|
156
166
|
stub_const('ENV', ENV.to_hash.merge('TARGET_HOST' => 'some.host'))
|
157
|
-
expect(File).to receive(:exist?).with('
|
167
|
+
expect(File).to receive(:exist?).with('spec/fixtures/litmus_inventory.yaml').and_return(true)
|
158
168
|
expect(self).to receive(:inventory_hash_from_inventory_file).and_return(inventory_hash)
|
159
169
|
expect(self).to receive(:target_in_inventory?).and_return(true)
|
160
170
|
expect(self).to receive(:upload_file).with(local, remote, 'some.host', options: {}, config: nil, inventory: inventory_hash).and_return(result_failure)
|
@@ -176,7 +186,7 @@ RSpec.describe PuppetLitmus::PuppetHelpers do
|
|
176
186
|
context 'when running against localhost and no inventory.yaml file' do
|
177
187
|
it 'does bolt_run_script against localhost without error' do
|
178
188
|
stub_const('ENV', ENV.to_hash.merge('TARGET_HOST' => 'localhost'))
|
179
|
-
expect(File).to receive(:exist?).with('
|
189
|
+
expect(File).to receive(:exist?).with('spec/fixtures/litmus_inventory.yaml').and_return(false)
|
180
190
|
expect(self).not_to receive(:inventory_hash_from_inventory_file)
|
181
191
|
expect(self).to receive(:target_in_inventory?).and_return(true)
|
182
192
|
expect(self).to receive(:run_script).with(script, 'litmus_localhost', [], options: {}, config: nil, inventory: localhost_inventory_hash).and_return(result)
|
@@ -187,7 +197,7 @@ RSpec.describe PuppetLitmus::PuppetHelpers do
|
|
187
197
|
context 'when running against remote host' do
|
188
198
|
it 'does bolt_run_script against remote host without error' do
|
189
199
|
stub_const('ENV', ENV.to_hash.merge('TARGET_HOST' => 'some.host'))
|
190
|
-
expect(File).to receive(:exist?).with('
|
200
|
+
expect(File).to receive(:exist?).with('spec/fixtures/litmus_inventory.yaml').and_return(true)
|
191
201
|
expect(self).to receive(:inventory_hash_from_inventory_file).and_return(inventory_hash)
|
192
202
|
expect(self).to receive(:target_in_inventory?).and_return(true)
|
193
203
|
expect(self).to receive(:run_script).with(script, 'some.host', [], options: {}, config: nil, inventory: inventory_hash).and_return(result)
|
@@ -198,7 +208,7 @@ RSpec.describe PuppetLitmus::PuppetHelpers do
|
|
198
208
|
context 'when running with arguments' do
|
199
209
|
it 'does bolt_run_script with arguments without error' do
|
200
210
|
stub_const('ENV', ENV.to_hash.merge('TARGET_HOST' => 'localhost'))
|
201
|
-
expect(File).to receive(:exist?).with('
|
211
|
+
expect(File).to receive(:exist?).with('spec/fixtures/litmus_inventory.yaml').and_return(false)
|
202
212
|
expect(self).not_to receive(:inventory_hash_from_inventory_file)
|
203
213
|
expect(self).to receive(:target_in_inventory?).and_return(true)
|
204
214
|
expect(self).to receive(:run_script).with(script, 'litmus_localhost', ['doot'], options: {}, config: nil, inventory: localhost_inventory_hash).and_return(result)
|
@@ -225,7 +235,7 @@ RSpec.describe PuppetLitmus::PuppetHelpers do
|
|
225
235
|
context 'when bolt returns success' do
|
226
236
|
it 'does bolt_task_run gives no runtime error for success' do
|
227
237
|
stub_const('ENV', ENV.to_hash.merge('TARGET_HOST' => 'some.host'))
|
228
|
-
expect(File).to receive(:exist?).with('
|
238
|
+
expect(File).to receive(:exist?).with('spec/fixtures/litmus_inventory.yaml').and_return(true)
|
229
239
|
expect(self).to receive(:inventory_hash_from_inventory_file).and_return(inventory_hash)
|
230
240
|
expect(self).to receive(:target_in_inventory?).and_return(true)
|
231
241
|
expect(self).to receive(:run_task).with(task_name, 'some.host', params, config: config_data, inventory: inventory_hash).and_return(result_unstructured_task_success)
|
@@ -243,7 +253,7 @@ RSpec.describe PuppetLitmus::PuppetHelpers do
|
|
243
253
|
|
244
254
|
it 'returns stdout for unstructured-data tasks' do
|
245
255
|
stub_const('ENV', ENV.to_hash.merge('TARGET_HOST' => 'some.host'))
|
246
|
-
expect(File).to receive(:exist?).with('
|
256
|
+
expect(File).to receive(:exist?).with('spec/fixtures/litmus_inventory.yaml').and_return(true)
|
247
257
|
expect(self).to receive(:inventory_hash_from_inventory_file).and_return(inventory_hash)
|
248
258
|
expect(self).to receive(:target_in_inventory?).and_return(true)
|
249
259
|
expect(self).to receive(:run_task).with(task_name, 'some.host', params, config: config_data, inventory: inventory_hash).and_return(result_unstructured_task_success)
|
@@ -253,7 +263,7 @@ RSpec.describe PuppetLitmus::PuppetHelpers do
|
|
253
263
|
|
254
264
|
it 'returns structured output for structured-data tasks' do
|
255
265
|
stub_const('ENV', ENV.to_hash.merge('TARGET_HOST' => 'some.host'))
|
256
|
-
expect(File).to receive(:exist?).with('
|
266
|
+
expect(File).to receive(:exist?).with('spec/fixtures/litmus_inventory.yaml').and_return(true)
|
257
267
|
expect(self).to receive(:inventory_hash_from_inventory_file).and_return(inventory_hash)
|
258
268
|
expect(self).to receive(:target_in_inventory?).and_return(true)
|
259
269
|
expect(self).to receive(:run_task).with(task_name, 'some.host', params, config: config_data, inventory: inventory_hash).and_return(result_structured_task_success)
|
@@ -267,7 +277,7 @@ RSpec.describe PuppetLitmus::PuppetHelpers do
|
|
267
277
|
context 'when bolt returns failure' do
|
268
278
|
it 'does bolt_task_run gives runtime error for failure' do
|
269
279
|
stub_const('ENV', ENV.to_hash.merge('TARGET_HOST' => 'some.host'))
|
270
|
-
expect(File).to receive(:exist?).with('
|
280
|
+
expect(File).to receive(:exist?).with('spec/fixtures/litmus_inventory.yaml').and_return(true)
|
271
281
|
expect(self).to receive(:inventory_hash_from_inventory_file).and_return(inventory_hash)
|
272
282
|
expect(self).to receive(:target_in_inventory?).and_return(true)
|
273
283
|
expect(self).to receive(:run_task).with(task_name, 'some.host', params, config: config_data, inventory: inventory_hash).and_return(result_failure)
|
@@ -276,7 +286,7 @@ RSpec.describe PuppetLitmus::PuppetHelpers do
|
|
276
286
|
|
277
287
|
it 'returns the exit code and error message when expecting failure' do
|
278
288
|
stub_const('ENV', ENV.to_hash.merge('TARGET_HOST' => 'some.host'))
|
279
|
-
expect(File).to receive(:exist?).with('
|
289
|
+
expect(File).to receive(:exist?).with('spec/fixtures/litmus_inventory.yaml').and_return(true)
|
280
290
|
expect(self).to receive(:inventory_hash_from_inventory_file).and_return(inventory_hash)
|
281
291
|
expect(self).to receive(:target_in_inventory?).and_return(true)
|
282
292
|
expect(self).to receive(:run_task).with(task_name, 'some.host', params, config: config_data, inventory: inventory_hash).and_return(result_failure)
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: puppet_litmus
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.
|
4
|
+
version: 0.28.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Puppet, Inc.
|
8
|
-
autorequire:
|
8
|
+
autorequire:
|
9
9
|
bindir: exe
|
10
10
|
cert_chain: []
|
11
|
-
date: 2021-
|
11
|
+
date: 2021-07-29 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: bolt
|
@@ -19,7 +19,7 @@ dependencies:
|
|
19
19
|
version: 2.0.1
|
20
20
|
- - "<"
|
21
21
|
- !ruby/object:Gem::Version
|
22
|
-
version:
|
22
|
+
version: 4.0.0
|
23
23
|
type: :runtime
|
24
24
|
prerelease: false
|
25
25
|
version_requirements: !ruby/object:Gem::Requirement
|
@@ -29,7 +29,7 @@ dependencies:
|
|
29
29
|
version: 2.0.1
|
30
30
|
- - "<"
|
31
31
|
- !ruby/object:Gem::Version
|
32
|
-
version:
|
32
|
+
version: 4.0.0
|
33
33
|
- !ruby/object:Gem::Dependency
|
34
34
|
name: puppet-modulebuilder
|
35
35
|
requirement: !ruby/object:Gem::Requirement
|
@@ -196,7 +196,7 @@ homepage: https://github.com/puppetlabs/puppet_litmus
|
|
196
196
|
licenses:
|
197
197
|
- Apache-2.0
|
198
198
|
metadata: {}
|
199
|
-
post_install_message:
|
199
|
+
post_install_message:
|
200
200
|
rdoc_options: []
|
201
201
|
require_paths:
|
202
202
|
- lib
|
@@ -211,8 +211,8 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
211
211
|
- !ruby/object:Gem::Version
|
212
212
|
version: '0'
|
213
213
|
requirements: []
|
214
|
-
rubygems_version: 3.
|
215
|
-
signing_key:
|
214
|
+
rubygems_version: 3.0.3
|
215
|
+
signing_key:
|
216
216
|
specification_version: 4
|
217
217
|
summary: Providing a simple command line tool for puppet content creators, to enable
|
218
218
|
simple and complex test deployments.
|