Skip to content

Commit 459bdfe

Browse files
committed
(PE-38408) Add new metrics to PDB integration test
This updates the PDB integration acceptance test with the new metrics brought in first by acd44da. It also fixes an incorrect invocation of Enumerable#find that only errs when it cannot find some metrics.
1 parent c97cf15 commit 459bdfe

File tree

1 file changed

+18
-7
lines changed

1 file changed

+18
-7
lines changed

acceptance/suites/tests/00_smoke/puppetdb_integration.rb

Lines changed: 18 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -116,15 +116,26 @@
116116
# name passed to Puppet::Util::Profiler.profile over in the Ruby
117117
# terminus code of the PuppetDB project without realizing that is a
118118
# breaking change to metrics critical for measuring compiler performance.
119-
%w[
120-
facts_encode command_submit_replace_facts
121-
catalog_munge command_submit_replace_catalog
122-
report_convert_to_wire_format_hash command_submit_store_report
123-
resource_search query
119+
[
120+
"query",
121+
"resource_search",
122+
"facts_find",
123+
"catalog_save",
124+
"facts_save",
125+
"command_submit_replace_catalog",
126+
"command_submit_replace_facts",
127+
"report_process",
128+
"command_submit_store_report",
129+
"payload_format",
130+
"facts_encode",
131+
"catalog_munge",
132+
"report_convert_to_wire_format_hash"
124133
].each do |metric_name|
125-
metric_data = pdb_metrics.find({}) {|m| m['metric'] == metric_name }
134+
metric_data = pdb_metrics.find {|m| m['metric'] == metric_name } || {}
126135

127-
assert_operator(metric_data.fetch('count', 0), :>, 0,
136+
metric_count = metric_data.fetch('count', 0)
137+
logger.debug("PuppetDB metrics #{metric_name} recorded #{metric_count} times")
138+
assert_operator(metric_count, :>, 0,
128139
"PuppetDB metrics recorded for: #{metric_name}")
129140
end
130141
end

0 commit comments

Comments
 (0)