Skip to content

Commit

Permalink
ENG-578: Test manifest
Browse files Browse the repository at this point in the history
  • Loading branch information
aakoshh committed Feb 23, 2024
1 parent d8c9235 commit 4758f96
Show file tree
Hide file tree
Showing 3 changed files with 51 additions and 0 deletions.
25 changes: 25 additions & 0 deletions fendermint/testing/materializer/manifests/root-only.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
accounts:
alice: {}
bob: {}
charlie: {}
rootnet:
type: New
validators:
alice: '100'
balances:
alice: '1000000000000000000'
bob: '2000000000000000000'
charlie: '3000000000000000000'
nodes:
node-1:
mode:
type: Validator
validator: alice
ethapi: true

node-2:
mode:
type: Full
ethapi: false
seed_nodes:
- node-1
4 changes: 4 additions & 0 deletions fendermint/testing/materializer/src/manifest.rs
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,7 @@ pub struct Manifest {
pub rootnet: Rootnet,

/// Subnets created on the rootnet.
#[serde(default, skip_serializing_if = "BTreeMap::is_empty")]
pub subnets: SubnetMap,
}

Expand Down Expand Up @@ -131,6 +132,7 @@ pub struct Subnet {
/// Child subnets under this parent.
///
/// The subnet ID exists so we can find the outcome of existing deployments in the log.
#[serde(default, skip_serializing_if = "BTreeMap::is_empty")]
pub subnets: SubnetMap,
}

Expand All @@ -141,9 +143,11 @@ pub struct Node {
/// Indicate whether to run the Ethereum API.
pub ethapi: bool,
/// The nodes from which CometBFT should bootstrap itself.
#[serde(default, skip_serializing_if = "Vec::is_empty")]
pub seed_nodes: Vec<NodeId>,
/// The parent node that the top-down syncer follows;
/// or leave it empty if node is on the rootnet.
#[serde(default, skip_serializing_if = "Option::is_none")]
pub parent_node: Option<ParentNode>,
}

Expand Down
22 changes: 22 additions & 0 deletions fendermint/testing/materializer/tests/docker.rs
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
// Copyright 2022-2024 Protocol Labs
// SPDX-License-Identifier: Apache-2.0, MIT

use fendermint_testing_materializer::{
docker::DockerMaterializer,
manifest::{self, Manifest},
};

mod manifests {
use fendermint_testing_materializer::manifest::Manifest;

pub const ROOT_ONLY: &str = include_str!("../manifests/root-only.yaml");

pub fn parse_yaml(yaml: &str) -> Manifest {
serde_yaml::from_str(yaml).expect("failed to parse manifest")
}
}

#[tokio::test]
async fn test_root_only() {
let _manifest = manifests::parse_yaml(manifests::ROOT_ONLY);
}

0 comments on commit 4758f96

Please sign in to comment.