From 1cb8fb8be36fd6b2ed07a5eb744ec1c61f9f378d Mon Sep 17 00:00:00 2001 From: Steve Kirkland-Walton Date: Mon, 9 Oct 2023 19:15:36 +0100 Subject: [PATCH 01/10] Refactor provisioning logic to base retry intervals on error messages --- lib/maze/client/appium/base_client.rb | 92 ++++++++++++--------------- lib/maze/client/appium/bb_client.rb | 16 ++++- lib/maze/client/appium/bs_client.rb | 13 +++- 3 files changed, 66 insertions(+), 55 deletions(-) diff --git a/lib/maze/client/appium/base_client.rb b/lib/maze/client/appium/base_client.rb index 861dfcdf8..2236da30d 100644 --- a/lib/maze/client/appium/base_client.rb +++ b/lib/maze/client/appium/base_client.rb @@ -9,6 +9,7 @@ class BaseClient def initialize @session_ids = [] + @start_attempts = 0 end def start_session @@ -47,51 +48,39 @@ def retry_start_driver? raise 'Method not implemented by this class' end - def start_driver(config) - retry_failure = retry_start_driver? - driver = nil - until Maze.driver - begin - - - # Proc to start the driver - start_driver_closure = Proc.new do - begin - config.capabilities = device_capabilities - driver = Maze::Driver::Appium.new config.appium_server_url, - config.capabilities, - config.locator - - result = driver.start_driver - if result - # Log details of this session - $logger.info "Created Appium session: #{driver.session_id}" - @session_ids << driver.session_id - udid = driver.session_capabilities['udid'] - $logger.info "Running on device: #{udid}" unless udid.nil? - end - result - rescue => error - Bugsnag.notify error - $logger.error "Session creation failed: #{error}" - false - end - end + def attempt_start_driver(config) + config.capabilities = device_capabilities + driver = Maze::Driver::Appium.new config.appium_server_url, + config.capabilities, + config.locator + + result = driver.start_driver + if result + # Log details of this session + $logger.info "Created Appium session: #{driver.session_id}" + @session_ids << driver.session_id + udid = driver.session_capabilities['udid'] + $logger.info "Running on device: #{udid}" unless udid.nil? + end + driver + end + def start_driver(config) - # Invoke the proc, with or without retries - if retry_failure - wait = Maze::Wait.new(interval: 10, timeout: 60) - success = wait.until(&start_driver_closure) - else - success = start_driver_closure.call - end + attempts = 0 - unless success - $logger.error 'Failed to create Appium driver, exiting' - exit(::Maze::Api::ExitCode::SESSION_CREATION_FAILURE) - end + while attempts < 5 && Maze.driver.nil? + attempts += 1 + start_error = nil + begin + Maze.driver = attempt_start_driver(config) + rescue => error + Bugsnag.notify error + $logger.error "Session creation failed: #{error}" + start_error = error + end + if Maze.driver # Infer OS version if necessary when running locally if Maze.config.farm == :local && Maze.config.os_version.nil? version = case Maze.config.os @@ -103,23 +92,24 @@ def start_driver(config) $logger.info "Inferred OS version to be #{version}" Maze.config.os_version = version end + else + interval = retry_interval(start_error) + if interval + $logger.warn + sleep interval - Maze.driver = driver - rescue ::Selenium::WebDriver::Error::UnknownError => original_exception - $logger.warn "Attempt to acquire #{config.device} device from farm #{config.farm} failed" - $logger.warn "Exception: #{original_exception.message}" - if config.device_list.empty? - $logger.error 'No further devices to try - raising original exception' - raise original_exception else - config.device = config.device_list.first - config.device_list = config.device_list.drop(1) - $logger.warn "Retrying driver initialisation using next device: #{config.device}" + $logger.error 'Failed to create Appium driver, exiting' + exit(::Maze::Api::ExitCode::SESSION_CREATION_FAILURE) end end end end + def retry_interval(error) + raise 'Method not implemented by this class' + end + def start_scenario # Launch the app on macOS Maze.driver.get(Maze.config.app) if Maze.config.os == 'macos' diff --git a/lib/maze/client/appium/bb_client.rb b/lib/maze/client/appium/bb_client.rb index c2de463c7..9e2ce7b39 100644 --- a/lib/maze/client/appium/bb_client.rb +++ b/lib/maze/client/appium/bb_client.rb @@ -13,8 +13,20 @@ def prepare_session end end - def retry_start_driver? - false + def retry_interval(error) + # Retry interval depends on the error message + return nil if error.nil? + + if error.message.include? 'no sessionId in returned payload' + # This will happen naturally due to a race condition in how we access devices + return 60 + elsif error.message.include? 'You reached the account concurrency limit' + # In theory this shouldn't happen, but back off if it does + return 300 + else + # No retries in unknown cases + nil + end end def start_scenario diff --git a/lib/maze/client/appium/bs_client.rb b/lib/maze/client/appium/bs_client.rb index a2f0ed917..5464317e3 100644 --- a/lib/maze/client/appium/bs_client.rb +++ b/lib/maze/client/appium/bs_client.rb @@ -15,8 +15,17 @@ def prepare_session end end - def retry_start_driver? - Maze.config.device_list.nil? || Maze.config.device_list.empty? + # On BrowserStack, wait 10 seconds before retrying if there is another device in the list + def retry_interval(error) + if Maze.config.device_list.nil? || config.device_list.empty? + $logger.error 'No further devices to try' + nil + else + config.device = config.device_list.first + config.device_list = config.device_list.drop(1) + $logger.warn "Retrying driver initialisation using next device: #{config.device}" + 10 + end end def start_scenario From 73664639d908e423ed259e538c59423d8d670e7e Mon Sep 17 00:00:00 2001 From: Steve Kirkland-Walton Date: Fri, 20 Oct 2023 16:50:15 +0100 Subject: [PATCH 02/10] Refactor to only selectively notify --- lib/maze/client/appium/base_client.rb | 10 ++++------ lib/maze/client/appium/bb_client.rb | 8 +++++++- lib/maze/client/appium/bb_devices.rb | 3 +-- lib/maze/client/appium/bs_client.rb | 3 ++- 4 files changed, 14 insertions(+), 10 deletions(-) diff --git a/lib/maze/client/appium/base_client.rb b/lib/maze/client/appium/base_client.rb index 2236da30d..b6b0859ff 100644 --- a/lib/maze/client/appium/base_client.rb +++ b/lib/maze/client/appium/base_client.rb @@ -75,7 +75,6 @@ def start_driver(config) begin Maze.driver = attempt_start_driver(config) rescue => error - Bugsnag.notify error $logger.error "Session creation failed: #{error}" start_error = error end @@ -93,11 +92,10 @@ def start_driver(config) Maze.config.os_version = version end else - interval = retry_interval(start_error) + interval = handle_error(start_error) if interval - $logger.warn - sleep interval - + $logger.warn "Failed to create Appium driver, retrying in #{interval} seconds" + sleep interval else $logger.error 'Failed to create Appium driver, exiting' exit(::Maze::Api::ExitCode::SESSION_CREATION_FAILURE) @@ -106,7 +104,7 @@ def start_driver(config) end end - def retry_interval(error) + def handle_error(error) raise 'Method not implemented by this class' end diff --git a/lib/maze/client/appium/bb_client.rb b/lib/maze/client/appium/bb_client.rb index 9e2ce7b39..8dc258e66 100644 --- a/lib/maze/client/appium/bb_client.rb +++ b/lib/maze/client/appium/bb_client.rb @@ -13,18 +13,24 @@ def prepare_session end end - def retry_interval(error) + def handle_error(error) # Retry interval depends on the error message return nil if error.nil? if error.message.include? 'no sessionId in returned payload' # This will happen naturally due to a race condition in how we access devices + # Do not notify, but wait long enough for most ghost sessions on BitBar to terminate. return 60 elsif error.message.include? 'You reached the account concurrency limit' # In theory this shouldn't happen, but back off if it does + Bugsnag.notify error return 300 + elsif error.message.include? 'There are no devices available' + Bugsnag.notify error + return 120 else # No retries in unknown cases + Bugsnag.notify error nil end end diff --git a/lib/maze/client/appium/bb_devices.rb b/lib/maze/client/appium/bb_devices.rb index 486864017..29cb3b437 100644 --- a/lib/maze/client/appium/bb_devices.rb +++ b/lib/maze/client/appium/bb_devices.rb @@ -20,8 +20,7 @@ def get_available_device(device_or_group_names) $logger.trace "Got group ids #{device_group_ids} for #{device_or_group_names}" group_count, device = api_client.find_device_in_groups(device_group_ids) if device.nil? - # TODO: Retry rather than fail, see PLAT-7377 - Maze::Helper.error_exit 'There are no devices available' + raise 'There are no devices available' else $logger.info "#{group_count} device(s) currently available in group(s) '#{device_or_group_names}'" end diff --git a/lib/maze/client/appium/bs_client.rb b/lib/maze/client/appium/bs_client.rb index 5464317e3..99b818342 100644 --- a/lib/maze/client/appium/bs_client.rb +++ b/lib/maze/client/appium/bs_client.rb @@ -16,7 +16,8 @@ def prepare_session end # On BrowserStack, wait 10 seconds before retrying if there is another device in the list - def retry_interval(error) + def handle_error(error) + Bugsnag.notify error unless error.nil? if Maze.config.device_list.nil? || config.device_list.empty? $logger.error 'No further devices to try' nil From f27244a00326effdbc09418d06b25482f029f481 Mon Sep 17 00:00:00 2001 From: Steve Kirkland-Walton Date: Fri, 20 Oct 2023 16:53:02 +0100 Subject: [PATCH 03/10] Tidy-up --- lib/maze/client/appium/bb_client.rb | 18 +++++++++--------- 1 file changed, 9 insertions(+), 9 deletions(-) diff --git a/lib/maze/client/appium/bb_client.rb b/lib/maze/client/appium/bb_client.rb index 8dc258e66..4a88562c6 100644 --- a/lib/maze/client/appium/bb_client.rb +++ b/lib/maze/client/appium/bb_client.rb @@ -17,22 +17,22 @@ def handle_error(error) # Retry interval depends on the error message return nil if error.nil? + interval = nil + notify = true + if error.message.include? 'no sessionId in returned payload' # This will happen naturally due to a race condition in how we access devices # Do not notify, but wait long enough for most ghost sessions on BitBar to terminate. - return 60 + interval = 60 + notify = false elsif error.message.include? 'You reached the account concurrency limit' # In theory this shouldn't happen, but back off if it does - Bugsnag.notify error - return 300 + interval = 300 elsif error.message.include? 'There are no devices available' - Bugsnag.notify error - return 120 - else - # No retries in unknown cases - Bugsnag.notify error - nil + interval = 120 end + Bugsnag.notify error if notify + interval end def start_scenario From 43a4bb695e283378ca262d9caec3ee05dfe446e5 Mon Sep 17 00:00:00 2001 From: Steve Kirkland-Walton Date: Mon, 23 Oct 2023 14:38:27 +0100 Subject: [PATCH 04/10] Require correction --- test/client/appium/bb_client_test.rb | 0 test/client/bb_client_utils_test.rb | 2 +- 2 files changed, 1 insertion(+), 1 deletion(-) create mode 100644 test/client/appium/bb_client_test.rb diff --git a/test/client/appium/bb_client_test.rb b/test/client/appium/bb_client_test.rb new file mode 100644 index 000000000..e69de29bb diff --git a/test/client/bb_client_utils_test.rb b/test/client/bb_client_utils_test.rb index 9dc6acd6c..fc5106278 100644 --- a/test/client/bb_client_utils_test.rb +++ b/test/client/bb_client_utils_test.rb @@ -1,6 +1,6 @@ # frozen_string_literal: true -require 'test_helper' +require_relative '../test_helper' require_relative '../../lib/maze' require_relative '../../lib/maze/client/bb_client_utils' require_relative '../../lib/maze/runner' From 90f05c6e9a1749a53a0ca7893a42703f474dc622 Mon Sep 17 00:00:00 2001 From: Steve Kirkland-Walton Date: Tue, 24 Oct 2023 12:43:10 +0100 Subject: [PATCH 05/10] First unit test working --- test/client/appium/bb_client_test.rb | 84 ++++++++++++++++++++++++++++ 1 file changed, 84 insertions(+) diff --git a/test/client/appium/bb_client_test.rb b/test/client/appium/bb_client_test.rb index e69de29bb..01c3497e4 100644 --- a/test/client/appium/bb_client_test.rb +++ b/test/client/appium/bb_client_test.rb @@ -0,0 +1,84 @@ +require_relative '../../test_helper' +require_relative '../../../lib/maze' +require_relative '../../../lib/maze/configuration' +require_relative '../../../lib/maze/driver/appium' +require_relative '../../../lib/maze/client/bb_api_client' +require_relative '../../../lib/maze/client/bb_client_utils' +require_relative '../../../lib/maze/client/appium/base_client' +require_relative '../../../lib/maze/client/appium/bb_client' +require_relative '../../../lib/maze/client/appium/bb_devices' +require_relative '../../../lib/utils/deep_merge' + +module Maze + module Client + module Appium + class BitBarClientTest < Test::Unit::TestCase + + def setup + logger_mock = mock('logger') + $logger = logger_mock + end + + def test_start_driver_success + Maze.driver = nil + + # Setup inputs + client = BitBarClient.new + Maze.config.app = 'app' + Maze.config.access_key = 'apiKey' + Maze.config.appium_server_url = 'appium server' + Maze.config.capabilities_option = '{"config":"capabilities"}' + Maze.config.locator = :id + + # Dashboard caps + dashboard_caps = { + 'bitbar:options' => { + bitbar_project: 'project', + bitbar_testrun: 'test_run' + } + } + Maze::Client::BitBarClientUtils.expects(:dashboard_capabilities).returns dashboard_caps + + # Device caps + device_caps = { + 'platformName' => 'iOS' + } + Maze::Client::Appium::BitBarDevices.expects(:get_available_device).returns device_caps + + # Driver creation + expected_caps = { + 'appium:options' => { + 'noReset' => true, + 'newCommandTimeout' => 600 + }, + 'bitbar:options' => { + 'apiKey' => 'apiKey', + 'app' => 'app', + 'findDevice' => false, + 'testTimeout' => 7200, + :bitbar_project => 'project', + :bitbar_testrun => 'test_run'}, + 'platformName' => 'iOS', + 'config' => 'capabilities' + } + mock_driver = mock('driver') + Maze::Driver::Appium.expects(:new).with(Maze.config.appium_server_url, + expected_caps, + Maze.config.locator).returns mock_driver + + # Starting of the driver + mock_driver.expects(:session_id).twice.returns 'session_id' + mock_driver.expects(:session_capabilities).returns({ 'uuid' => 'uuid' }) + mock_driver.expects(:start_driver).returns true + BitBarApiClient.stubs(:new) + + # Logging + $logger.expects(:info).with('Created Appium session: session_id') + + + client.start_driver Maze.config + end + end + end + end +end From 568e48360da98ca7d871b4ffe43b72cc68e75352 Mon Sep 17 00:00:00 2001 From: Steve Kirkland-Walton Date: Tue, 24 Oct 2023 20:46:21 +0100 Subject: [PATCH 06/10] Recovers unit test working --- lib/maze/client/appium/base_client.rb | 6 +-- test/client/appium/bb_client_test.rb | 74 +++++++++++++++++++-------- 2 files changed, 55 insertions(+), 25 deletions(-) diff --git a/lib/maze/client/appium/base_client.rb b/lib/maze/client/appium/base_client.rb index b6b0859ff..bef082f7a 100644 --- a/lib/maze/client/appium/base_client.rb +++ b/lib/maze/client/appium/base_client.rb @@ -65,11 +65,11 @@ def attempt_start_driver(config) driver end - def start_driver(config) + def start_driver(config, max_attempts = 5) attempts = 0 - while attempts < 5 && Maze.driver.nil? + while attempts < max_attempts && Maze.driver.nil? attempts += 1 start_error = nil begin @@ -95,7 +95,7 @@ def start_driver(config) interval = handle_error(start_error) if interval $logger.warn "Failed to create Appium driver, retrying in #{interval} seconds" - sleep interval + Kernel::sleep interval else $logger.error 'Failed to create Appium driver, exiting' exit(::Maze::Api::ExitCode::SESSION_CREATION_FAILURE) diff --git a/test/client/appium/bb_client_test.rb b/test/client/appium/bb_client_test.rb index 01c3497e4..68328f853 100644 --- a/test/client/appium/bb_client_test.rb +++ b/test/client/appium/bb_client_test.rb @@ -14,22 +14,12 @@ module Client module Appium class BitBarClientTest < Test::Unit::TestCase - def setup - logger_mock = mock('logger') - $logger = logger_mock + def add_retry_expectations(interval) + $logger.expects(:warn).with("Failed to create Appium driver, retrying in #{interval} seconds") + Kernel.expects(:sleep).with(interval) end - def test_start_driver_success - Maze.driver = nil - - # Setup inputs - client = BitBarClient.new - Maze.config.app = 'app' - Maze.config.access_key = 'apiKey' - Maze.config.appium_server_url = 'appium server' - Maze.config.capabilities_option = '{"config":"capabilities"}' - Maze.config.locator = :id - + def add_attempt_expectations(attempts = 1) # Dashboard caps dashboard_caps = { 'bitbar:options' => { @@ -37,13 +27,13 @@ def test_start_driver_success bitbar_testrun: 'test_run' } } - Maze::Client::BitBarClientUtils.expects(:dashboard_capabilities).returns dashboard_caps + Maze::Client::BitBarClientUtils.expects(:dashboard_capabilities).times(attempts).returns dashboard_caps # Device caps device_caps = { 'platformName' => 'iOS' } - Maze::Client::Appium::BitBarDevices.expects(:get_available_device).returns device_caps + Maze::Client::Appium::BitBarDevices.expects(:get_available_device).times(attempts).returns device_caps # Driver creation expected_caps = { @@ -61,21 +51,61 @@ def test_start_driver_success 'platformName' => 'iOS', 'config' => 'capabilities' } - mock_driver = mock('driver') Maze::Driver::Appium.expects(:new).with(Maze.config.appium_server_url, expected_caps, - Maze.config.locator).returns mock_driver + Maze.config.locator).times(attempts).returns @mock_driver + end - # Starting of the driver - mock_driver.expects(:session_id).twice.returns 'session_id' - mock_driver.expects(:session_capabilities).returns({ 'uuid' => 'uuid' }) - mock_driver.expects(:start_driver).returns true + def setup BitBarApiClient.stubs(:new) + $logger = mock('logger') + @mock_driver = mock('driver') + + # Setup inputs + Maze.driver = nil + Maze.config.app = 'app' + Maze.config.access_key = 'apiKey' + Maze.config.appium_server_url = 'appium server' + Maze.config.capabilities_option = '{"config":"capabilities"}' + Maze.config.locator = :id + end + + def test_start_driver_success + + add_attempt_expectations # Logging + @mock_driver.expects(:start_driver).returns true $logger.expects(:info).with('Created Appium session: session_id') + # Successful starting of the driver + @mock_driver.expects(:session_id).twice.returns 'session_id' + @mock_driver.expects(:session_capabilities).returns({ 'uuid' => 'uuid' }) + + client = BitBarClient.new + client.start_driver Maze.config + end + + def test_start_driver_recovers + + add_attempt_expectations 2 + # + # First attempt - failure + # + message = 'no sessionId in returned payload' + @mock_driver.expects(:start_driver).twice.raises(message).then.returns(true) + $logger.expects(:error).with("Session creation failed: #{message}") + add_retry_expectations 60 + + # + # Second attempt - success + # + $logger.expects(:info).with('Created Appium session: session_id') + @mock_driver.expects(:session_id).twice.returns 'session_id' + @mock_driver.expects(:session_capabilities).returns({ 'uuid' => 'uuid' }) + + client = BitBarClient.new client.start_driver Maze.config end end From 037e80d5d0476c019c3c31aea82fc3fbfb438f68 Mon Sep 17 00:00:00 2001 From: Steve Kirkland-Walton Date: Tue, 24 Oct 2023 21:14:45 +0100 Subject: [PATCH 07/10] Unit tests complete --- lib/maze/client/appium/base_client.rb | 4 +-- lib/maze/client/appium/bb_client.rb | 3 +++ test/client/appium/bb_client_test.rb | 37 ++++++++++++++++++++++----- 3 files changed, 36 insertions(+), 8 deletions(-) diff --git a/lib/maze/client/appium/base_client.rb b/lib/maze/client/appium/base_client.rb index bef082f7a..91657ab3d 100644 --- a/lib/maze/client/appium/base_client.rb +++ b/lib/maze/client/appium/base_client.rb @@ -93,12 +93,12 @@ def start_driver(config, max_attempts = 5) end else interval = handle_error(start_error) - if interval + if interval && attempts < max_attempts $logger.warn "Failed to create Appium driver, retrying in #{interval} seconds" Kernel::sleep interval else $logger.error 'Failed to create Appium driver, exiting' - exit(::Maze::Api::ExitCode::SESSION_CREATION_FAILURE) + Kernel::exit(::Maze::Api::ExitCode::SESSION_CREATION_FAILURE) end end end diff --git a/lib/maze/client/appium/bb_client.rb b/lib/maze/client/appium/bb_client.rb index 4a88562c6..472c4acab 100644 --- a/lib/maze/client/appium/bb_client.rb +++ b/lib/maze/client/appium/bb_client.rb @@ -30,7 +30,10 @@ def handle_error(error) interval = 300 elsif error.message.include? 'There are no devices available' interval = 120 + else + # Do not retry in any other case end + Bugsnag.notify error if notify interval end diff --git a/test/client/appium/bb_client_test.rb b/test/client/appium/bb_client_test.rb index 68328f853..1671786c3 100644 --- a/test/client/appium/bb_client_test.rb +++ b/test/client/appium/bb_client_test.rb @@ -1,5 +1,6 @@ require_relative '../../test_helper' require_relative '../../../lib/maze' +require_relative '../../../lib/maze/api/exit_code' require_relative '../../../lib/maze/configuration' require_relative '../../../lib/maze/driver/appium' require_relative '../../../lib/maze/client/bb_api_client' @@ -14,11 +15,6 @@ module Client module Appium class BitBarClientTest < Test::Unit::TestCase - def add_retry_expectations(interval) - $logger.expects(:warn).with("Failed to create Appium driver, retrying in #{interval} seconds") - Kernel.expects(:sleep).with(interval) - end - def add_attempt_expectations(attempts = 1) # Dashboard caps dashboard_caps = { @@ -96,7 +92,9 @@ def test_start_driver_recovers message = 'no sessionId in returned payload' @mock_driver.expects(:start_driver).twice.raises(message).then.returns(true) $logger.expects(:error).with("Session creation failed: #{message}") - add_retry_expectations 60 + interval = 60 + $logger.expects(:warn).with("Failed to create Appium driver, retrying in #{interval} seconds") + Kernel.expects(:sleep).with(interval) # # Second attempt - success @@ -108,6 +106,33 @@ def test_start_driver_recovers client = BitBarClient.new client.start_driver Maze.config end + + def test_start_driver_failure + + add_attempt_expectations 2 + message_1 = 'You reached the account concurrency limit' + message_2 = 'There are no devices available' + + # + # First attempt - failure + # + @mock_driver.expects(:start_driver).twice.raises(message_1).then.raises(message_2) + $logger.expects(:error).with("Session creation failed: #{message_1}") + + interval = 300 + $logger.expects(:warn).with("Failed to create Appium driver, retrying in #{interval} seconds") + Kernel.expects(:sleep).with(interval) + + # + # Second attempt - also fails + # + $logger.expects(:error).with("Session creation failed: #{message_2}") + Kernel.expects(:exit).with(::Maze::Api::ExitCode::SESSION_CREATION_FAILURE) + $logger.expects(:error).with("Failed to create Appium driver, exiting") + + client = BitBarClient.new + client.start_driver Maze.config, 2 + end end end end From e8590f382ae5ccfe475b421070b0670d0fbe3aab Mon Sep 17 00:00:00 2001 From: Steve Kirkland-Walton Date: Tue, 24 Oct 2023 23:29:25 +0100 Subject: [PATCH 08/10] Updated for changes in main branch --- test/client/appium/bb_client_test.rb | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/test/client/appium/bb_client_test.rb b/test/client/appium/bb_client_test.rb index 1671786c3..fedb05115 100644 --- a/test/client/appium/bb_client_test.rb +++ b/test/client/appium/bb_client_test.rb @@ -1,3 +1,4 @@ +require 'bugsnag' require_relative '../../test_helper' require_relative '../../../lib/maze' require_relative '../../../lib/maze/api/exit_code' @@ -33,6 +34,10 @@ def add_attempt_expectations(attempts = 1) # Driver creation expected_caps = { + 'appium' => { + 'noReset' => true, + 'newCommandTimeout' => 600 + }, 'appium:options' => { 'noReset' => true, 'newCommandTimeout' => 600 @@ -77,6 +82,7 @@ def test_start_driver_success # Successful starting of the driver @mock_driver.expects(:session_id).twice.returns 'session_id' @mock_driver.expects(:session_capabilities).returns({ 'uuid' => 'uuid' }) + Bugsnag.expects(:notify).never client = BitBarClient.new client.start_driver Maze.config @@ -102,6 +108,7 @@ def test_start_driver_recovers $logger.expects(:info).with('Created Appium session: session_id') @mock_driver.expects(:session_id).twice.returns 'session_id' @mock_driver.expects(:session_capabilities).returns({ 'uuid' => 'uuid' }) + Bugsnag.expects(:notify).never client = BitBarClient.new client.start_driver Maze.config @@ -129,6 +136,7 @@ def test_start_driver_failure $logger.expects(:error).with("Session creation failed: #{message_2}") Kernel.expects(:exit).with(::Maze::Api::ExitCode::SESSION_CREATION_FAILURE) $logger.expects(:error).with("Failed to create Appium driver, exiting") + Bugsnag.expects(:notify).twice client = BitBarClient.new client.start_driver Maze.config, 2 From 23c80739769734a78f94453725c850f8730e4e91 Mon Sep 17 00:00:00 2001 From: Steve Kirkland-Walton Date: Tue, 24 Oct 2023 23:29:47 +0100 Subject: [PATCH 09/10] Changelog and version bump --- CHANGELOG.md | 3 ++- Gemfile.lock | 2 +- lib/maze.rb | 2 +- 3 files changed, 4 insertions(+), 3 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 962203710..2dbdb82d7 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,8 +1,9 @@ -# 8.9.1 - TBD +# 8.10.0 - 2023/10/24 ## Enhancements - Add appium options in more than one place to work with older appium servers [599](https://github.com/bugsnag/maze-runner/pull/599) +- Selectively retry creation of BitBar Appium sessions depending on the error encountered [6000](https://github.com/bugsnag/maze-runner/pull/600) ## Fixes diff --git a/Gemfile.lock b/Gemfile.lock index f0171fafb..39869bbe9 100644 --- a/Gemfile.lock +++ b/Gemfile.lock @@ -9,7 +9,7 @@ GIT PATH remote: . specs: - bugsnag-maze-runner (8.9.1) + bugsnag-maze-runner (8.10.0) appium_lib (~> 12.0.0) appium_lib_core (~> 5.4.0) bugsnag (~> 6.24) diff --git a/lib/maze.rb b/lib/maze.rb index 75b1bb343..c38deb860 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 = '8.9.1' + VERSION = '8.10.0' class << self attr_accessor :check, :driver, :internal_hooks, :mode, :start_time, :dynamic_retry, :public_address, From 50c4ae563c8a4a75131a8e9fa610a8b6d84bc1ef Mon Sep 17 00:00:00 2001 From: Steve Kirkland-Walton Date: Wed, 25 Oct 2023 09:39:32 +0100 Subject: [PATCH 10/10] Date bump --- CHANGELOG.md | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 2dbdb82d7..b53df634c 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,9 +1,9 @@ -# 8.10.0 - 2023/10/24 +# 8.10.0 - 2023/10/25 ## Enhancements - Add appium options in more than one place to work with older appium servers [599](https://github.com/bugsnag/maze-runner/pull/599) -- Selectively retry creation of BitBar Appium sessions depending on the error encountered [6000](https://github.com/bugsnag/maze-runner/pull/600) +- Selectively retry creation of BitBar Appium sessions depending on the error encountered [600](https://github.com/bugsnag/maze-runner/pull/600) ## Fixes