Skip to content

Commit 27284b7

Browse files
authored
new step added (#205)
1 parent feddf1c commit 27284b7

File tree

2 files changed

+29
-6
lines changed

2 files changed

+29
-6
lines changed

features/cpu_metrics.feature

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -13,14 +13,14 @@ Feature: CPU Metrics
1313
* the trace payload field "resourceSpans.0.scopeSpans.0.spans.0" boolean attribute "bugsnag.span.first_class" is true
1414

1515
* the trace payload field "resourceSpans.0.scopeSpans.0.spans.0.attributes.4.key" equals "bugsnag.system.cpu_measures_timestamps"
16-
* the trace payload field "resourceSpans.0.scopeSpans.0.spans.0.attributes.4.value.arrayValue.values" is an array with 5 elements
16+
* the trace payload field "resourceSpans.0.scopeSpans.0.spans.0.attributes.4.value.arrayValue.values" is an array with at least 5 elements
1717

1818
* the trace payload field "resourceSpans.0.scopeSpans.0.spans.0.attributes.5.key" equals "bugsnag.system.cpu_measures_total"
19-
* the trace payload field "resourceSpans.0.scopeSpans.0.spans.0.attributes.5.value.arrayValue.values" is an array with 5 elements
19+
* the trace payload field "resourceSpans.0.scopeSpans.0.spans.0.attributes.5.value.arrayValue.values" is an array with at least 5 elements
2020
* the trace payload field "resourceSpans.0.scopeSpans.0.spans.0" double array attribute "bugsnag.system.cpu_measures_total" contains valid percentages
2121

2222
* the trace payload field "resourceSpans.0.scopeSpans.0.spans.0.attributes.6.key" equals "bugsnag.system.cpu_measures_main_thread"
23-
* the trace payload field "resourceSpans.0.scopeSpans.0.spans.0.attributes.6.value.arrayValue.values" is an array with 5 elements
23+
* the trace payload field "resourceSpans.0.scopeSpans.0.spans.0.attributes.6.value.arrayValue.values" is an array with at least 5 elements
2424
* the trace payload field "resourceSpans.0.scopeSpans.0.spans.0" double array attribute "bugsnag.system.cpu_measures_main_thread" contains valid percentages
2525

2626
* the trace payload field "resourceSpans.0.scopeSpans.0.spans.0" double attribute "bugsnag.system.cpu_mean_total" is a valid percentage
@@ -37,14 +37,14 @@ Feature: CPU Metrics
3737
* the trace payload field "resourceSpans.0.scopeSpans.0.spans.0" boolean attribute "bugsnag.span.first_class" is true
3838

3939
* the trace payload field "resourceSpans.0.scopeSpans.0.spans.0.attributes.4.key" equals "bugsnag.system.cpu_measures_timestamps"
40-
* the trace payload field "resourceSpans.0.scopeSpans.0.spans.0.attributes.4.value.arrayValue.values" is an array with 5 elements
40+
* the trace payload field "resourceSpans.0.scopeSpans.0.spans.0.attributes.4.value.arrayValue.values" is an array with at least 5 elements
4141

4242
* the trace payload field "resourceSpans.0.scopeSpans.0.spans.0.attributes.5.key" equals "bugsnag.system.cpu_measures_total"
43-
* the trace payload field "resourceSpans.0.scopeSpans.0.spans.0.attributes.5.value.arrayValue.values" is an array with 5 elements
43+
* the trace payload field "resourceSpans.0.scopeSpans.0.spans.0.attributes.5.value.arrayValue.values" is an array with at least 5 elements
4444
* the trace payload field "resourceSpans.0.scopeSpans.0.spans.0" double array attribute "bugsnag.system.cpu_measures_total" contains valid percentages
4545

4646
* the trace payload field "resourceSpans.0.scopeSpans.0.spans.0.attributes.6.key" equals "bugsnag.system.cpu_measures_main_thread"
47-
* the trace payload field "resourceSpans.0.scopeSpans.0.spans.0.attributes.6.value.arrayValue.values" is an array with 5 elements
47+
* the trace payload field "resourceSpans.0.scopeSpans.0.spans.0.attributes.6.value.arrayValue.values" is an array with at least 5 elements
4848
* the trace payload field "resourceSpans.0.scopeSpans.0.spans.0" double array attribute "bugsnag.system.cpu_measures_main_thread" contains valid percentages
4949

5050
* the trace payload field "resourceSpans.0.scopeSpans.0.spans.0" double attribute "bugsnag.system.cpu_mean_total" is a valid percentage

features/steps/unity_steps.rb

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -275,3 +275,26 @@ def check_valid_percentage(value, field_name, attribute_name, request_type)
275275
check_valid_percentage(float_value, field_name, attribute_name, request_type)
276276
end
277277
end
278+
279+
When('the {request_type} payload field {string} is an array with at least {int} elements') do |request_type, field_name, min_count|
280+
list = Maze::Server.list_for(request_type)
281+
array_value = Maze::Helper.read_key_path(list.current[:body], field_name)
282+
283+
Maze.check.not_nil(
284+
array_value,
285+
"Field '#{field_name}' not found in request type '#{request_type}'"
286+
)
287+
288+
Maze.check.true(
289+
array_value.is_a?(Array),
290+
"Field '#{field_name}' is not an array in request type '#{request_type}', got: #{array_value.class}"
291+
)
292+
293+
actual_count = array_value.length
294+
Maze.check.operator(
295+
actual_count,
296+
:>=,
297+
min_count,
298+
"Expected '#{field_name}' to have at least #{min_count} elements in request type '#{request_type}', but got #{actual_count}"
299+
)
300+
end

0 commit comments

Comments
 (0)