yahns.git  about / heads / tags
sleepy, multi-threaded, non-blocking application server for Ruby
blob 3525dca401859a4018387d1713650090604aa83f 669 bytes (raw)
$ git show v0.0.1:test/test_fdmap.rb	# shows this blob on the CLI

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
 
# Copyright (C) 2013, Eric Wong <normalperson@yhbt.net> and all contributors
# License: GPLv3 or later (https://www.gnu.org/licenses/gpl-3.0.txt)
require_relative 'helper'

class TestFdmap < Testcase
  def test_fdmap_negative
    fdmap = Yahns::Fdmap.new(Logger.new($stderr), -5)
    nr = fdmap.instance_variable_get :@client_expire_threshold
    assert_operator nr, :>, 0
    assert_equal nr, Process.getrlimit(:NOFILE)[0] - 5
  end

  def test_fdmap_float
    fdmap = Yahns::Fdmap.new(Logger.new($stderr), 0.5)
    nr = fdmap.instance_variable_get :@client_expire_threshold
    assert_operator nr, :>, 0
    assert_equal nr, Process.getrlimit(:NOFILE)[0]/2
  end
end

git clone git://yhbt.net/yahns.git
git clone https://yhbt.net/yahns.git