about summary refs log tree commit homepage
diff options
context:
space:
mode:
authorEric Wong <e@80x24.org>2016-08-02 21:43:40 +0000
committerEric Wong <e@80x24.org>2016-08-02 21:44:36 +0000
commite8bf70aea2e13df5ea7282aeb417e034c16d0d41 (patch)
treedcd0158e97672c41c62861d6839ece146e8e76d0
parent0ec6c3af48fa396c3182f7c6f6b92ba0d835c7ed (diff)
downloadyahns-e8bf70aea2e13df5ea7282aeb417e034c16d0d41.tar.gz
It's too hard to reliably test output buffering behavior
with non-default values users sometimes set; so just skip
and warn about it for now.

ref: commit dad99b5ecd93cdf0a514ff9fb51d198f8aebb188
("test/test_proxy_pass: remove buffer size tuning")
-rw-r--r--test/helper.rb12
-rw-r--r--test/test_output_buffering.rb1
2 files changed, 13 insertions, 0 deletions
diff --git a/test/helper.rb b/test/helper.rb
index 73cde51..634f63e 100644
--- a/test/helper.rb
+++ b/test/helper.rb
@@ -147,6 +147,18 @@ class DieIfUsed
   end
 end
 
+# tricky to test output buffering behavior across different OSes
+def skip_skb_mem
+  return if ENV['YAHNS_TEST_FORCE']
+  skip "linux-only test" unless RUBY_PLATFORM =~ /linux/
+  [ [ '/proc/sys/net/ipv4/tcp_rmem', "4096        87380        6291456\n" ],
+    [ '/proc/sys/net/ipv4/tcp_wmem', "4096        16384        4194304\n" ]
+  ].each do |file, expect|
+    val = IO.read(file)
+    val == expect or skip "#{file} had: #{val}expected: #{expect}"
+  end
+end
+
 require 'yahns'
 
 # needed for parallel (MT) tests)
diff --git a/test/test_output_buffering.rb b/test/test_output_buffering.rb
index ba3e94a..e1a23b7 100644
--- a/test/test_output_buffering.rb
+++ b/test/test_output_buffering.rb
@@ -219,6 +219,7 @@ class TestOutputBuffering < Testcase
 
   def test_client_timeout
     err = @err
+    skip_skb_mem
     apperr = tmpfile(%w(app .err))
     cfg = Yahns::Config.new
     size = RAND.size * NR