diff --git a/CHANGELOG.md b/CHANGELOG.md index 2cd0fa3fe..fcf948dfc 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,3 +1,9 @@ +# 9.11.0 - 2024/07/05 + +## Enhancements + +- add support for comparing double and array attributes in spans [661](https://github.com/bugsnag/maze-runner/pull/661) + # 9.10.0 - 2024/07/02 ## Enhancements diff --git a/Gemfile.lock b/Gemfile.lock deleted file mode 100644 index b73434c2a..000000000 --- a/Gemfile.lock +++ /dev/null @@ -1,198 +0,0 @@ -GIT - remote: https://github.com/bugsnag/yard-cucumber - revision: 4e01273cf2ac197da487a9267e2a5f3d769c27db - specs: - yard-cucumber (4.0.0) - cucumber (>= 2.0, < 9.0) - yard (~> 0.9.20, >= 0.9.20) - -PATH - remote: . - specs: - bugsnag-maze-runner (9.10.0) - appium_lib (~> 12.0.0) - appium_lib_core (~> 5.4.0) - bugsnag (~> 6.24) - cucumber (~> 7.1) - cucumber-expressions (~> 6.0.0) - curb (~> 0.9.6) - dogstatsd-ruby (~> 5.5.0) - json_schemer (~> 0.2.24) - optimist (~> 3.0.1) - os (~> 1.0.0) - rack (~> 2.2) - rake (~> 12.3.3) - rubyzip (~> 2.3.2) - selenium-webdriver (~> 4.0) - test-unit (~> 3.5.2) - webrick (~> 1.7.0) - -GEM - remote: https://rubygems.org/ - specs: - activesupport (7.1.3.4) - base64 - bigdecimal - concurrent-ruby (~> 1.0, >= 1.0.2) - connection_pool (>= 2.2.5) - drb - i18n (>= 1.6, < 2) - minitest (>= 5.1) - mutex_m - tzinfo (~> 2.0) - appium_lib (12.0.1) - appium_lib_core (~> 5.0) - nokogiri (~> 1.8, >= 1.8.1) - tomlrb (>= 1.1, < 3.0) - appium_lib_core (5.4.0) - faye-websocket (~> 0.11.0) - selenium-webdriver (~> 4.2, < 4.6) - base64 (0.2.0) - bigdecimal (3.1.8) - bugsnag (6.27.1) - concurrent-ruby (~> 1.0) - builder (3.3.0) - childprocess (4.1.0) - concurrent-ruby (1.3.3) - connection_pool (2.4.1) - csv (3.3.0) - cucumber (7.1.0) - builder (~> 3.2, >= 3.2.4) - cucumber-core (~> 10.1, >= 10.1.0) - cucumber-create-meta (~> 6.0, >= 6.0.1) - cucumber-cucumber-expressions (~> 14.0, >= 14.0.0) - cucumber-gherkin (~> 22.0, >= 22.0.0) - cucumber-html-formatter (~> 17.0, >= 17.0.0) - cucumber-messages (~> 17.1, >= 17.1.1) - cucumber-wire (~> 6.2, >= 6.2.0) - diff-lcs (~> 1.4, >= 1.4.4) - mime-types (~> 3.3, >= 3.3.1) - multi_test (~> 0.1, >= 0.1.2) - sys-uname (~> 1.2, >= 1.2.2) - cucumber-core (10.1.1) - cucumber-gherkin (~> 22.0, >= 22.0.0) - cucumber-messages (~> 17.1, >= 17.1.1) - cucumber-tag-expressions (~> 4.1, >= 4.1.0) - cucumber-create-meta (6.0.4) - cucumber-messages (~> 17.1, >= 17.1.1) - sys-uname (~> 1.2, >= 1.2.2) - cucumber-cucumber-expressions (14.0.0) - cucumber-expressions (6.0.1) - cucumber-gherkin (22.0.0) - cucumber-messages (~> 17.1, >= 17.1.1) - cucumber-html-formatter (17.0.0) - cucumber-messages (~> 17.1, >= 17.1.0) - cucumber-messages (17.1.1) - cucumber-tag-expressions (4.1.0) - cucumber-wire (6.2.1) - cucumber-core (~> 10.1, >= 10.1.0) - cucumber-cucumber-expressions (~> 14.0, >= 14.0.0) - curb (0.9.11) - diff-lcs (1.5.1) - dogstatsd-ruby (5.5.0) - drb (2.2.1) - ecma-re-validator (0.4.0) - regexp_parser (~> 2.2) - eventmachine (1.2.7) - faye-websocket (0.11.3) - eventmachine (>= 0.12.0) - websocket-driver (>= 0.5.1) - ffi (1.16.3) - hana (1.3.7) - i18n (1.14.5) - concurrent-ruby (~> 1.0) - iniparser (1.0.1) - json_schemer (0.2.25) - ecma-re-validator (~> 0.3) - hana (~> 1.3) - regexp_parser (~> 2.0) - simpleidn (~> 0.2) - uri_template (~> 0.7) - kramdown (2.4.0) - rexml - license_finder (7.2.1) - bundler - csv (~> 3.2) - rubyzip (>= 1, < 3) - thor (~> 1.2) - tomlrb (>= 1.3, < 2.1) - with_env (= 1.1.0) - xml-simple (~> 1.1.9) - logutils (0.6.1) - markdown (1.2.0) - kramdown (>= 1.5.0) - props (>= 1.1.2) - textutils (>= 0.10.0) - mime-types (3.5.2) - mime-types-data (~> 3.2015) - mime-types-data (3.2024.0604) - mini_portile2 (2.8.7) - minitest (5.24.0) - mocha (1.13.0) - multi_test (0.1.2) - mutex_m (0.2.0) - nokogiri (1.15.6) - mini_portile2 (~> 2.8.2) - racc (~> 1.4) - optimist (3.0.1) - os (1.0.1) - power_assert (2.0.3) - props (1.2.0) - iniparser (>= 0.1.0) - racc (1.8.0) - rack (2.2.9) - rake (12.3.3) - redcarpet (3.6.0) - regexp_parser (2.9.2) - rexml (3.3.0) - strscan - rubyzip (2.3.2) - selenium-webdriver (4.5.0) - childprocess (>= 0.5, < 5.0) - rexml (~> 3.2, >= 3.2.5) - rubyzip (>= 1.2.2, < 3.0) - websocket (~> 1.0) - simpleidn (0.2.3) - strscan (3.1.0) - sys-uname (1.3.0) - ffi (~> 1.1) - test-unit (3.5.9) - power_assert - textutils (1.4.0) - activesupport - logutils (>= 0.6.1) - props (>= 1.1.2) - rubyzip (>= 1.0.0) - thor (1.3.1) - timecop (0.9.10) - tomlrb (2.0.3) - tzinfo (2.0.6) - concurrent-ruby (~> 1.0) - uri_template (0.7.0) - webrick (1.7.0) - websocket (1.2.10) - websocket-driver (0.7.6) - websocket-extensions (>= 0.1.0) - websocket-extensions (0.1.5) - with_env (1.1.0) - xml-simple (1.1.9) - rexml - yard (0.9.36) - -PLATFORMS - arm64-darwin-23 - x86_64-darwin-19 - x86_64-darwin-20 - -DEPENDENCIES - bugsnag-maze-runner! - license_finder (~> 7.0) - markdown (~> 1.2) - mocha (~> 1.13.0) - redcarpet (~> 3.5) - timecop (~> 0.9.6) - yard (~> 0.9.1) - yard-cucumber! - -BUNDLED WITH - 2.4.8 diff --git a/lib/features/steps/trace_steps.rb b/lib/features/steps/trace_steps.rb index 92b45cf13..4f1c5cb72 100644 --- a/lib/features/steps/trace_steps.rb +++ b/lib/features/steps/trace_steps.rb @@ -96,6 +96,10 @@ assert_attribute field, key, { 'boolValue' => false } end +Then('the trace payload field {string} double attribute {string} equals {float}') do |field, attribute, expected| + check_attribute_equal field, attribute, 'doubleValue', expected +end + # @!group Span steps Then('a span {word} equals {string}') do |attribute, expected| spans = spans_from_request_list(Maze::Server.list_for('traces')) @@ -259,8 +263,10 @@ def attribute_value_matches?(attribute_value, expected_type, expected_value) expected_value.to_f.eql?(attribute_value[expected_type]) when 'boolValue' expected_value.eql?('true').eql?(attribute_value[expected_type]) - when 'arrayValue', 'kvlistValue' - $logger.error('Span attribute validation does not currently support the "arrayValue" or "kvlistValue" types') + when 'arrayValue' + expected_value == attribute_value[expected_type]['values'] + when 'kvlistValue' + $logger.error('Span attribute validation does not currently support the "kvlistValue" type') false else $logger.error("An invalid attribute type was expected: '#{expected_type}'") @@ -323,3 +329,46 @@ def assert_attribute(field, key, expected) attributes = Maze::Helper.read_key_path(list.current[:body], "#{field}.attributes") Maze.check.equal({ 'key' => key, 'value' => expected }, attributes.find { |a| a['key'] == key }) end + +def check_array_attribute_equal(field, attribute, expected_values) + actual_values = get_attribute_value(field, attribute, 'arrayValue')['values'] + + # Convert string representations of integers to integers for comparison + actual_values.map! do |value| + if value.key?('intValue') + value['intValue'].to_i + else + value + end + end + + expected_values.map! do |value| + if value.key?('intValue') + value['intValue'].to_i + else + value + end + end + + Maze.check.equal(expected_values, actual_values) +end + +Then('the trace payload field {string} string array attribute {string} equals the array:') do |field, attribute, expected_values| + expected_values_list = expected_values.raw.flatten.map { |v| { 'stringValue' => v } } + check_array_attribute_equal field, attribute, expected_values_list +end + +Then('the trace payload field {string} integer array attribute {string} equals the array:') do |field, attribute, expected_values| + expected_values_list = expected_values.raw.flatten.map { |v| { 'intValue' => v.to_i } } + check_array_attribute_equal(field, attribute, expected_values_list) +end + +Then('the trace payload field {string} double array attribute {string} equals the array:') do |field, attribute, expected_values| + expected_values_list = expected_values.raw.flatten.map { |v| { 'doubleValue' => v.to_f } } + check_array_attribute_equal field, attribute, expected_values_list +end + +Then('the trace payload field {string} boolean array attribute {string} equals the array:') do |field, attribute, expected_values| + expected_values_list = expected_values.raw.flatten.map { |v| { 'boolValue' => v == 'true' } } + check_array_attribute_equal field, attribute, expected_values_list +end \ No newline at end of file diff --git a/lib/maze.rb b/lib/maze.rb index d748005f8..c24ef66c7 100644 --- a/lib/maze.rb +++ b/lib/maze.rb @@ -7,7 +7,7 @@ # Glues the various parts of MazeRunner together that need to be accessed globally, # providing an alternative to the proliferation of global variables or singletons. module Maze - VERSION = '9.10.0' + VERSION = '9.11.0' class << self attr_accessor :check, :driver, :internal_hooks, :mode, :start_time, :dynamic_retry, :public_address,