gridium 1.1.43 → 1.1.44

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.
Files changed (3) hide show
  1. checksums.yaml +4 -4
  2. data/lib/testrail.rb +19 -10
  3. metadata +3 -3
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 7a49d49ad1dd013a81d6662299c835cee9e31e27
4
- data.tar.gz: de9f5db96026e7013c2494fd62d446b2343c6645
3
+ metadata.gz: c2ed3fbe98e8700733f20c857e5afcc148d3565f
4
+ data.tar.gz: 71ecde169ce38c8ea42bf55a10c5ea3460db6cc3
5
5
  SHA512:
6
- metadata.gz: 378692d04fba89ea77ed68895b47ceb42e9c7746e3a1ed4a30bf3a8a978aeec3f744699f4d29172498a997a0c0cbe1827ed743aabbca284e9340cf3e8f3c02ed
7
- data.tar.gz: 1c4c33c9abf6a768eaf903e74c5b36a69bcdb9577fbfb9ad125db0556ee6c68a70fae6086a6fc1efe01bf35a27bc14774a1a97e8e3593d6ca33b6b2185071725
6
+ metadata.gz: dc064b792f2a2f76013e0e70057bd0592973ef15c85af8483bd9a489df2983464d41e632d6c25ffb6b5f56f6ffa12ab102d81c0bdfdfc3ac1496eb898eef063d
7
+ data.tar.gz: 9c3744349f50462706175d363127578862860b774ee014944168ec114863ecfa9d5336d61e04bf2819555801267d9b2389fc5e49fe4cf6e66c889fd095ba3563
@@ -94,7 +94,7 @@ module Gridium
94
94
  # Updates the existing test run with test cases and results. Adds error text for missing test cases if needed. Closes the run as long as it exists.
95
95
  #
96
96
  # @return [bool] if the run was closed or not
97
- def close_run
97
+ def close_run(opts = {})
98
98
  closed = false
99
99
  if Gridium.config.testrail && !@run_info[:error]
100
100
  Log.debug("[GRIDIUM::TestRail] Closing test runid: #{@run_info[:id]}\n")
@@ -108,22 +108,30 @@ module Gridium
108
108
  Log.debug("[GRIDIUM::TestRail] #{r.class}")
109
109
  if r.is_a?(Hash)
110
110
  r = _send_request('POST', "#{@url}update_run/#{@run_info[:id]}", {:name => "ER:#{@run_info[:name]}", :description => "#{@run_info[:desc]}\nThe following was returned when adding cases: #{r}"})
111
- Log.warn("[GRIDIUM::TestRail] ERROR: #{r}")
111
+ Log.error("[GRIDIUM::TestRail] ERROR: #{r}")
112
112
  sleep 0.25
113
113
  end
114
114
  end
115
- r = _send_request('POST', "#{@url}close_run/#{@run_info[:id]}", nil)
115
+ r = _send_request('POST', "#{@url}close_run/#{@run_info[:id]}", nil, opts)
116
+
116
117
  Log.debug("[GRIDIUM::TestRail] CLOSE RUN: #{r}")
117
- closed = true
118
+ if r.has_key?("error")
119
+ Log.error("[GRIDIUM::TestRail]: #{r}")
120
+ else
121
+ closed = true
122
+ end
118
123
  end
119
- return closed
124
+
125
+ closed
120
126
  end
121
127
 
122
128
  private
123
- def _send_request(method, uri, data)
129
+ def _send_request(method, uri, data, opts = {})
130
+ read_timeout = opts[:read_timeout]
124
131
  attempts = @retry_attempts
125
132
  url = URI.parse(uri)
126
133
  Log.debug("[GRIDIUM::TestRail] Method: #{method} URL:#{uri} Data:#{data}")
134
+
127
135
  if method == 'POST'
128
136
  request = Net::HTTP::Post.new(url.path + '?' + url.query)
129
137
  request.body = JSON.dump(data)
@@ -134,6 +142,7 @@ module Gridium
134
142
  request.add_field('Content-Type', 'application/json')
135
143
 
136
144
  conn = Net::HTTP.new(url.host, url.port)
145
+ conn.read_timeout = read_timeout if read_timeout
137
146
  if url.scheme == 'https'
138
147
  conn.use_ssl = true
139
148
  conn.verify_mode = OpenSSL::SSL::VERIFY_NONE
@@ -154,15 +163,15 @@ module Gridium
154
163
  end
155
164
  Log.error("[GRIDIUM::TestRail] #{response.code} - Error with request: #{error}")
156
165
  end
157
- rescue SocketError => error
158
- Log.warn("[GRIDIUM::TestRail] SocketError - Retrying....")
166
+ rescue SocketError, Net::ReadTimeout => error
167
+ Log.warn("[GRIDIUM::TestRail] Error - Retrying....")
159
168
  if attempts > 0
160
169
  attempts -= 1
161
170
  sleep @time_between_retries
162
171
  retry
163
172
  end
164
- Log.error("[GRIDIUM::TestRail] Socket Error after numerous attempts. Error: #{error}")
165
- result = {error: "SocketError after #{@retry_attempts} attempts. See Error Log."}
173
+ Log.error("[GRIDIUM::TestRail] Error after numerous attempts. Error: #{error}")
174
+ result = {error: "Error after #{@retry_attempts} attempts. See Error Log."}
166
175
  end
167
176
 
168
177
  result
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: gridium
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.1.43
4
+ version: 1.1.44
5
5
  platform: ruby
6
6
  authors:
7
7
  - Seth Urban
8
8
  autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2017-10-24 00:00:00.000000000 Z
11
+ date: 2018-01-25 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: bundler
@@ -182,7 +182,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
182
182
  version: '0'
183
183
  requirements: []
184
184
  rubyforge_project:
185
- rubygems_version: 2.6.14
185
+ rubygems_version: 2.5.2
186
186
  signing_key:
187
187
  specification_version: 4
188
188
  summary: This Gem is used to make building Selenium Tests without Capybara Easier.