run_loop 4.4.2 → 4.5.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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: bc8b6d847d88f423c9e9165247e47a10bb942f609321a7d85c9611bd2e2d1d32
4
- data.tar.gz: 89f087b5c34de630cb94c4b365352285cffc283bf112a8906cc50f11c5ce8e9e
3
+ metadata.gz: 4a5c25ee5ae80a0b35f8c35d252a3ecd2df9f2e739850f0d6bc9fed1603ab608
4
+ data.tar.gz: ae0646d4427e7ff39b681d5e2bb824b7000c2ce17dce6c702443c376b0bab5ff
5
5
  SHA512:
6
- metadata.gz: cfaedefa2969f8bc84213f6dcef5a4f71f64d780fc942b189c196f42d4e7305e7b4d8cde0c3fd713a51ee462b430e5ca68b8c07880f71b9ad6c44b57103b70a1
7
- data.tar.gz: 01fd321ff78d7474894ebe3c21365738e7fafd0a65b036265c72d57d893bc4f346102ee932598e50f658b7367486dd8b64e2f176cf45f453708a05bf5c4cb60a
6
+ metadata.gz: fead38a3a95ad67e7e34119043b02eccc3e933070a152fde186612da2e7028686304c9ef43bff17186c49d707df32c81ee659f54ef913f5896eb0e2d1e8d3d58
7
+ data.tar.gz: d58e00d207ccff3503d2fe2f1e2d1492c803c8e91630e6485d51de574807ca4f045e3da2c33d09175404c2053e694a6fec33de9fc3366661386f81b9348629fb
@@ -57,7 +57,11 @@ module RunLoop
57
57
  # using XCUIElement#typeText. It corresponds to the DeviceAgent
58
58
  # constant CBX_DEFAULT_SEND_STRING_FREQUENCY which is 60. _Decrease_
59
59
  # this value if you are timing out typing strings.
60
- :characters_per_second => 12
60
+ :characters_per_second => 12,
61
+
62
+ # The number of attempts for relaunch DeviceAgent
63
+ # when health check is failed
64
+ :device_agent_launch_retries => 3
61
65
  }
62
66
 
63
67
  AUT_LAUNCHED_BY_RUN_LOOP_ARG = "LAUNCHED_BY_RUN_LOOP"
@@ -160,6 +164,8 @@ module RunLoop
160
164
  DEFAULTS[:shutdown_device_agent_before_launch])
161
165
  terminate_aut_before_test = options.fetch(:terminate_aut_before_test,
162
166
  DEFAULTS[:terminate_aut_before_test])
167
+ device_agent_launch_retries = options.fetch(:device_agent_launch_retries,
168
+ DEFAULTS[:device_agent_launch_retries])
163
169
 
164
170
  aut_args = options.fetch(:args, [])
165
171
  aut_env = options.fetch(:env, {})
@@ -176,7 +182,8 @@ module RunLoop
176
182
  terminate_aut_before_test: terminate_aut_before_test,
177
183
  dylib_injection_details: dylib_injection_details,
178
184
  aut_args: aut_args,
179
- aut_env: aut_env
185
+ aut_env: aut_env,
186
+ device_agent_launch_retries: device_agent_launch_retries
180
187
  }
181
188
 
182
189
  xcuitest = RunLoop::DeviceAgent::Client.new(bundle_id, device,
@@ -291,6 +298,11 @@ INSTANCE METHODS
291
298
  default = DEFAULTS[:device_agent_install_timeout]
292
299
  @launcher_options[:device_agent_install_timeout] = default
293
300
  end
301
+
302
+ if !@launcher_options[:device_agent_launch_retries]
303
+ default = DEFAULTS[:device_agent_launch_retries]
304
+ @launcher_options[:device_agent_launch_retries] = default
305
+ end
294
306
  end
295
307
 
296
308
  # @!visibility private
@@ -1471,10 +1483,11 @@ If the body empty, the DeviceAgent has probably crashed.
1471
1483
 
1472
1484
  start = Time.now
1473
1485
  RunLoop.log_debug("Waiting for DeviceAgent to launch...")
1474
- @launcher_pid = cbx_launcher.launch(options)
1475
-
1486
+
1476
1487
  begin
1477
- timeout = options[:device_agent_install_timeout] * 1.5
1488
+ retries ||= 0
1489
+ @launcher_pid = cbx_launcher.launch(options)
1490
+ timeout = options[:device_agent_install_timeout] * 0.5
1478
1491
  health_options = {
1479
1492
  :timeout => timeout,
1480
1493
  :interval => 0.1,
@@ -1482,6 +1495,11 @@ If the body empty, the DeviceAgent has probably crashed.
1482
1495
  }
1483
1496
  health(health_options)
1484
1497
  rescue RunLoop::HTTP::Error => _
1498
+ retries += 1
1499
+ sleep(2.0)
1500
+ RunLoop.log_debug("Could not connect to DeviceAgent service on try #{retries + 1}; will retry")
1501
+ shutdown
1502
+ retry if (retries) <= options[:device_agent_launch_retries]
1485
1503
  raise %Q[
1486
1504
 
1487
1505
  Could not connect to the DeviceAgent service.
@@ -1,5 +1,5 @@
1
1
  module RunLoop
2
- VERSION = "4.4.2"
2
+ VERSION = "4.5.0"
3
3
 
4
4
  # A model of a software release version that can be used to compare two versions.
5
5
  #
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: run_loop
3
3
  version: !ruby/object:Gem::Version
4
- version: 4.4.2
4
+ version: 4.5.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Karl Krukow
@@ -9,7 +9,7 @@ authors:
9
9
  autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
- date: 2019-10-21 00:00:00.000000000 Z
12
+ date: 2019-11-12 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: json