better maximize_fd_limit test
Signed-off-by: strawberry <strawberry@puppygock.gay>
This commit is contained in:
parent
edb4468771
commit
08a21b8ee2
1 changed files with 15 additions and 1 deletions
16
src/main.rs
16
src/main.rs
|
@ -967,5 +967,19 @@ mod test {
|
|||
|
||||
#[cfg(unix)]
|
||||
#[test]
|
||||
fn maximize_fd_limit_works() { maximize_fd_limit().unwrap() }
|
||||
/// Tests if `maximize_fd_limit()` actually raised the soft limit to the
|
||||
/// hard limit
|
||||
fn maximize_fd_limit_raises_limit() {
|
||||
use nix::sys::resource::{getrlimit, Resource};
|
||||
|
||||
let res = Resource::RLIMIT_NOFILE;
|
||||
|
||||
let (_, hard_limit) = getrlimit(res).unwrap();
|
||||
|
||||
maximize_fd_limit().unwrap();
|
||||
|
||||
let (soft_limit, _) = getrlimit(res).unwrap();
|
||||
|
||||
assert_eq!(soft_limit, hard_limit);
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Add table
Reference in a new issue