mirror of
https://github.com/orhun/systeroid
synced 2024-10-15 03:42:18 +00:00
test(sysctl): add tests for the controller module
This commit is contained in:
parent
53a6b0ecbf
commit
41dabbf217
|
@ -78,7 +78,7 @@ impl Sysctl {
|
|||
parameters
|
||||
}
|
||||
|
||||
/// Updates the parameters using the given list.
|
||||
/// Updates the parameters internally using the given list.
|
||||
///
|
||||
/// Keeps the original values.
|
||||
pub fn update_params(&mut self, mut parameters: Vec<Parameter>) {
|
||||
|
@ -126,3 +126,21 @@ impl Sysctl {
|
|||
Ok(())
|
||||
}
|
||||
}
|
||||
|
||||
#[cfg(test)]
|
||||
mod tests {
|
||||
use super::*;
|
||||
|
||||
#[test]
|
||||
fn test_sysctl_controller() -> Result<()> {
|
||||
let config = Config::default();
|
||||
let mut sysctl = Sysctl::init(config)?;
|
||||
assert!(sysctl.get_parameter("kernel.hostname").is_some());
|
||||
assert_eq!(
|
||||
"Linux",
|
||||
sysctl.get_parameters("ostype").first().unwrap().value
|
||||
);
|
||||
|
||||
Ok(())
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue