bugsnag-maze-runner 7.22.1 → 7.23.0

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 25918b6a96c58be96023fec6acae1dca6463db11c722fe9ef612f1faa1137f48
4
- data.tar.gz: 68af4db3ee29db253541685361060a0b969371752a22c7c7e7e78bfd51c7dc31
3
+ metadata.gz: 278a8086385e122760909cdb546fe9a15d76e24d5d13948c45bb097d86427f4a
4
+ data.tar.gz: 56a21399890869570fa4acffdbe962714fb423307e3b7575edc3bee14358d315
5
5
  SHA512:
6
- metadata.gz: 5734aa0594c7286ebe127cb4261b0d029f7241a88c090eea5c52a059459e3f7deed26a3fc14d754155ae8d1000b5001d65b3b903e2d98822ccc6cf7a824573e4
7
- data.tar.gz: 91d4e5a297ec91c2f71bc2f023632eab9c328fe70bcd61bf511f8eab688b7e85c4cba8a9d5dc5ccec3017a2240daee180f6c0364db490e71376389f77cc5a45f
6
+ metadata.gz: bc3bca3a7e2471c755ec2e3ba6c7479fd62dc1cdcb46a503332ed31c148554f4c2bd664e43038af537930eedc1f322656baf718905242088fcaaa1f37e134e35
7
+ data.tar.gz: 716512518c9dd9124137bd4e1a867c8799dbfdbfc9ae87eec12d38a9da0835e8e34d128999afe24020863cc6bfbb7ae1170ae9d60bd587e7ce973921a70c3420
@@ -156,6 +156,30 @@ Then('a span field {string} matches the regex {string}') do |attribute, pattern|
156
156
  Maze.check.false(selected_attributes.empty?)
157
157
  end
158
158
 
159
+ Then('a span named {string} contains the attributes:') do |span_name, table|
160
+ spans = spans_from_request_list(Maze::Server.list_for('traces'))
161
+ named_spans = spans.find_all { |span| span['name'].eql?(span_name) }
162
+ raise Test::Unit::AssertionFailedError.new "No spans were found with the name #{span_name}" if named_spans.empty?
163
+
164
+ expected_attributes = table.hashes
165
+
166
+ match = false
167
+ named_spans.each do |span|
168
+ matches = expected_attributes.map do |expected_attribute|
169
+ span['attributes'].find_all { |attribute| attribute['key'].eql?(expected_attribute['attribute']) }
170
+ .any? { |attribute| attribute_value_matches?(attribute['value'], expected_attribute['type'], expected_attribute['value']) }
171
+ end
172
+ if matches.all? && !matches.empty?
173
+ match = true
174
+ break
175
+ end
176
+ end
177
+
178
+ unless match
179
+ raise Test::Unit::AssertionFailedError.new "No spans were found containing all of the given attributes"
180
+ end
181
+ end
182
+
159
183
  def spans_from_request_list list
160
184
  return list.remaining
161
185
  .flat_map { |req| req[:body]['resourceSpans'] }
@@ -164,6 +188,30 @@ def spans_from_request_list list
164
188
  .select { |s| !s.nil? }
165
189
  end
166
190
 
191
+ def attribute_value_matches?(attribute_value, expected_type, expected_value)
192
+ # Check that the required value type key is present
193
+ unless attribute_value.keys.include?(expected_type)
194
+ return false
195
+ end
196
+
197
+ case expected_type
198
+ when 'bytesValue', 'stringValue'
199
+ expected_value.eql?(attribute_value[expected_type])
200
+ when 'intValue'
201
+ expected_value.to_i.eql?(attribute_value[expected_type].to_i)
202
+ when 'doubleValue'
203
+ expected_value.to_f.eql?(attribute_value[expected_type])
204
+ when 'boolValue'
205
+ expected_value.eql?('true').eql?(attribute_value[expected_type])
206
+ when 'arrayValue', 'kvlistValue'
207
+ $logger.error('Span attribute validation does not currently support the "arrayValue" or "kvlistValue" types')
208
+ false
209
+ else
210
+ $logger.error("An invalid attribute type was expected: '#{expected_type}'")
211
+ false
212
+ end
213
+ end
214
+
167
215
  def assert_received_spans(span_count, list)
168
216
  timeout = Maze.config.receive_requests_wait
169
217
  wait = Maze::Wait.new(timeout: timeout)
data/lib/maze.rb CHANGED
@@ -7,7 +7,7 @@ require_relative 'maze/timers'
7
7
  # Glues the various parts of MazeRunner together that need to be accessed globally,
8
8
  # providing an alternative to the proliferation of global variables or singletons.
9
9
  module Maze
10
- VERSION = '7.22.1'
10
+ VERSION = '7.23.0'
11
11
 
12
12
  class << self
13
13
  attr_accessor :check, :driver, :internal_hooks, :mode, :start_time, :dynamic_retry, :public_address, :run_uuid
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: bugsnag-maze-runner
3
3
  version: !ruby/object:Gem::Version
4
- version: 7.22.1
4
+ version: 7.23.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Steve Kirkland
8
- autorequire:
8
+ autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2023-03-15 00:00:00.000000000 Z
11
+ date: 2023-03-20 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: cucumber
@@ -425,11 +425,11 @@ files:
425
425
  - lib/maze/wait.rb
426
426
  - lib/utils/deep_merge.rb
427
427
  - lib/utils/selenium_money_patch.rb
428
- homepage:
428
+ homepage:
429
429
  licenses:
430
430
  - MIT
431
431
  metadata: {}
432
- post_install_message:
432
+ post_install_message:
433
433
  rdoc_options: []
434
434
  require_paths:
435
435
  - lib
@@ -445,7 +445,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
445
445
  version: '0'
446
446
  requirements: []
447
447
  rubygems_version: 3.1.6
448
- signing_key:
448
+ signing_key:
449
449
  specification_version: 4
450
450
  summary: Bugsnag API request validation harness
451
451
  test_files: []