Skip to content

Commit

Permalink
Fix tests
Browse files Browse the repository at this point in the history
  • Loading branch information
romac committed Nov 13, 2020
1 parent 7af91b1 commit 2afa90f
Show file tree
Hide file tree
Showing 6 changed files with 25 additions and 17 deletions.
2 changes: 1 addition & 1 deletion modules/src/ics24_host/identifier.rs
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ impl ChainId {
/// let epoch_number = 10;
/// let c_res = ChainId::new("chainA", epoch_number);
/// assert!(c_res.is_ok());
/// c_res.map(|id| {assert_eq!(ChainId::chain_version(id.to_string()), epoch_number)});
/// c_res.map(|id| {assert_eq!(id.version(), epoch_number)});
/// ```
pub fn new(chain_name: &str, chain_epoch_number: u64) -> Result<Self, ValidationError> {
ChainId::from_str(format!("{}-{}", chain_name, chain_epoch_number.to_string()).as_str())
Expand Down
8 changes: 4 additions & 4 deletions relayer-cli/src/commands/query/channel.rs
Original file line number Diff line number Diff line change
Expand Up @@ -121,9 +121,9 @@ mod tests {
#[test]
fn parse_channel_query_end_parameters() {
let default_params = QueryChannelEndCmd {
chain_id: Some("ibc0".to_string().parse().unwrap()),
port_id: Some("transfer".to_string().parse().unwrap()),
channel_id: Some("testchannel".to_string().parse().unwrap()),
chain_id: Some("ibc0-1".parse().unwrap()),
port_id: Some("transfer".parse().unwrap()),
channel_id: Some("testchannel".parse().unwrap()),
height: None,
proof: None,
};
Expand Down Expand Up @@ -151,7 +151,7 @@ mod tests {
Test {
name: "Chain not configured".to_string(),
params: QueryChannelEndCmd {
chain_id: Some("notibc0oribc1".to_string().parse().unwrap()),
chain_id: Some("notibc0oribc1-1".parse().unwrap()),
..default_params.clone()
},
want_pass: false,
Expand Down
12 changes: 6 additions & 6 deletions relayer-cli/src/commands/query/client.rs
Original file line number Diff line number Diff line change
Expand Up @@ -306,8 +306,8 @@ mod tests {
#[test]
fn parse_query_state_parameters() {
let default_params = QueryClientStateCmd {
chain_id: Some("ibc0".to_string().parse().unwrap()),
client_id: Some("ibconeclient".to_string().parse().unwrap()),
chain_id: Some("ibc0-1".parse().unwrap()),
client_id: Some("ibconeclient".parse().unwrap()),
height: None,
proof: None,
};
Expand Down Expand Up @@ -335,7 +335,7 @@ mod tests {
Test {
name: "Chain not configured".to_string(),
params: QueryClientStateCmd {
chain_id: Some("notibc0oribc1".to_string().parse().unwrap()),
chain_id: Some("notibc0oribc1-1".parse().unwrap()),
..default_params.clone()
},
want_pass: false,
Expand Down Expand Up @@ -392,8 +392,8 @@ mod tests {
#[test]
fn parse_query_client_connections_parameters() {
let default_params = QueryClientConnectionsCmd {
chain_id: Some("ibc0".to_string().parse().unwrap()),
client_id: Some("clientidone".to_string().parse().unwrap()),
chain_id: Some("ibc0-1".parse().unwrap()),
client_id: Some("clientidone".parse().unwrap()),
height: Some(4),
};

Expand All @@ -420,7 +420,7 @@ mod tests {
Test {
name: "Chain not configured".to_string(),
params: QueryClientConnectionsCmd {
chain_id: Some("notibc0oribc1".to_string().parse().unwrap()),
chain_id: Some("notibc0oribc1-1".parse().unwrap()),
..default_params.clone()
},
want_pass: false,
Expand Down
6 changes: 3 additions & 3 deletions relayer-cli/src/commands/query/connection.rs
Original file line number Diff line number Diff line change
Expand Up @@ -102,8 +102,8 @@ mod tests {
#[test]
fn parse_connection_query_end_parameters() {
let default_params = QueryConnectionEndCmd {
chain_id: Some("ibc0".to_string().parse().unwrap()),
connection_id: Some("ibconeconnection".to_string().parse().unwrap()),
chain_id: Some("ibc0-1".parse().unwrap()),
connection_id: Some("ibconeconnection".parse().unwrap()),
height: None,
proof: None,
};
Expand Down Expand Up @@ -131,7 +131,7 @@ mod tests {
Test {
name: "Chain not configured".to_string(),
params: QueryConnectionEndCmd {
chain_id: Some("notibc0oribc1".to_string().parse().unwrap()),
chain_id: Some("notibc0oribc1-1".parse().unwrap()),
..default_params.clone()
},
want_pass: false,
Expand Down
9 changes: 7 additions & 2 deletions relayer-cli/tests/fixtures/two_chains.toml
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ timeout = '10s'
strategy = 'naive'

[[chains]]
id = 'ibc0'
id = 'ibc0-1'
rpc_addr = 'tcp://localhost:26657'
grpc_addr = 'tcp://localhost:9090'
account_prefix = 'cosmos'
Expand All @@ -30,8 +30,11 @@ address = 'tcp://localhost:26657'
trusted_header_hash = '169F8F6318B8FAABDBA128AD1689E238566B69DDBD2B36F1911C0DFCA73FD401'
trusted_height = '7806'

[chains.peers.light_clients.store]
type = 'memory'

[[chains]]
id = 'ibc1'
id = 'ibc1-1'
rpc_addr = 'tcp://localhost:26557'
grpc_addr = 'tcp://localhost:9091'
account_prefix = 'cosmos'
Expand All @@ -55,3 +58,5 @@ address = 'tcp://localhost:26557'
trusted_header_hash = 'CC291E79B2E2068984EB13BBF420B4F4AE95357E25B9BA0A30CA26FF27AF3C75'
trusted_height = '7741'

[chains.peers.light_clients.store]
type = 'memory'
5 changes: 4 additions & 1 deletion relayer/src/config.rs
Original file line number Diff line number Diff line change
Expand Up @@ -199,7 +199,10 @@ pub enum StoreConfig {
#[serde(rename = "disk")]
Disk { path: PathBuf },
#[serde(rename = "memory")]
Memory { dummy: () },
Memory {
#[serde(skip)]
dummy: (),
},
}

/// Attempt to load and parse the TOML config file as a `Config`.
Expand Down

0 comments on commit 2afa90f

Please sign in to comment.