-
Notifications
You must be signed in to change notification settings - Fork 323
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Initial implementation logic for the health-check command (#1336)
- Loading branch information
Showing
3 changed files
with
49 additions
and
6 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,38 @@ | ||
use std::sync::Arc; | ||
|
||
use abscissa_core::{Command, Options, Runnable}; | ||
|
||
use crate::conclude::Output; | ||
use crate::prelude::*; | ||
use ibc_relayer::chain::{ChainEndpoint, CosmosSdkChain}; | ||
use tokio::runtime::Runtime as TokioRuntime; | ||
|
||
#[derive(Clone, Command, Debug, Options)] | ||
pub struct HealthCheckCmd {} | ||
|
||
impl Runnable for HealthCheckCmd { | ||
fn run(&self) { | ||
let config = (*app_config()).clone(); | ||
|
||
for ch in config.clone().chains { | ||
let rt = Arc::new(TokioRuntime::new().unwrap()); | ||
info!("Performing health check on chain {:?}...", ch.id); | ||
let chain_config = match config.find_chain(&ch.id) { | ||
None => { | ||
return Output::error(format!( | ||
"chain '{}' not found in configuration file", | ||
ch.id | ||
)) | ||
.exit() | ||
} | ||
Some(chain_config) => chain_config, | ||
}; | ||
let chain = CosmosSdkChain::bootstrap(chain_config.clone(), rt).unwrap(); | ||
chain.health_checkup(); | ||
chain.validate_params(); | ||
info!("Performed health check on chain {:?}", ch.id); | ||
} | ||
info!("Hermes executed a health check for all chains in the config"); | ||
Output::success_msg("done").exit() | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters