Skip to content

Commit a2de107

Browse files
georgesitonivwearyzen
authored andcommitted
test: Fix call to ResourceLimits::install in unit test
This commit contains two changes: - Fix on the install call in the test_install unit test - Fix on the formatting of test_install unit test Signed-off-by: George Siton <geosit@amazon.com>
1 parent a616d6b commit a2de107

File tree

1 file changed

+6
-11
lines changed

1 file changed

+6
-11
lines changed

src/jailer/src/resource_limits.rs

Lines changed: 6 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -195,21 +195,18 @@ mod tests {
195195
let new_limit = 100;
196196
rlimits.set_file_size(new_limit);
197197
rlimits.set_no_file(new_limit);
198-
199-
// Install the new limits to file size and
198+
199+
// Install the new limits to file size and
200200
// the number of file descriptors
201-
let result = rlimits.install();
202-
assert_eq!(result.unwrap(), ());
203-
201+
rlimits.install().unwrap();
202+
204203
// Verify the new limit for file size
205204
let file_size_resource = Resource::RlimitFsize;
206205
let mut file_size_limit: libc::rlimit = libc::rlimit {
207206
rlim_cur: 0,
208207
rlim_max: 0,
209208
};
210-
unsafe {
211-
libc::getrlimit(file_size_resource.into(), &mut file_size_limit)
212-
};
209+
unsafe { libc::getrlimit(file_size_resource.into(), &mut file_size_limit) };
213210
assert_eq!(file_size_limit.rlim_cur, new_limit);
214211
assert_eq!(file_size_limit.rlim_max, new_limit);
215212

@@ -219,9 +216,7 @@ mod tests {
219216
rlim_cur: 0,
220217
rlim_max: 0,
221218
};
222-
unsafe {
223-
libc::getrlimit(file_descriptor_resource.into(), &mut file_descriptor_limit)
224-
};
219+
unsafe { libc::getrlimit(file_descriptor_resource.into(), &mut file_descriptor_limit) };
225220
assert_eq!(file_descriptor_limit.rlim_cur, new_limit);
226221
assert_eq!(file_descriptor_limit.rlim_max, new_limit);
227222
}

0 commit comments

Comments
 (0)