xamarin-test-cloud 2.0.0.pre4 → 2.0.0.pre5

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
  SHA1:
3
- metadata.gz: c5abd84d95ae2a746e1d70bb479542db758b27af
4
- data.tar.gz: eadbec669fdee84204a4ce744dc9685ff5979795
3
+ metadata.gz: dead16bac1bbcbdb4ed7ff55bc656df5da6f5563
4
+ data.tar.gz: 8298ea5c4fd1b0dc179a4285a78939ee154e8e0c
5
5
  SHA512:
6
- metadata.gz: dc8a5c6fab7135a1d7094e2d347068c3c833185df051462c86042a1ffec92129d5a7d2ca8ef1df398fa1f96542c064864dc44ea626c0b5bbc69d94011a299a53
7
- data.tar.gz: f5e28ac7df1c1a5dae4a2d7aca10a031d933bf5dc866c9f090ec7161a190f3296143fa1174510db1fa15ad443541569fbae9862f3bdce3ddb26b59c6e3c0860d
6
+ metadata.gz: 622d1602faa1a5f3e1e54b5dae8a6d8165542d659cffbda2d19f441277f1039a536a461449cd9005bd6e72bb52ab85f8616bc1dee4e89d16a8fed095221fa5ee
7
+ data.tar.gz: 217a4ba762eebdbb7f69d815ce08df678e14646eab8e167a211dd69e2bf4532bd7fc4f73e370e679e34a951d5cda2cd2602ca823084a65967fa0d25379712b7f
data/CHANGELOG.md CHANGED
@@ -1,5 +1,8 @@
1
1
  ### 2.0.0
2
2
 
3
+ * Set :send\_timeout on HTTPClient to allow uploads from flakey internet
4
+ connections #45
5
+ * Support Calabash 2.0 #43
3
6
  * Replace RestClient with HTTPClient
4
7
  * Set minimum ruby version to 2.0
5
8
  * Gem does not work in Windows environment: ffi cannot be found. #34
@@ -472,7 +472,7 @@ module XamarinTestCloud
472
472
 
473
473
  response = http_post(endpoint_path, upload_data) do |response, request|
474
474
  if debug?
475
- puts "Request url: #{request.url}"
475
+ puts "Request url: #{self.host}/#{request.route}"
476
476
  puts "Response code: #{response.code}"
477
477
  puts "Response body: #{response.body}"
478
478
  end
@@ -769,7 +769,25 @@ module XamarinTestCloud
769
769
 
770
770
  if block_given?
771
771
  exec_options[:header] = {'Content-Type' => 'multipart/form-data'}
772
- exec_options[:timeout] = 90000000
772
+
773
+ # How long to wait for the files to upload.
774
+ exec_options[:send_timeout] = 30 * 60
775
+
776
+ # There is some strange behavior here. The original timeout value
777
+ # was very large: 90000000. With a large send_timeout and a modest
778
+ # receive_timeout, it is possible to get a ReceiveTimeoutError at a
779
+ # a random time between ~4 and ~20 minutes. The current working
780
+ # theory is that the original, very large, timeout is hiding some
781
+ # unexpected behavior on the server.
782
+ #
783
+ # In any event, if send_timeout is exceeeded, the client will raise
784
+ # a SendTimeoutError so this value can be very large.
785
+ exec_options[:timeout] = exec_options[:send_timeout] + 10
786
+
787
+ # Do not retry. Files are written to a stream; let the upload
788
+ # succeed or fail on the first pass.
789
+ exec_options[:retries] = 1
790
+
773
791
  response = client.post(request, exec_options)
774
792
  block.call(response, request)
775
793
  response
@@ -48,9 +48,11 @@ module XamarinTestCloud
48
48
  # @param [String] endpoint The server to make the HTTP request
49
49
  # on.
50
50
  # @param [Hash] options Control the retry, timeout, and interval.
51
- # @option options [Number] :retries (5) How often to retry.
52
- # @option options [Number] :timeout (5) How long to wait for a response
53
- # before timing out.
51
+ # @option options [Number] :retries (3) How often to retry.
52
+ # @option options [Number] :timeout (15) How long to wait for a response
53
+ # before timing out. AKA receive_timeout.
54
+ # @option options [Number] :send_timeout (120) How long to wait for an
55
+ # upload.
54
56
  # @option options [Number] :interval (0.5) How long to sleep between
55
57
  # retries.
56
58
  def initialize(endpoint, options = {})
@@ -59,6 +61,7 @@ module XamarinTestCloud
59
61
  @retries = options.fetch(:retries, 3)
60
62
  @timeout = options.fetch(:timeout, 15)
61
63
  @connect_timeout = options.fetch(:connect_timeout, 15)
64
+ @send_timeout = options.fetch(:send_timeout, 120)
62
65
  @interval = options.fetch(:interval, 0.5)
63
66
  @on_error = {}
64
67
  end
@@ -78,7 +81,9 @@ module XamarinTestCloud
78
81
  # @param [Hash] options Control the retry, timeout, and interval.
79
82
  # @option options [Number] :retries (5) How often to retry.
80
83
  # @option options [Number] :timeout (5) How long to wait for a response
81
- # before timing out.
84
+ # before timing out. AKA receive_timeout.
85
+ # @option options [Number] :send_timeout (120) How long to wait for an
86
+ # upload.
82
87
  # @option options [Number] :interval (0.5) How long to sleep between
83
88
  # retries.
84
89
  def get(request, options={})
@@ -95,9 +100,11 @@ module XamarinTestCloud
95
100
  # @param [Hash] options Control the retry, timeout, and interval.
96
101
  # @option options [Number] :retries (3) How many times to retry.
97
102
  # @option options [Number] :timeout (15) How long to wait for a response
98
- # before timing out.
103
+ # before timing out. AKA receive_timeout.
99
104
  # @option options [Number] :connect_timeout (15) How long to wait for a
100
- # connection.
105
+ # connection.
106
+ # @option options [Number] :send_timeout (120) How long to wait for an
107
+ # upload.
101
108
  # @option options [Number] :interval (0.5) How long to sleep between
102
109
  # retries.
103
110
  def post(request, options={})
@@ -110,6 +117,7 @@ module XamarinTestCloud
110
117
  retries = options.fetch(:retries, @retries)
111
118
  timeout = options.fetch(:timeout, @timeout)
112
119
  connect_timeout = options.fetch(:timeout, @connect_timeout)
120
+ send_timeout = options.fetch(:send_timeout, @send_timeout)
113
121
  interval = options.fetch(:interval, @interval)
114
122
  header = options.fetch(:header, HEADER)
115
123
 
@@ -119,6 +127,7 @@ module XamarinTestCloud
119
127
  client = @client.dup
120
128
  client.receive_timeout = timeout
121
129
  client.connect_timeout = connect_timeout
130
+ client.send_timeout = send_timeout
122
131
 
123
132
  if options.fetch(:user, nil) && options.fetch(:password, nil)
124
133
  client.set_auth(options.fetch(:user), options.fetch(:password))
@@ -129,15 +138,12 @@ module XamarinTestCloud
129
138
 
130
139
  # Subtract the aggregate time we've spent thus far to make sure we're
131
140
  # not exceeding the request timeout across retries.
132
- time_diff = start_time + timeout - Time.now
133
-
141
+ time_diff = start_time + timeout + send_timeout - Time.now
134
142
 
135
143
  if time_diff <= 0
136
- raise HTTP::Error, 'Timeout exceeded'
144
+ raise HTTP::Error, "Timeout exceeded"
137
145
  end
138
146
 
139
- client.receive_timeout = [time_diff, client.receive_timeout].min
140
-
141
147
  payload = Payload.generate(request.params)
142
148
 
143
149
  header.merge!(payload.headers) if payload
@@ -1,3 +1,3 @@
1
1
  module XamarinTestCloud
2
- VERSION = "2.0.0.pre4"
2
+ VERSION = "2.0.0.pre5"
3
3
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: xamarin-test-cloud
3
3
  version: !ruby/object:Gem::Version
4
- version: 2.0.0.pre4
4
+ version: 2.0.0.pre5
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: 2016-04-08 00:00:00.000000000 Z
12
+ date: 2016-05-04 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: thor
@@ -197,6 +197,20 @@ dependencies:
197
197
  - - "~>"
198
198
  - !ruby/object:Gem::Version
199
199
  version: '2.0'
200
+ - !ruby/object:Gem::Dependency
201
+ name: listen
202
+ requirement: !ruby/object:Gem::Requirement
203
+ requirements:
204
+ - - '='
205
+ - !ruby/object:Gem::Version
206
+ version: 3.0.6
207
+ type: :development
208
+ prerelease: false
209
+ version_requirements: !ruby/object:Gem::Requirement
210
+ requirements:
211
+ - - '='
212
+ - !ruby/object:Gem::Version
213
+ version: 3.0.6
200
214
  - !ruby/object:Gem::Dependency
201
215
  name: growl
202
216
  requirement: !ruby/object:Gem::Requirement
@@ -297,7 +311,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
297
311
  version: 1.3.1
298
312
  requirements: []
299
313
  rubyforge_project:
300
- rubygems_version: 2.5.2
314
+ rubygems_version: 2.5.1
301
315
  signing_key:
302
316
  specification_version: 4
303
317
  summary: Command-line interface to Xamarin Test Cloud