cem_acpt 0.10.4 → 0.10.5
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/Gemfile.lock +1 -1
- data/lib/cem_acpt/bolt/cmd/output.rb +1 -0
- data/lib/cem_acpt/bolt/tests.rb +3 -3
- data/lib/cem_acpt/bolt/yaml_file.rb +6 -0
- data/lib/cem_acpt/test_runner/log_formatter/bolt_summary_results_formatter.rb +36 -19
- data/lib/cem_acpt/test_runner.rb +5 -3
- data/lib/cem_acpt/version.rb +1 -1
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: dc299de4494abd1da48700f76b43223cb05aae1cb8c26235757e31e909bd6c2f
|
4
|
+
data.tar.gz: 32948e52808bd436695d69cf0c0bf2c5ccd31ada90ed401341c9c73e00653c6b
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 2a916fec7be6263243deeb60eac717ac097e0c477359b8abe71c374ef68880ab1608ff48859339074d97e8ae4592b9da491b5ff76b61f842a60712a9efcd1f75
|
7
|
+
data.tar.gz: e4e3b465b224f8f1431867ae19b6bee5161a91248168fd8e0c8c221c6ffa2c6caf3e2bf45a2a54e139e02069e45bc1dc7beacbddbe7fa11c15bf269811c98c54
|
data/Gemfile.lock
CHANGED
@@ -127,6 +127,7 @@ module CemAcpt
|
|
127
127
|
end
|
128
128
|
ensure
|
129
129
|
@items = (@cmd_output['items'] || []).map { |item| OutputItem.new(item) }
|
130
|
+
@error_obj ||= @items.find(&:error?)&.error
|
130
131
|
if @items.empty? && @error_obj.nil? && @strict
|
131
132
|
err = RuntimeError.new("Cannot set results, no error or items found for cmd_output:\n#{cmd_output}")
|
132
133
|
@error_obj = err
|
data/lib/cem_acpt/bolt/tests.rb
CHANGED
@@ -158,11 +158,11 @@ module CemAcpt
|
|
158
158
|
end
|
159
159
|
|
160
160
|
def error?
|
161
|
-
@command_result.
|
161
|
+
@command_result.error?
|
162
162
|
end
|
163
163
|
|
164
164
|
def error
|
165
|
-
@command_result if error?
|
165
|
+
@command_result.error if error?
|
166
166
|
end
|
167
167
|
|
168
168
|
def to_h
|
@@ -378,7 +378,7 @@ module CemAcpt
|
|
378
378
|
def load_test_data(run_data)
|
379
379
|
run_data[:test_data].each_with_object({}) do |tdata, h|
|
380
380
|
test_name = tdata[:test_name]
|
381
|
-
next if h.key?(test_name)
|
381
|
+
next if h.key?(test_name)
|
382
382
|
|
383
383
|
logger.debug('CemAcpt::Bolt::Tests') { "Loading test data for test #{test_name}" }
|
384
384
|
begin
|
@@ -53,6 +53,8 @@ module CemAcpt
|
|
53
53
|
return false unless File.exist?(path)
|
54
54
|
|
55
55
|
disk_contents = CemAcpt::Utils::Files.read(path, log_prefix: self.class.to_s)
|
56
|
+
return false unless disk_contents.is_a?(Hash)
|
57
|
+
|
56
58
|
@hash.sort.to_h == disk_contents.sort.to_h
|
57
59
|
end
|
58
60
|
|
@@ -60,6 +62,8 @@ module CemAcpt
|
|
60
62
|
return false unless File.exist?(path)
|
61
63
|
|
62
64
|
disk_contents = CemAcpt::Utils::Files.read(path, log_prefix: self.class.to_s)
|
65
|
+
return false unless disk_contents.is_a?(Hash)
|
66
|
+
|
63
67
|
@hash.sort.to_h >= disk_contents.sort.to_h
|
64
68
|
end
|
65
69
|
|
@@ -67,6 +71,8 @@ module CemAcpt
|
|
67
71
|
return false unless File.exist?(path)
|
68
72
|
|
69
73
|
disk_contents = CemAcpt::Utils::Files.read(path, log_prefix: self.class.to_s)
|
74
|
+
return false unless disk_contents.is_a?(Hash)
|
75
|
+
|
70
76
|
@hash.sort.to_h <= disk_contents.sort.to_h
|
71
77
|
end
|
72
78
|
end
|
@@ -26,25 +26,7 @@ module CemAcpt
|
|
26
26
|
super(response)
|
27
27
|
log_subject.each_with_object([]) do |res, ary|
|
28
28
|
res.results.each do |r|
|
29
|
-
|
30
|
-
"#{success_str(r.success?).capitalize}: #{r.name}",
|
31
|
-
"action: #{r.action}",
|
32
|
-
"target: #{name_from_ip(r.target)}",
|
33
|
-
"object: #{r.object}",
|
34
|
-
"status: #{r.status}",
|
35
|
-
]
|
36
|
-
parts = [
|
37
|
-
header.join(', '),
|
38
|
-
"validation results:\n#{JSON.pretty_generate(r.failed_validation_results)}",
|
39
|
-
]
|
40
|
-
if CemAcpt::Logging.verbose?
|
41
|
-
parts << "command result:\n#{JSON.pretty_generate(r.command_result.to_h)}"
|
42
|
-
end
|
43
|
-
parts << r.error if r.error?
|
44
|
-
if r.respond_to?(:details) && !r.details&.empty?
|
45
|
-
parts << "details:\n#{JSON.pretty_generate(r.details)}\n"
|
46
|
-
end
|
47
|
-
ary << parts.join("\n")
|
29
|
+
ary << (r.error? ? format_error_result(r) : format_result(r))
|
48
30
|
end
|
49
31
|
end
|
50
32
|
end
|
@@ -58,6 +40,41 @@ module CemAcpt
|
|
58
40
|
super(response)
|
59
41
|
'Bolt tests'
|
60
42
|
end
|
43
|
+
|
44
|
+
private
|
45
|
+
|
46
|
+
def result_header(r)
|
47
|
+
[
|
48
|
+
"#{success_str(r.success?).capitalize}: #{r.name}",
|
49
|
+
"action: #{r.action}",
|
50
|
+
"target: #{name_from_ip(r.target)}",
|
51
|
+
"object: #{r.object}",
|
52
|
+
"status: #{r.status}",
|
53
|
+
].join(', ')
|
54
|
+
end
|
55
|
+
|
56
|
+
def format_result(r)
|
57
|
+
parts = [
|
58
|
+
result_header(r),
|
59
|
+
"validation results:\n#{JSON.pretty_generate(r.failed_validation_results)}",
|
60
|
+
]
|
61
|
+
if CemAcpt::Logging.verbose?
|
62
|
+
parts << "command result:\n#{JSON.pretty_generate(r.command_result.to_h)}"
|
63
|
+
end
|
64
|
+
if r.respond_to?(:details) && !r.details&.empty?
|
65
|
+
parts << "details:\n#{JSON.pretty_generate(r.details)}\n"
|
66
|
+
end
|
67
|
+
parts.join("\n")
|
68
|
+
end
|
69
|
+
|
70
|
+
def format_error_result(r)
|
71
|
+
[
|
72
|
+
result_header(r),
|
73
|
+
"error: #{r.error.kind}",
|
74
|
+
"issue code: #{r.error.issue_code}",
|
75
|
+
r.error.msg,
|
76
|
+
].join("\n")
|
77
|
+
end
|
61
78
|
end
|
62
79
|
end
|
63
80
|
end
|
data/lib/cem_acpt/test_runner.rb
CHANGED
@@ -186,7 +186,7 @@ module CemAcpt
|
|
186
186
|
@run_data[:nodes] = new_node_data
|
187
187
|
logger.verbose('CemAcpt::TestRunner') { "Initial run data:\n#{@run_data}" }
|
188
188
|
logger.info('CemAcpt::TestRunner') { 'Created initial run data...' }
|
189
|
-
setup_bolt if CemAcpt::Actions.config.action_names.include?(
|
189
|
+
setup_bolt if CemAcpt::Actions.config.action_names.include?(:bolt)
|
190
190
|
end
|
191
191
|
|
192
192
|
def setup_bolt
|
@@ -197,12 +197,12 @@ module CemAcpt
|
|
197
197
|
rescue CemAcpt::ShellCommandNotFoundError => e
|
198
198
|
logger.warning('CemAcpt::TestRunner') { e.message }
|
199
199
|
logger.warning('CemAcpt::TestRunner') { 'Adding Bolt action to ignore list...' }
|
200
|
-
CemAcpt::Actions.config.ignore <<
|
200
|
+
CemAcpt::Actions.config.ignore << :bolt
|
201
201
|
return
|
202
202
|
end
|
203
203
|
return unless @bolt_test_runner.tests.to_a.empty?
|
204
204
|
|
205
|
-
if !CemAcpt::Actions.config.only.empty? && CemAcpt::Actions.config.only.include?(
|
205
|
+
if !CemAcpt::Actions.config.only.empty? && CemAcpt::Actions.config.only.include?(:bolt)
|
206
206
|
raise 'No Bolt tests to run and only bolt action was specified'
|
207
207
|
end
|
208
208
|
|
@@ -348,6 +348,8 @@ module CemAcpt
|
|
348
348
|
logger.info { r }
|
349
349
|
else
|
350
350
|
logger.error { r }
|
351
|
+
next unless result.respond_to?(:metadata) && result.metadata.key?(:run_logs)
|
352
|
+
|
351
353
|
logs = if config.debug? && !config.get('puppet.no_debug')
|
352
354
|
result.metadata[:run_logs]&.dup
|
353
355
|
else
|
data/lib/cem_acpt/version.rb
CHANGED
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: cem_acpt
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.10.
|
4
|
+
version: 0.10.5
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- puppetlabs
|
8
8
|
autorequire:
|
9
9
|
bindir: exe
|
10
10
|
cert_chain: []
|
11
|
-
date: 2024-
|
11
|
+
date: 2024-10-01 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: async-http
|