Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add tests to load an actual spec #78

Merged
merged 3 commits into from
Oct 6, 2021
Merged
Show file tree
Hide file tree
Changes from 2 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 3 additions & 3 deletions src/runtime/hooks.rs
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@ use derive_builder::Builder;
use getset::{CopyGetters, Getters};
use serde::{Deserialize, Serialize};
use std::path::PathBuf;
use std::time::Duration;

#[derive(Builder, Clone, Debug, Default, Deserialize, Eq, Getters, PartialEq, Serialize)]
#[serde(rename_all = "camelCase")]
Expand Down Expand Up @@ -99,6 +98,7 @@ pub struct Hook {

#[serde(default, skip_serializing_if = "Option::is_none")]
#[getset(get_copy = "pub")]
/// Timeout is the duration before aborting the hook.
timeout: Option<Duration>,
/// Timeout is the number of seconds before aborting the hook. If set,
/// timeout MUST be greater than zero.
timeout: Option<i64>,
}
7 changes: 7 additions & 0 deletions src/runtime/test.rs
Original file line number Diff line number Diff line change
Expand Up @@ -29,3 +29,10 @@ fn test_linux_device_cgroup_to_string() {
.expect("build device cgroup");
assert_eq!(ldc.to_string(), "a 1:9 rwm");
}

#[test]
fn test_load_sample_spec() {
let fixture_path = std::path::PathBuf::from(env!("CARGO_MANIFEST_DIR"))
.join("src/runtime/test/fixture/sample.json");
Spec::load(fixture_path).unwrap();
utam0k marked this conversation as resolved.
Show resolved Hide resolved
}
Loading