yahns.git  about / heads / tags
sleepy, multi-threaded, non-blocking application server for Ruby
blob 33830ba0ac82c250acbcc7d85f51cc46b076a0cb 683 bytes (raw)
$ git show HEAD: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
20
 
# Copyright (C) 2013-2016 all contributors <yahns-public@yhbt.net>
# License: GPL-3.0+ (https://www.gnu.org/licenses/gpl-3.0.txt)
# frozen_string_literal: true
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