bugsnag-maze-runner 8.12.1 → 8.13.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/bin/download-logs +3 -0
- data/bin/maze-runner +3 -0
- data/bin/purge-projects +3 -0
- data/bin/upload-app +3 -0
- data/lib/maze/api/exit_code.rb +1 -0
- data/lib/maze/client/bb_client_utils.rb +44 -24
- data/lib/maze/retry_handler.rb +8 -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: 1c4179797bd1c2f213229a61382af46e4961ed8e1c927752082bef991edb7763
|
4
|
+
data.tar.gz: 3861468539c18e1e1ab53a9937eb6fc5fea67147a5a5016d660189ac95103dab
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: f92c80ce71906d9b16ca07b70a8e2637beb6643e864851667fbca53d28cd464663850480b381c89f31b5afc79928125a6362cc69c227889239771d3938a1582a
|
7
|
+
data.tar.gz: 9641dba3a1675bf5d6afdad3fd7244db7bba1e73e4d3cba91ed0a146f886fe8ead9278b8874b53f194ec73701f508f13b5a0ad1028225c818bc1c5da225ce7a2
|
data/bin/download-logs
CHANGED
data/bin/maze-runner
CHANGED
data/bin/purge-projects
CHANGED
data/bin/upload-app
CHANGED
@@ -1,6 +1,9 @@
|
|
1
1
|
#!/usr/bin/env ruby
|
2
2
|
# frozen_string_literal: true
|
3
3
|
|
4
|
+
# Workaround for running on ARM macOS machines
|
5
|
+
require 'em/pure_ruby'
|
6
|
+
|
4
7
|
require_relative '../lib/maze'
|
5
8
|
require_relative '../lib/maze/client/bs_client_utils'
|
6
9
|
require_relative '../lib/maze/client/bb_client_utils'
|
data/lib/maze/api/exit_code.rb
CHANGED
@@ -19,41 +19,61 @@ module Maze
|
|
19
19
|
# @param api_key [String] The BitBar API key
|
20
20
|
# @param app [String] A path to the application file
|
21
21
|
# @param app_id_file [String] the file to write the uploaded app url to BitBar
|
22
|
-
|
22
|
+
# @param max_attempts [Integer] the maximum number of attempts to upload the app
|
23
|
+
def upload_app(api_key, app, app_id_file=nil, max_attempts=5)
|
23
24
|
uuid_regex = /\A[0-9]+\z/
|
24
25
|
|
25
26
|
if uuid_regex.match? app
|
26
27
|
$logger.info "Using pre-uploaded app with ID #{app}"
|
27
28
|
app_uuid = app
|
28
29
|
else
|
29
|
-
|
30
|
-
|
30
|
+
upload_proc = Proc.new do |app_path|
|
31
|
+
$logger.info "Uploading app: #{app_path}"
|
31
32
|
|
32
|
-
|
33
|
-
|
34
|
-
|
35
|
-
|
36
|
-
|
33
|
+
# Upload the app to BitBar
|
34
|
+
uri = URI('https://cloud.bitbar.com/api/me/files')
|
35
|
+
request = Net::HTTP::Post.new(uri)
|
36
|
+
request.basic_auth(api_key, '')
|
37
|
+
request.set_form({ 'file' => File.new(app_path, 'rb') }, 'multipart/form-data')
|
37
38
|
|
38
|
-
|
39
|
-
|
39
|
+
Net::HTTP.start(uri.hostname, uri.port, use_ssl: true) do |http|
|
40
|
+
http.request(request)
|
41
|
+
end
|
40
42
|
end
|
41
43
|
|
42
|
-
|
43
|
-
|
44
|
-
|
45
|
-
|
46
|
-
|
47
|
-
|
48
|
-
|
49
|
-
|
50
|
-
|
51
|
-
|
44
|
+
expanded_app = Maze::Helper.expand_path(app)
|
45
|
+
|
46
|
+
attempts = 0
|
47
|
+
app_uuid = nil
|
48
|
+
last_error = nil
|
49
|
+
while attempts < max_attempts && app_uuid.nil?
|
50
|
+
attempts += 1
|
51
|
+
begin
|
52
|
+
response = upload_proc.call(expanded_app)
|
53
|
+
body = JSON.parse(response.body)
|
54
|
+
if body.key?('id')
|
55
|
+
app_uuid = body['id'].to_s
|
56
|
+
$logger.info "Uploaded app ID: #{app_uuid}"
|
57
|
+
$logger.info 'You can use this ID to avoid uploading the same app more than once.'
|
58
|
+
else
|
59
|
+
error_string = "Unexpected response body: #{body}"
|
60
|
+
$logger.error error_string
|
61
|
+
last_error = RuntimeError.new(error_string)
|
62
|
+
end
|
63
|
+
rescue JSON::ParserError => error
|
64
|
+
last_error = error
|
65
|
+
Bugsnag.notify error
|
66
|
+
$logger.error "Expected JSON response, received: #{response}"
|
67
|
+
rescue => error
|
68
|
+
last_error = error
|
69
|
+
Bugsnag.notify error
|
70
|
+
$logger.error "Unexpected error uploading app: #{error}"
|
52
71
|
end
|
53
|
-
|
54
|
-
|
55
|
-
|
56
|
-
|
72
|
+
end
|
73
|
+
|
74
|
+
if app_uuid.nil?
|
75
|
+
$logger.error "App upload to BitBar failed after #{attempts} attempts"
|
76
|
+
raise last_error
|
57
77
|
end
|
58
78
|
end
|
59
79
|
|
data/lib/maze/retry_handler.rb
CHANGED
@@ -20,10 +20,16 @@ module Maze
|
|
20
20
|
return false if !Maze.config.enable_retries || retried_previously?(test_case)
|
21
21
|
|
22
22
|
if retry_on_driver_error?(event)
|
23
|
-
$logger.warn "Retrying #{test_case.name} due to driver error: #{event.result.exception}"
|
24
23
|
if Maze.driver.is_a?(Maze::Driver::Appium)
|
25
|
-
Maze.
|
24
|
+
if Maze.config.farm.eql?(:bb)
|
25
|
+
Maze::Hooks::ErrorCodeHook.exit_code = Maze::Api::ExitCode::APPIUM_SESSION_FAILURE
|
26
|
+
return false
|
27
|
+
else
|
28
|
+
$logger.warn "Retrying #{test_case.name} due to appium driver error: #{event.result.exception}"
|
29
|
+
Maze.driver.restart
|
30
|
+
end
|
26
31
|
elsif Maze.driver.is_a?(Maze::Driver::Browser)
|
32
|
+
$logger.warn "Retrying #{test_case.name} due to selenium driver error: #{event.result.exception}"
|
27
33
|
Maze.driver.refresh
|
28
34
|
end
|
29
35
|
elsif retry_on_tag?(test_case)
|
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 = '8.
|
10
|
+
VERSION = '8.13.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: 8.
|
4
|
+
version: 8.13.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-11-
|
11
|
+
date: 2023-11-17 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: cucumber
|