bugsnag-maze-runner 7.30.2 → 7.32.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/features/steps/request_assertion_steps.rb +18 -3
- data/lib/features/steps/runner_steps.rb +9 -2
- data/lib/maze/client/appium/bb_client.rb +1 -44
- data/lib/maze/client/bb_client_utils.rb +43 -0
- data/lib/maze/client/selenium/bb_client.rb +1 -0
- data/lib/maze/configuration.rb +4 -0
- data/lib/maze/wait.rb +2 -2
- data/lib/maze.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: d41cfd37f8f7a6b9c1ded38ede7bb1e1bb4bd2f88157fd0e8e06f0eb4509910e
|
4
|
+
data.tar.gz: 5094050c79c43ba0715ee9448828bac5c1ce85f2720ce16e61c321347a44417d
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 1d5dee129b92e41a8e021e85192416250bc3ad5f081bc94759873832d210c8c1ede1aa61b085b0238a9c6bfa0ad54e8db6e657faba112e4be2b76a359fdc6084
|
7
|
+
data.tar.gz: 730ea82561c6e093967c94acd0d2fcdf94c3d89cdfea68f6084b4c147b46a0e5a3f18021baf5b4896dcd3fe8aed1614e0b3ce2fe8243beff8e1f336dfb129ca9
|
@@ -10,9 +10,24 @@ require_relative '../../maze/wait'
|
|
10
10
|
|
11
11
|
def assert_received_requests(request_count, list, list_name, precise = true)
|
12
12
|
timeout = Maze.config.receive_requests_wait
|
13
|
-
|
14
|
-
|
15
|
-
|
13
|
+
# Interval set to 0.5s to make it more likely to detect erroneous extra requests,
|
14
|
+
# without impacting overall speed too much
|
15
|
+
wait = Maze::Wait.new(interval: 0.5, timeout: timeout)
|
16
|
+
|
17
|
+
last_count = 0
|
18
|
+
start_time = Time.now
|
19
|
+
received = wait.until do
|
20
|
+
|
21
|
+
count_now = list.size_remaining
|
22
|
+
elapsed = Time.now - start_time
|
23
|
+
if elapsed > Maze.config.receive_requests_slow_threshold
|
24
|
+
if count_now > last_count
|
25
|
+
$logger.warn "Received #{count_now - last_count} request(s) after #{elapsed.round(1)}s"
|
26
|
+
end
|
27
|
+
end
|
28
|
+
last_count = count_now
|
29
|
+
count_now >= request_count
|
30
|
+
end
|
16
31
|
|
17
32
|
unless received
|
18
33
|
raise Test::Unit::AssertionFailedError.new <<-MESSAGE
|
@@ -243,7 +243,7 @@ Then('I wait for the shell prompt {string}') do |expected_prompt|
|
|
243
243
|
wait = Maze::Wait.new(timeout: Maze.config.receive_requests_wait)
|
244
244
|
shell = Maze::Runner.interactive_session
|
245
245
|
|
246
|
-
success = wait.until { shell.current_buffer
|
246
|
+
success = wait.until { expected_prompt == sanitized(shell.current_buffer) }
|
247
247
|
|
248
248
|
Maze.check.true(success, "The current output line \"#{shell.current_buffer}\" did not match \"#{expected_prompt}\"")
|
249
249
|
end
|
@@ -265,12 +265,19 @@ Then('I wait for the shell to output {string} to stdout') do |expected_line|
|
|
265
265
|
current_shell = Maze::Runner.interactive_session
|
266
266
|
|
267
267
|
success = wait.until do
|
268
|
-
current_shell.stdout_lines.any?
|
268
|
+
current_shell.stdout_lines.any? do |line|
|
269
|
+
# Remove inconsequential escape codes
|
270
|
+
expected_line == sanitized(line)
|
271
|
+
end
|
269
272
|
end
|
270
273
|
|
271
274
|
Maze.check.true(success, "No output lines from #{current_shell.stdout_lines} matched #{expected_line}")
|
272
275
|
end
|
273
276
|
|
277
|
+
def sanitized(line)
|
278
|
+
line.sub "\e[?25h", '' # Make cursor visible
|
279
|
+
end
|
280
|
+
|
274
281
|
# Verify a string using a regex in the stdout logs
|
275
282
|
#
|
276
283
|
# @step_input regex_matcher [String] The regex expected to match a line in stdout logs
|
@@ -39,7 +39,7 @@ module Maze
|
|
39
39
|
'testTimeout' => 7200
|
40
40
|
}
|
41
41
|
}
|
42
|
-
capabilities.deep_merge! dashboard_capabilities
|
42
|
+
capabilities.deep_merge! BitBarClientUtils.dashboard_capabilities
|
43
43
|
capabilities.deep_merge! BitBarDevices.get_available_device(config.device)
|
44
44
|
capabilities.deep_merge! JSON.parse(config.capabilities_option)
|
45
45
|
capabilities
|
@@ -65,49 +65,6 @@ module Maze
|
|
65
65
|
Maze::Client::BitBarClientUtils.stop_local_tunnel
|
66
66
|
end
|
67
67
|
end
|
68
|
-
|
69
|
-
# Determines capabilities used to organise sessions in the BitBar dashboard.
|
70
|
-
#
|
71
|
-
# @return [Hash] A hash containing the capabilities.
|
72
|
-
def dashboard_capabilities
|
73
|
-
|
74
|
-
# Determine project name
|
75
|
-
if ENV['BUILDKITE']
|
76
|
-
$logger.info 'Using BUILDKITE_PIPELINE_SLUG for BitBar project name'
|
77
|
-
project = ENV['BUILDKITE_PIPELINE_SLUG']
|
78
|
-
else
|
79
|
-
# Attempt to use the current git repo
|
80
|
-
output, status = Maze::Runner.run_command('git rev-parse --show-toplevel')
|
81
|
-
if status == 0
|
82
|
-
project = File.basename(output[0].strip)
|
83
|
-
else
|
84
|
-
$logger.warn 'Unable to determine project name, consider running Maze Runner from within a Git repository'
|
85
|
-
project = 'Unknown'
|
86
|
-
end
|
87
|
-
end
|
88
|
-
|
89
|
-
# Test run
|
90
|
-
if ENV['BUILDKITE']
|
91
|
-
bk_retry = ENV['BUILDKITE_RETRY_COUNT']
|
92
|
-
retry_string = if !bk_retry.nil? && bk_retry.to_i > 1
|
93
|
-
" (#{bk_retry})"
|
94
|
-
else
|
95
|
-
''
|
96
|
-
end
|
97
|
-
test_run = "#{ENV['BUILDKITE_BUILD_NUMBER']} - #{ENV['BUILDKITE_LABEL']}#{retry_string}"
|
98
|
-
else
|
99
|
-
test_run = Maze.run_uuid
|
100
|
-
end
|
101
|
-
|
102
|
-
$logger.info "BitBar project name: #{project}"
|
103
|
-
$logger.info "BitBar test run: #{test_run}"
|
104
|
-
{
|
105
|
-
'bitbar:options' => {
|
106
|
-
bitbar_project: project,
|
107
|
-
bitbar_testrun: test_run
|
108
|
-
}
|
109
|
-
}
|
110
|
-
end
|
111
68
|
end
|
112
69
|
end
|
113
70
|
end
|
@@ -170,6 +170,49 @@ module Maze
|
|
170
170
|
File.delete(BB_KILL_FILE) if File.exist?(BB_KILL_FILE)
|
171
171
|
end
|
172
172
|
|
173
|
+
# Determines capabilities used to organise sessions in the BitBar dashboard.
|
174
|
+
#
|
175
|
+
# @return [Hash] A hash containing the capabilities.
|
176
|
+
def dashboard_capabilities
|
177
|
+
|
178
|
+
# Determine project name
|
179
|
+
if ENV['BUILDKITE']
|
180
|
+
$logger.info 'Using BUILDKITE_PIPELINE_SLUG for BitBar project name'
|
181
|
+
project = ENV['BUILDKITE_PIPELINE_SLUG']
|
182
|
+
else
|
183
|
+
# Attempt to use the current git repo
|
184
|
+
output, status = Maze::Runner.run_command('git rev-parse --show-toplevel')
|
185
|
+
if status == 0
|
186
|
+
project = File.basename(output[0].strip)
|
187
|
+
else
|
188
|
+
$logger.warn 'Unable to determine project name, consider running Maze Runner from within a Git repository'
|
189
|
+
project = 'Unknown'
|
190
|
+
end
|
191
|
+
end
|
192
|
+
|
193
|
+
# Test run
|
194
|
+
if ENV['BUILDKITE']
|
195
|
+
bk_retry = ENV['BUILDKITE_RETRY_COUNT']
|
196
|
+
retry_string = if !bk_retry.nil? && bk_retry.to_i > 1
|
197
|
+
" (#{bk_retry})"
|
198
|
+
else
|
199
|
+
''
|
200
|
+
end
|
201
|
+
test_run = "#{ENV['BUILDKITE_BUILD_NUMBER']} - #{ENV['BUILDKITE_LABEL']}#{retry_string}"
|
202
|
+
else
|
203
|
+
test_run = Maze.run_uuid
|
204
|
+
end
|
205
|
+
|
206
|
+
$logger.info "BitBar project name: #{project}"
|
207
|
+
$logger.info "BitBar test run: #{test_run}"
|
208
|
+
{
|
209
|
+
'bitbar:options' => {
|
210
|
+
bitbar_project: project,
|
211
|
+
bitbar_testrun: test_run
|
212
|
+
}
|
213
|
+
}
|
214
|
+
end
|
215
|
+
|
173
216
|
private
|
174
217
|
|
175
218
|
def start_tunnel_thread(cmd)
|
@@ -7,6 +7,7 @@ module Maze
|
|
7
7
|
capabilities = ::Selenium::WebDriver::Remote::Capabilities.new
|
8
8
|
capabilities['bitbar_apiKey'] = config.access_key
|
9
9
|
browsers = YAML.safe_load(File.read("#{__dir__}/bb_browsers.yml"))
|
10
|
+
capabilities.merge! BitBarClientUtils.dashboard_capabilities
|
10
11
|
capabilities.merge! browsers[config.browser]
|
11
12
|
capabilities.merge! JSON.parse(config.capabilities_option)
|
12
13
|
config.capabilities = capabilities
|
data/lib/maze/configuration.rb
CHANGED
@@ -8,6 +8,7 @@ module Maze
|
|
8
8
|
def initialize
|
9
9
|
self.receive_no_requests_wait = 30
|
10
10
|
self.receive_requests_wait = 30
|
11
|
+
self.receive_requests_slow_threshold = 10
|
11
12
|
self.enforce_bugsnag_integrity = true
|
12
13
|
self.captured_invalid_requests = Set[:errors, :sessions, :builds, :uploads, :sourcemaps]
|
13
14
|
@legacy_driver = false
|
@@ -49,6 +50,9 @@ module Maze
|
|
49
50
|
# Maximum time in seconds to wait in the `I wait to receive {int} error(s)/session(s)/build(s)` steps
|
50
51
|
attr_accessor :receive_requests_wait
|
51
52
|
|
53
|
+
# Time after which requests are deemed to be slow to be received and a warning is logged for
|
54
|
+
attr_accessor :receive_requests_slow_threshold
|
55
|
+
|
52
56
|
# Whether presence of the Bugsnag-Integrity header should be enforced
|
53
57
|
attr_accessor :enforce_bugsnag_integrity
|
54
58
|
|
data/lib/maze/wait.rb
CHANGED
@@ -4,8 +4,8 @@ module Maze
|
|
4
4
|
# Allows repeated attempts at something, until it is successful or the timeout
|
5
5
|
# is exceed
|
6
6
|
class Wait
|
7
|
-
# @param interval [
|
8
|
-
# @param timeout [
|
7
|
+
# @param interval [Float] Optional. The time to sleep between attempts
|
8
|
+
# @param timeout [Integer] The amount of time to spend on attempts before giving up
|
9
9
|
def initialize(interval: 0.1, timeout:)
|
10
10
|
raise "Interval must be greater than zero, got '#{interval}'" unless interval > 0
|
11
11
|
raise "Timeout (#{timeout}) must be greater than interval (#{interval})" unless timeout > interval
|
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.
|
10
|
+
VERSION = '7.32.0'
|
11
11
|
|
12
12
|
class << self
|
13
13
|
attr_accessor :check, :driver, :internal_hooks, :mode, :start_time, :dynamic_retry, :public_address,
|
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.
|
4
|
+
version: 7.32.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Steve Kirkland
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2023-05-
|
11
|
+
date: 2023-05-23 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: cucumber
|