grntest 1.3.0 → 1.3.1

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
- SHA1:
3
- metadata.gz: c55e0bf4a89cc29c33e5081c6380c2652844e33a
4
- data.tar.gz: 0d469e06c4bdb6b18761d40342d0d6d436f4d6fb
2
+ SHA256:
3
+ metadata.gz: 59d77daf46cb62a91f7720b8d1564d5fdba3d52e711052f9fbd5766f08e68efe
4
+ data.tar.gz: 70994ec44ffd1616a10688c5a55bf8ad1c698762ca835188f48d1092bf02cfe4
5
5
  SHA512:
6
- metadata.gz: 95563f90d0b1d93ec3568d5996a4c43a9d3617db4ead96f843b2b13f1009702c974511caee8d1638a26b90cd1fb3dc51625e39c97903d4e7120983bc8fc13f2f
7
- data.tar.gz: aee7784eac1c012ee42ea39faba590f74044abbee1dee52ecf21d42008bdc38f3d698ce56eeb144d80ffebb7b62680f8288c2a4365277456483a434be2bf8458
6
+ metadata.gz: 305c2e818362497ae196f322aab69e67a12577715ba23ba3ac2439ae71133047c474a215fac26c074f9b464cefa8cbe8fc54007d147fbbf122a1d8abc8dd3ee8
7
+ data.tar.gz: 24f24e86fe847c5787ab4e87de9f1bc2e3dc632342fad62e07691c931f6fed1abf64f033457af565edc1d5916df9617a4b8f75071544ec801899b9acf7a2cbf4
data/doc/text/news.md CHANGED
@@ -1,5 +1,15 @@
1
1
  # News
2
2
 
3
+ ## 1.3.1: 2018-11-19
4
+
5
+ ### Improvements
6
+
7
+ * Improved HTTP related error handling.
8
+
9
+ * Added `--shutdown-wait-time` option.
10
+
11
+ * Improved shutdown process for Groonga HTTP server.
12
+
3
13
  ## 1.3.0: 2018-11-16
4
14
 
5
15
  ### Improvements
@@ -10,7 +20,7 @@
10
20
 
11
21
  ### Fixes
12
22
 
13
- * Fixed encoding error on error report.
23
+ * Fixed encoding error on error report.
14
24
 
15
25
  ## 1.2.9: 2018-01-18
16
26
 
@@ -26,6 +26,7 @@ module Grntest
26
26
  attr_accessor :read_timeout
27
27
  attr_accessor :default_timeout
28
28
  attr_accessor :default_read_timeout
29
+ attr_accessor :shutdown_wait_timeout
29
30
  attr_writer :suppress_backtrace
30
31
  attr_writer :collect_query_log
31
32
  attr_writer :debug
@@ -46,6 +47,7 @@ module Grntest
46
47
  @read_timeout = 3
47
48
  @default_timeout = @timeout
48
49
  @default_read_timeout = @read_timeout
50
+ @shutdown_wait_timeout = 5
49
51
  @omitted = false
50
52
  @suppress_backtrace = true
51
53
  @collect_query_log = false
@@ -83,7 +83,6 @@ module Grntest
83
83
  end
84
84
 
85
85
  status = nil
86
- timeout = 1
87
86
  total_sleep_time = 0
88
87
  sleep_time = 0.05
89
88
  loop do
@@ -91,7 +90,7 @@ module Grntest
91
90
  break if status
92
91
  sleep(sleep_time)
93
92
  total_sleep_time += sleep_time
94
- return false if total_sleep_time > timeout
93
+ return false if total_sleep_time > context.shutdown_wait_timeout
95
94
  end
96
95
 
97
96
  log_error(read_all_log) unless status.success?
@@ -91,6 +91,14 @@ module Grntest
91
91
  raise Error.new(message)
92
92
  rescue OpenURI::HTTPError
93
93
  $!.io.read
94
+ rescue Net::HTTPBadResponse
95
+ message = "bad response from Groonga: <#{url}>: "
96
+ message << "#{$!.class}: #{$!.message}"
97
+ raise Error.new(message)
98
+ rescue Net::HTTPHeaderSyntaxError
99
+ message = "bad HTTP header syntax in Groonga response: <#{url}>: "
100
+ message << "#{$!.class}: #{$!.message}"
101
+ raise Error.new(message)
94
102
  end
95
103
  end
96
104
 
@@ -1,4 +1,4 @@
1
- # Copyright (C) 2012-2015 Kouhei Sutou <kou@clear-code.com>
1
+ # Copyright (C) 2012-2018 Kouhei Sutou <kou@clear-code.com>
2
2
  #
3
3
  # This program is free software: you can redistribute it and/or modify
4
4
  # it under the terms of the GNU General Public License as published by
@@ -85,7 +85,6 @@ module Grntest
85
85
  @worker = worker
86
86
  @max_n_columns = MAX_N_COLUMNS
87
87
  @id = nil
88
- @shutdown_wait_timeout = 5
89
88
  end
90
89
 
91
90
  def run
@@ -143,6 +142,7 @@ module Grntest
143
142
  context.read_timeout = @tester.read_timeout
144
143
  context.default_timeout = context.timeout
145
144
  context.default_read_timeout = context.read_timeout
145
+ context.shutdown_wait_timeout = @tester.shutdown_wait_timeout
146
146
  context.suppress_backtrace = @tester.suppress_backtrace?
147
147
  context.debug = @tester.debug?
148
148
  run_groonga(context) do |executor|
@@ -379,16 +379,24 @@ call chdir("#{context.temporary_directory_path}")
379
379
  end
380
380
  yield(executor)
381
381
  ensure
382
- pid = nil if executor.shutdown(pid)
383
- if wait_groonga_http_shutdown(pid_file_path)
382
+ if executor.shutdown(pid)
383
+ pid = nil
384
+ else
385
+ wait_groonga_http_shutdown(pid_file_path)
384
386
  pid = nil if wait_pid(pid)
385
387
  end
386
388
  end
387
389
  ensure
388
- return if pid.nil?
389
- Process.kill(:TERM, pid)
390
- wait_groonga_http_shutdown(pid_file_path)
391
- ensure_process_finished(pid)
390
+ if pid
391
+ begin
392
+ Process.kill(:TERM, pid)
393
+ rescue SystemCallError => error
394
+ $stderr.puts("TERM -> #{pid}: #{error.class}: #{error}")
395
+ else
396
+ wait_groonga_http_shutdown(pid_file_path)
397
+ ensure_process_finished(pid)
398
+ end
399
+ end
392
400
  end
393
401
  end
394
402
 
@@ -425,21 +433,18 @@ call chdir("#{context.temporary_directory_path}")
425
433
  return true if Process.waitpid(pid, Process::WNOHANG)
426
434
  sleep(sleep_time)
427
435
  total_sleep_time += sleep_time
428
- return false if total_sleep_time > @shutdown_wait_timeout
436
+ return false if total_sleep_time > @tester.shutdown_wait_timeout
429
437
  end
430
438
  end
431
439
 
432
440
  def wait_groonga_http_shutdown(pid_file_path)
433
- return false unless pid_file_path.exist?
434
-
435
441
  total_sleep_time = 0
436
442
  sleep_time = 0.1
437
443
  while pid_file_path.exist?
438
444
  sleep(sleep_time)
439
445
  total_sleep_time += sleep_time
440
- break if total_sleep_time > @shutdown_wait_timeout
446
+ break if total_sleep_time > @tester.shutdown_wait_timeout
441
447
  end
442
- true
443
448
  end
444
449
 
445
450
  def groonga_http_command(host, port, pid_file_path, context, spawn_options)
@@ -236,6 +236,12 @@ module Grntest
236
236
  tester.n_retries = n
237
237
  end
238
238
 
239
+ parser.on("--shutdown-wait-timeout=SECOND", Float,
240
+ "Timeout for waiting shutdown",
241
+ "(#{tester.shutdown_wait_timeout})") do |timeout|
242
+ tester.shutdown_wait_timeout = timeout
243
+ end
244
+
239
245
  parser.on("--version",
240
246
  "Show version and exit") do
241
247
  puts(VERSION)
@@ -288,6 +294,7 @@ module Grntest
288
294
  attr_reader :test_patterns, :test_suite_patterns
289
295
  attr_reader :exclude_test_patterns, :exclude_test_suite_patterns
290
296
  attr_accessor :n_retries
297
+ attr_accessor :shutdown_wait_timeout
291
298
  def initialize
292
299
  @groonga = "groonga"
293
300
  @groonga_httpd = "groonga-httpd"
@@ -319,6 +326,7 @@ module Grntest
319
326
  @timeout = 5
320
327
  @read_timeout = 3
321
328
  @n_retries = 0
329
+ @shutdown_wait_timeout = 5
322
330
  end
323
331
 
324
332
  def run(*targets)
@@ -14,5 +14,5 @@
14
14
  # along with this program. If not, see <http://www.gnu.org/licenses/>.
15
15
 
16
16
  module Grntest
17
- VERSION = "1.3.0"
17
+ VERSION = "1.3.1"
18
18
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: grntest
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.3.0
4
+ version: 1.3.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Kouhei Sutou
@@ -9,7 +9,7 @@ authors:
9
9
  autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
- date: 2018-11-16 00:00:00.000000000 Z
12
+ date: 2018-11-19 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: json
@@ -219,13 +219,13 @@ required_rubygems_version: !ruby/object:Gem::Requirement
219
219
  version: '0'
220
220
  requirements: []
221
221
  rubyforge_project:
222
- rubygems_version: 2.5.2.1
222
+ rubygems_version: 3.0.0.beta2
223
223
  signing_key:
224
224
  specification_version: 4
225
225
  summary: Grntest is a testing framework for Groonga. You can write a test for Groonga
226
226
  by writing Groonga commands and expected result.
227
227
  test_files:
228
+ - test/run-test.rb
228
229
  - test/executors/test-base-executor.rb
229
230
  - test/executors/test-standard-io-executor.rb
230
- - test/run-test.rb
231
231
  - test/test-log-parser.rb