Skip to content

Commit

Permalink
Add resources deserializer test
Browse files Browse the repository at this point in the history
  • Loading branch information
wirednkod committed Sep 20, 2023
1 parent 335ad80 commit 915d4c8
Showing 1 changed file with 14 additions and 0 deletions.
14 changes: 14 additions & 0 deletions crates/configuration/src/shared/resources.rs
Original file line number Diff line number Diff line change
Expand Up @@ -299,6 +299,8 @@ impl ResourcesBuilder {
#[cfg(test)]
#[allow(non_snake_case)]
mod tests {
use crate::NetworkConfig;

use super::*;

macro_rules! impl_resources_quantity_unit_test {
Expand Down Expand Up @@ -401,6 +403,18 @@ mod tests {
assert_eq!(resources.limit_memory().unwrap().as_str(), "2G");
}

#[test]
fn resources_config_toml_import_should_succeeds_and_returns_a_resources_config() {
let load_from_toml =
NetworkConfig::load_from_toml("./testing/snapshots/0001-big-network.toml").unwrap();

let resources = load_from_toml.relaychain().default_resources().unwrap();
assert_eq!(resources.request_memory().unwrap().as_str(), "500M");
assert_eq!(resources.request_cpu().unwrap().as_str(), "100000");
assert_eq!(resources.limit_cpu().unwrap().as_str(), "10Gi");
assert_eq!(resources.limit_memory().unwrap().as_str(), "4000M");
}

#[test]
fn resources_config_builder_should_fails_and_returns_an_error_if_couldnt_parse_request_memory()
{
Expand Down

0 comments on commit 915d4c8

Please sign in to comment.