raindrops 0.13.0 → 0.20.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.
Files changed (49) hide show
  1. checksums.yaml +7 -0
  2. data/.document +1 -2
  3. data/.gitattributes +4 -0
  4. data/.gitignore +1 -1
  5. data/.manifest +7 -5
  6. data/.olddoc.yml +16 -0
  7. data/GIT-VERSION-FILE +1 -1
  8. data/GIT-VERSION-GEN +1 -1
  9. data/GNUmakefile +1 -2
  10. data/LATEST +6 -11
  11. data/LICENSE +3 -3
  12. data/NEWS +158 -0
  13. data/README +33 -40
  14. data/TODO +2 -0
  15. data/archive/.gitignore +3 -0
  16. data/archive/slrnpull.conf +4 -0
  17. data/examples/linux-listener-stats.rb +1 -2
  18. data/examples/watcher_demo.ru +1 -1
  19. data/examples/yahns.conf.rb +30 -0
  20. data/examples/zbatery.conf.rb +4 -1
  21. data/ext/raindrops/extconf.rb +107 -2
  22. data/ext/raindrops/linux_inet_diag.c +94 -101
  23. data/ext/raindrops/raindrops.c +75 -21
  24. data/ext/raindrops/tcp_info.c +245 -0
  25. data/lib/raindrops/aggregate/last_data_recv.rb +1 -5
  26. data/lib/raindrops/aggregate/pmq.rb +23 -17
  27. data/lib/raindrops/aggregate.rb +1 -1
  28. data/lib/raindrops/linux.rb +5 -6
  29. data/lib/raindrops/middleware/proxy.rb +2 -2
  30. data/lib/raindrops/middleware.rb +4 -6
  31. data/lib/raindrops/watcher.rb +13 -13
  32. data/lib/raindrops.rb +25 -1
  33. data/pkg.mk +26 -50
  34. data/raindrops.gemspec +14 -21
  35. data/test/ipv6_enabled.rb +4 -4
  36. data/test/test_aggregate_pmq.rb +1 -1
  37. data/test/test_inet_diag_socket.rb +1 -1
  38. data/test/test_last_data_recv_unicorn.rb +1 -1
  39. data/test/test_linux.rb +10 -2
  40. data/test/test_linux_all_tcp_listen_stats_leak.rb +2 -2
  41. data/test/test_linux_ipv6.rb +8 -0
  42. data/test/test_raindrops.rb +43 -1
  43. data/test/{test_linux_tcp_info.rb → test_tcp_info.rb} +34 -14
  44. data/test/test_watcher.rb +15 -10
  45. metadata +59 -171
  46. data/.wrongdoc.yml +0 -6
  47. data/ChangeLog +0 -1920
  48. data/Rakefile +0 -28
  49. data/ext/raindrops/linux_tcp_info.c +0 -173
data/pkg.mk CHANGED
@@ -1,7 +1,8 @@
1
1
  RUBY = ruby
2
2
  RAKE = rake
3
3
  RSYNC = rsync
4
- WRONGDOC = wrongdoc
4
+ OLDDOC = olddoc
5
+ RDOC = rdoc
5
6
 
6
7
  GIT-VERSION-FILE: .FORCE-GIT-VERSION-FILE
7
8
  @./GIT-VERSION-GEN
@@ -12,14 +13,6 @@ RUBY_VERSION := $(shell $(RUBY) -e 'puts RUBY_VERSION')
12
13
  RUBY_ENGINE := $(shell $(RUBY) -e 'puts((RUBY_ENGINE rescue "ruby"))')
13
14
  lib := lib
14
15
 
15
- ifeq ($(shell test -f script/isolate_for_tests && echo t),t)
16
- isolate_libs := tmp/isolate/$(RUBY_ENGINE)-$(RUBY_VERSION)/isolate.mk
17
- $(isolate_libs): script/isolate_for_tests
18
- @$(RUBY) script/isolate_for_tests
19
- -include $(isolate_libs)
20
- lib := $(lib):$(ISOLATE_LIBS)
21
- endif
22
-
23
16
  ext := $(firstword $(wildcard ext/*))
24
17
  ifneq ($(ext),)
25
18
  ext_pfx := tmp/ext/$(RUBY_ENGINE)-$(RUBY_VERSION)
@@ -36,7 +29,7 @@ $(ext_pfx)/$(ext)/%: $(ext)/% $(ext_d)
36
29
  install -m 644 $< $@
37
30
  $(ext_pfx)/$(ext)/Makefile: $(ext)/extconf.rb $(ext_d) $(ext_h)
38
31
  $(RM) -f $(@D)/*.o
39
- cd $(@D) && $(RUBY) $(CURDIR)/$(ext)/extconf.rb
32
+ cd $(@D) && $(RUBY) $(CURDIR)/$(ext)/extconf.rb $(EXTCONF_ARGS)
40
33
  ext_sfx := _ext.$(DLEXT)
41
34
  ext_dl := $(ext_pfx)/$(ext)/$(notdir $(ext)_ext.$(DLEXT))
42
35
  $(ext_dl): $(ext_src) $(ext_pfx_src) $(ext_pfx)/$(ext)/Makefile
@@ -48,10 +41,10 @@ else
48
41
  build:
49
42
  endif
50
43
 
51
- pkg_extra += GIT-VERSION-FILE NEWS ChangeLog LATEST
52
- ChangeLog: GIT-VERSION-FILE .wrongdoc.yml
53
- $(WRONGDOC) prepare
54
- NEWS LATEST: ChangeLog
44
+ pkg_extra += GIT-VERSION-FILE NEWS LATEST
45
+ NEWS: GIT-VERSION-FILE .olddoc.yml
46
+ $(OLDDOC) prepare
47
+ LATEST: NEWS
55
48
 
56
49
  manifest:
57
50
  $(RM) .manifest
@@ -63,28 +56,20 @@ manifest:
63
56
  cmp $@+ $@ || mv $@+ $@
64
57
  $(RM) $@+
65
58
 
66
- doc:: .document .wrongdoc.yml $(pkg_extra)
59
+ doc:: .document .olddoc.yml $(pkg_extra) $(PLACEHOLDERS)
67
60
  -find lib -type f -name '*.rbc' -exec rm -f '{}' ';'
68
61
  -find ext -type f -name '*.rbc' -exec rm -f '{}' ';'
69
62
  $(RM) -r doc
70
- $(WRONGDOC) all
63
+ $(RDOC) -f dark216
64
+ $(OLDDOC) merge
71
65
  install -m644 COPYING doc/COPYING
66
+ install -m644 NEWS doc/NEWS
67
+ install -m644 NEWS.atom.xml doc/NEWS.atom.xml
72
68
  install -m644 $(shell LC_ALL=C grep '^[A-Z]' .document) doc/
73
69
 
74
70
  ifneq ($(VERSION),)
75
71
  pkggem := pkg/$(rfpackage)-$(VERSION).gem
76
72
  pkgtgz := pkg/$(rfpackage)-$(VERSION).tgz
77
- release_notes := release_notes-$(VERSION)
78
- release_changes := release_changes-$(VERSION)
79
-
80
- release-notes: $(release_notes)
81
- release-changes: $(release_changes)
82
- $(release_changes):
83
- $(WRONGDOC) release_changes > $@+
84
- $(VISUAL) $@+ && test -s $@+ && mv $@+ $@
85
- $(release_notes):
86
- $(WRONGDOC) release_notes > $@+
87
- $(VISUAL) $@+ && test -s $@+ && mv $@+ $@
88
73
 
89
74
  # ensures we're actually on the tagged $(VERSION), only used for release
90
75
  verify:
@@ -101,7 +86,7 @@ fix-perms:
101
86
  gem: $(pkggem)
102
87
 
103
88
  install-gem: $(pkggem)
104
- gem install $(CURDIR)/$<
89
+ gem install --local $(CURDIR)/$<
105
90
 
106
91
  $(pkggem): manifest fix-perms
107
92
  gem build $(rfpackage).gemspec
@@ -120,31 +105,18 @@ $(pkgtgz): manifest fix-perms
120
105
 
121
106
  package: $(pkgtgz) $(pkggem)
122
107
 
123
- test-release:: verify package $(release_notes) $(release_changes)
124
- # make tgz release on RubyForge
125
- @echo rubyforge add_release -f \
126
- -n $(release_notes) -a $(release_changes) \
127
- $(rfproject) $(rfpackage) $(VERSION) $(pkgtgz)
128
- @echo gem push $(pkggem)
129
- @echo rubyforge add_file \
130
- $(rfproject) $(rfpackage) $(VERSION) $(pkggem)
131
- release:: verify package $(release_notes) $(release_changes)
132
- # make tgz release on RubyForge
133
- rubyforge add_release -f -n $(release_notes) -a $(release_changes) \
134
- $(rfproject) $(rfpackage) $(VERSION) $(pkgtgz)
108
+ release:: verify package
135
109
  # push gem to RubyGems.org
136
110
  gem push $(pkggem)
137
- # in case of gem downloads from RubyForge releases page
138
- rubyforge add_file \
139
- $(rfproject) $(rfpackage) $(VERSION) $(pkggem)
140
111
  else
141
112
  gem install-gem: GIT-VERSION-FILE
142
113
  $(MAKE) $@ VERSION=$(GIT_VERSION)
143
114
  endif
144
115
 
145
- all:: test
116
+ all:: check
146
117
  test_units := $(wildcard test/test_*.rb)
147
- test: test-unit
118
+ test: check
119
+ check: test-unit
148
120
  test-unit: $(test_units)
149
121
  $(test_units): build
150
122
  $(RUBY) -I $(lib) $@ $(RUBY_TEST_OPTS)
@@ -154,16 +126,15 @@ ifneq ($(RSYNC_DEST),)
154
126
  publish_doc:
155
127
  -git set-file-times
156
128
  $(MAKE) doc
157
- find doc/images -type f | \
158
- TZ=UTC xargs touch -d '1970-01-01 00:00:06' doc/rdoc.css
159
129
  $(MAKE) doc_gz
160
- $(RSYNC) -av doc/ $(RSYNC_DEST)/
130
+ $(RSYNC) -av doc/ $(RSYNC_DEST)/ \
131
+ --exclude index.html* --exclude created.rid*
161
132
  git ls-files | xargs touch
162
133
  endif
163
134
 
164
135
  # Create gzip variants of the same timestamp as the original so nginx
165
136
  # "gzip_static on" can serve the gzipped versions directly.
166
- doc_gz: docs = $(shell find doc -type f ! -regex '^.*\.\(gif\|jpg\|png\|gz\)$$')
137
+ doc_gz: docs = $(shell find doc -type f ! -regex '^.*\.gz$$')
167
138
  doc_gz:
168
139
  for i in $(docs); do \
169
140
  gzip --rsyncable -9 < $$i > $$i.gz; touch -r $$i $$i.gz; done
@@ -171,5 +142,10 @@ check-warnings:
171
142
  @(for i in $$(git ls-files '*.rb'| grep -v '^setup\.rb$$'); \
172
143
  do $(RUBY) -d -W2 -c $$i; done) | grep -v '^Syntax OK$$' || :
173
144
 
174
- .PHONY: all .FORCE-GIT-VERSION-FILE doc test $(test_units) manifest
145
+ ifneq ($(PLACEHOLDERS),)
146
+ $(PLACEHOLDERS):
147
+ echo olddoc_placeholder > $@
148
+ endif
149
+
150
+ .PHONY: all .FORCE-GIT-VERSION-FILE doc check test $(test_units) manifest
175
151
  .PHONY: check-warnings
data/raindrops.gemspec CHANGED
@@ -1,33 +1,26 @@
1
1
  # -*- encoding: binary -*-
2
- ENV["VERSION"] or abort "VERSION= must be specified"
3
- manifest = File.readlines('.manifest').map! { |x| x.chomp! }
2
+ manifest = File.exist?('.manifest') ?
3
+ IO.readlines('.manifest').map!(&:chomp!) : `git ls-files`.split("\n")
4
4
  test_files = manifest.grep(%r{\Atest/test_.*\.rb\z})
5
- require 'wrongdoc'
6
- extend Wrongdoc::Gemspec
7
- name, summary, title = readme_metadata
8
5
 
9
6
  Gem::Specification.new do |s|
10
7
  s.name = %q{raindrops}
11
- s.version = ENV["VERSION"].dup
12
-
8
+ s.version = (ENV["VERSION"] ||= '0.18.0').dup
13
9
  s.authors = ["raindrops hackers"]
14
- s.date = Time.now.utc.strftime('%Y-%m-%d')
15
- s.description = readme_description
16
- s.email = %q{raindrops@librelist.org}
10
+ s.description = File.read('README').split("\n\n")[1]
11
+ s.email = %q{raindrops-public@yhbt.net}
17
12
  s.extensions = %w(ext/raindrops/extconf.rb)
18
- s.extra_rdoc_files = extra_rdoc_files(manifest)
13
+ s.extra_rdoc_files = IO.readlines('.document').map!(&:chomp!).keep_if do |f|
14
+ File.exist?(f)
15
+ end
19
16
  s.files = manifest
20
- s.homepage = Wrongdoc.config[:rdoc_url]
21
- s.summary = summary
22
- s.rdoc_options = rdoc_options
23
- s.rubyforge_project = %q{rainbows}
17
+ s.homepage = 'https://yhbt.net/raindrops/'
18
+ s.summary = 'real-time stats for preforking Rack servers'
19
+ s.required_ruby_version = '>= 1.9.3'
24
20
  s.test_files = test_files
25
21
  s.add_development_dependency('aggregate', '~> 0.2')
26
- s.add_development_dependency('io-extra', [ '~> 1.2', '>= 1.2.3'])
22
+ s.add_development_dependency('test-unit', '~> 3.0')
27
23
  s.add_development_dependency('posix_mq', '~> 2.0')
28
- s.add_development_dependency('rack', '~> 1.2')
29
- s.add_development_dependency('unicorn', '>= 0.98')
30
- s.add_development_dependency('wrongdoc', ['~> 1.6.2', '>= 1.6.2'])
31
-
32
- s.licenses = %w(LGPLv2.1+)
24
+ s.add_development_dependency('rack', [ '>= 1.2', '< 3.0' ])
25
+ s.licenses = %w(LGPL-2.1+)
33
26
  end
data/test/ipv6_enabled.rb CHANGED
@@ -2,8 +2,8 @@ def ipv6_enabled?
2
2
  tmp = TCPServer.new(ENV["TEST_HOST6"] || '::1', 0)
3
3
  tmp.close
4
4
  true
5
- rescue => e
6
- warn "skipping IPv6 tests, host does not seem to be IPv6 enabled:"
7
- warn " #{e.class}: #{e}"
8
- false
5
+ rescue => e
6
+ warn "skipping IPv6 tests, host does not seem to be IPv6 enabled:"
7
+ warn " #{e.class}: #{e}"
8
+ false
9
9
  end
@@ -3,7 +3,7 @@ require "raindrops"
3
3
  pmq = begin
4
4
  Raindrops::Aggregate::PMQ
5
5
  rescue LoadError => e
6
- warn "W: #{e} skipping test"
6
+ warn "W: #{e} skipping #{__FILE__}"
7
7
  false
8
8
  end
9
9
  if RUBY_VERSION.to_f < 1.9
@@ -8,7 +8,7 @@ class TestInetDiagSocket < Test::Unit::TestCase
8
8
  def test_new
9
9
  sock = Raindrops::InetDiagSocket.new
10
10
  assert_kind_of Socket, sock
11
- assert_kind_of Fixnum, sock.fileno
11
+ assert_kind_of Integer, sock.fileno
12
12
  flags = sock.fcntl(Fcntl::F_GETFD)
13
13
  assert_equal Fcntl::FD_CLOEXEC, flags & Fcntl::FD_CLOEXEC
14
14
  assert_nil sock.close
@@ -7,7 +7,7 @@ $stderr.sync = $stdout.sync = true
7
7
  pmq = begin
8
8
  Raindrops::Aggregate::PMQ
9
9
  rescue LoadError => e
10
- warn "W: #{e} skipping test"
10
+ warn "W: #{e} skipping #{__FILE__}"
11
11
  false
12
12
  end
13
13
  if RUBY_VERSION.to_f < 1.9
data/test/test_linux.rb CHANGED
@@ -76,6 +76,7 @@ class TestLinux < Test::Unit::TestCase
76
76
 
77
77
  assert_equal 0, stats[tmp.path].active
78
78
  assert_equal 0, stats[tmp.path].queued
79
+ us.close
79
80
  end
80
81
 
81
82
  def test_unix_resolves_symlinks
@@ -151,8 +152,8 @@ class TestLinux < Test::Unit::TestCase
151
152
  assert_equal 1, stats.size
152
153
  assert_equal 0, stats[addr].queued
153
154
  assert_equal 1, stats[addr].active
154
- ensure
155
- nlsock.close
155
+ ensure
156
+ nlsock.close
156
157
  end
157
158
 
158
159
  def test_tcp_multi
@@ -214,6 +215,13 @@ class TestLinux < Test::Unit::TestCase
214
215
  assert_equal 0, stats[addr1].active
215
216
  assert_equal 1, stats[addr2].queued
216
217
  assert_equal 1, stats[addr2].active
218
+
219
+ # make sure we don't leave "true" placeholders in results if a
220
+ # listener becomes invalid (even momentarily).
221
+ s2.close
222
+ stats = tcp_listener_stats(addrs)
223
+ assert stats.values.all? { |x| x.instance_of?(Raindrops::ListenStats) },
224
+ "placeholders left: #{stats.inspect}"
217
225
  end
218
226
 
219
227
  # tries to overflow buffers
@@ -37,7 +37,7 @@ class TestLinuxAllTcpListenStatsLeak < Test::Unit::TestCase
37
37
  end
38
38
  cur_kb = rss_kb
39
39
  p [ :cur_kb, cur_kb ]
40
- ensure
41
- s.close
40
+ ensure
41
+ s.close
42
42
  end
43
43
  end if ENV["STRESS"].to_i != 0
@@ -12,6 +12,14 @@ class TestLinuxIPv6 < Test::Unit::TestCase
12
12
 
13
13
  TEST_ADDR = ENV["TEST_HOST6"] || "::1"
14
14
 
15
+ def setup
16
+ @to_close = []
17
+ end
18
+
19
+ def teardown
20
+ @to_close.each { |io| io.close unless io.closed? }
21
+ end
22
+
15
23
  def test_tcp
16
24
  s = TCPServer.new(TEST_ADDR, 0)
17
25
  port = s.addr[1]
@@ -1,6 +1,7 @@
1
1
  # -*- encoding: binary -*-
2
2
  require 'test/unit'
3
3
  require 'raindrops'
4
+ require 'tempfile'
4
5
 
5
6
  class TestRaindrops < Test::Unit::TestCase
6
7
 
@@ -134,7 +135,7 @@ class TestRaindrops < Test::Unit::TestCase
134
135
  assert_equal 0, rd[rd.capa - 1]
135
136
  assert_equal 1, rd.incr(rd.capa - 1)
136
137
  assert_raises(ArgumentError) { rd[rd.capa] }
137
- rescue RangeError
138
+ rescue RangeError
138
139
  end # if RUBY_PLATFORM =~ /linux/
139
140
 
140
141
  def test_evaporate
@@ -162,4 +163,45 @@ class TestRaindrops < Test::Unit::TestCase
162
163
  assert status.success?
163
164
  assert_equal [ 1, 2 ], tmp.to_ary
164
165
  end
166
+
167
+ def test_io_backed
168
+ file = Tempfile.new('test_io_backed')
169
+ rd = Raindrops.new(4, io: file, zero: true)
170
+ rd[0] = 123
171
+ rd[1] = 456
172
+
173
+ assert_equal 123, rd[0]
174
+ assert_equal 456, rd[1]
175
+
176
+ rd.evaporate!
177
+
178
+ file.rewind
179
+ data = file.read
180
+ assert_equal 123, data.unpack('L!')[0]
181
+ assert_equal 456, data[Raindrops::SIZE..data.size].unpack('L!')[0]
182
+ end
183
+
184
+ def test_io_backed_reuse
185
+ file = Tempfile.new('test_io_backed')
186
+ rd = Raindrops.new(4, io: file, zero: true)
187
+ rd[0] = 123
188
+ rd[1] = 456
189
+ rd.evaporate!
190
+
191
+ rd = Raindrops.new(4, io: file, zero: false)
192
+ assert_equal 123, rd[0]
193
+ assert_equal 456, rd[1]
194
+ end
195
+
196
+ def test_iobacked_noreuse
197
+ file = Tempfile.new('test_io_backed')
198
+ rd = Raindrops.new(4, io: file, zero: true)
199
+ rd[0] = 123
200
+ rd[1] = 456
201
+ rd.evaporate!
202
+
203
+ rd = Raindrops.new(4, io: file, zero: true)
204
+ assert_equal 0, rd[0]
205
+ assert_equal 0, rd[1]
206
+ end
165
207
  end
@@ -5,15 +5,15 @@ require 'raindrops'
5
5
  require 'socket'
6
6
  require 'pp'
7
7
  $stderr.sync = $stdout.sync = true
8
- class TestLinuxTCP_Info < Test::Unit::TestCase
8
+ class TestTCP_Info < Test::Unit::TestCase
9
9
 
10
10
  TEST_ADDR = ENV['UNICORN_TEST_ADDR'] || '127.0.0.1'
11
11
 
12
12
  # Linux kernel commit 5ee3afba88f5a79d0bff07ddd87af45919259f91
13
13
  TCP_INFO_useful_listenq = `uname -r`.strip >= '2.6.24'
14
14
 
15
-
16
- def test_tcp_server
15
+ def test_tcp_server_unacked
16
+ return if RUBY_PLATFORM !~ /linux/ # unacked not implemented on others...
17
17
  s = TCPServer.new(TEST_ADDR, 0)
18
18
  rv = Raindrops::TCP_Info.new s
19
19
  c = TCPSocket.new TEST_ADDR, s.addr[1]
@@ -29,10 +29,8 @@ class TestLinuxTCP_Info < Test::Unit::TestCase
29
29
  tmp.get!(s)
30
30
  assert_equal before, tmp.object_id
31
31
 
32
- ensure
33
- c.close if c
34
- a.close if a
35
- s.close
32
+ ensure
33
+ [ c, a, s ].compact.each(&:close)
36
34
  end
37
35
 
38
36
  def test_accessors
@@ -42,12 +40,14 @@ class TestLinuxTCP_Info < Test::Unit::TestCase
42
40
  assert tcp_info_methods.size >= 32
43
41
  tcp_info_methods.each do |m|
44
42
  next if m.to_sym == :get!
43
+ next if ! tmp.respond_to?(m)
45
44
  val = tmp.__send__ m
46
45
  assert_kind_of Integer, val
47
46
  assert val >= 0
48
47
  end
49
- ensure
50
- s.close
48
+ assert tmp.respond_to?(:state), 'every OS knows about TCP state, right?'
49
+ ensure
50
+ s.close
51
51
  end
52
52
 
53
53
  def test_tcp_server_delayed
@@ -60,9 +60,29 @@ class TestLinuxTCP_Info < Test::Unit::TestCase
60
60
  a = s.accept
61
61
  i = Raindrops::TCP_Info.new(a)
62
62
  assert i.last_data_recv >= delay_ms, "#{i.last_data_recv} < #{delay_ms}"
63
- ensure
64
- c.close if c
65
- a.close if a
66
- s.close
63
+ ensure
64
+ c.close if c
65
+ a.close if a
66
+ s.close
67
+ end
68
+
69
+ def test_tcp_server_state_closed
70
+ s = TCPServer.new(TEST_ADDR, 0)
71
+ c = TCPSocket.new(TEST_ADDR, s.addr[1])
72
+ i = Raindrops::TCP_Info.allocate
73
+ a = s.accept
74
+ i.get!(a)
75
+ state = i.state
76
+ if Raindrops.const_defined?(:TCP)
77
+ assert_equal state, Raindrops::TCP[:ESTABLISHED]
78
+ end
79
+ c = c.close
80
+ sleep(0.01) # wait for kernel to update state
81
+ i.get!(a)
82
+ assert_not_equal state, i.state
83
+ ensure
84
+ s.close if s
85
+ c.close if c
86
+ a.close if a
67
87
  end
68
- end if RUBY_PLATFORM =~ /linux/
88
+ end if defined? Raindrops::TCP_Info
data/test/test_watcher.rb CHANGED
@@ -2,6 +2,11 @@
2
2
  require "test/unit"
3
3
  require "rack"
4
4
  require "raindrops"
5
+ begin
6
+ require 'aggregate'
7
+ rescue LoadError => e
8
+ warn "W: #{e} skipping #{__FILE__}"
9
+ end
5
10
 
6
11
  class TestWatcher < Test::Unit::TestCase
7
12
  TEST_ADDR = ENV['UNICORN_TEST_ADDR'] || '127.0.0.1'
@@ -113,28 +118,28 @@ class TestWatcher < Test::Unit::TestCase
113
118
 
114
119
  def test_x_current_header
115
120
  env = @req.class.env_for "/active/#@addr.txt"
116
- status, headers, body = @app.call(env)
121
+ _status, headers, _body = @app.call(env)
117
122
  assert_equal "0", headers["X-Current"], headers.inspect
118
123
 
119
124
  env = @req.class.env_for "/queued/#@addr.txt"
120
- status, headers, body = @app.call(env)
125
+ _status, headers, _body = @app.call(env)
121
126
  assert_equal "1", headers["X-Current"], headers.inspect
122
127
 
123
128
  @ios << @srv.accept
124
129
  sleep 0.1
125
130
 
126
131
  env = @req.class.env_for "/queued/#@addr.txt"
127
- status, headers, body = @app.call(env)
132
+ _status, headers, _body = @app.call(env)
128
133
  assert_equal "0", headers["X-Current"], headers.inspect
129
134
 
130
135
  env = @req.class.env_for "/active/#@addr.txt"
131
- status, headers, body = @app.call(env)
136
+ _status, headers, _body = @app.call(env)
132
137
  assert_equal "1", headers["X-Current"], headers.inspect
133
138
  end
134
139
 
135
140
  def test_peaks
136
141
  env = @req.class.env_for "/active/#@addr.txt"
137
- status, headers, body = @app.call(env.dup)
142
+ _status, headers, _body = @app.call(env.dup)
138
143
  start = headers["X-First-Peak-At"]
139
144
  assert headers["X-First-Peak-At"], headers.inspect
140
145
  assert headers["X-Last-Peak-At"], headers.inspect
@@ -143,14 +148,14 @@ class TestWatcher < Test::Unit::TestCase
143
148
  before = headers["X-Last-Peak-At"]
144
149
 
145
150
  env = @req.class.env_for "/queued/#@addr.txt"
146
- status, headers, body = @app.call(env)
151
+ _status, headers, _body = @app.call(env)
147
152
  assert_nothing_raised { Time.parse(headers["X-First-Peak-At"]) }
148
153
  assert_nothing_raised { Time.parse(headers["X-Last-Peak-At"]) }
149
154
  assert_equal before, headers["X-Last-Peak-At"], "should not change"
150
155
 
151
156
  sleep 2
152
157
  env = @req.class.env_for "/active/#@addr.txt"
153
- status, headers, body = @app.call(env.dup)
158
+ _status, headers, _body = @app.call(env.dup)
154
159
  assert_equal before, headers["X-Last-Peak-At"], headers.inspect
155
160
 
156
161
  @ios << @srv.accept
@@ -162,7 +167,7 @@ class TestWatcher < Test::Unit::TestCase
162
167
  end
163
168
  sleep 0.1
164
169
  env = @req.class.env_for "/queued/#@addr.txt"
165
- status, headers, body = @app.call(env.dup)
170
+ _status, headers, _body = @app.call(env.dup)
166
171
  assert headers["X-Last-Peak-At"], headers.inspect
167
172
  assert_nothing_raised { Time.parse(headers["X-Last-Peak-At"]) }
168
173
  assert before != headers["X-Last-Peak-At"]
@@ -172,10 +177,10 @@ class TestWatcher < Test::Unit::TestCase
172
177
  sleep 2
173
178
 
174
179
  env = @req.class.env_for "/queued/#@addr.txt"
175
- status, headers, body = @app.call(env)
180
+ _status, headers, _body = @app.call(env)
176
181
  assert_equal "0", headers["X-Current"]
177
182
  assert_nothing_raised { Time.parse(headers["X-Last-Peak-At"]) }
178
183
  assert_equal queued_before, headers["X-Last-Peak-At"], "should not change"
179
184
  assert_equal start, headers["X-First-Peak-At"]
180
185
  end
181
- end if RUBY_PLATFORM =~ /linux/
186
+ end if RUBY_PLATFORM =~ /linux/ && defined?(Aggregate)