Skip to content

Commit

Permalink
fixing the address parsing in integration test (#1106)
Browse files Browse the repository at this point in the history
* fixing the address parsing in integration test

* use WaleltConext to parse the account address
  • Loading branch information
stevenlaw123 authored Nov 6, 2023
1 parent 69e50fb commit fda73b2
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 4 deletions.
11 changes: 7 additions & 4 deletions crates/rooch/src/commands/move_cli/commands/integration_test.rs
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,9 @@ use move_package::compilation::build_plan::BuildPlan;
use move_package::source_package::layout::SourcePackageLayout;
use moveos_types::addresses::MOVEOS_NAMED_ADDRESS_MAPPING;
use once_cell::sync::Lazy;
use rooch_config::rooch_config_dir;
use rooch_integration_test_runner;
use rooch_rpc_client::wallet_context::WalletContext;
use std::collections::BTreeMap;
use std::fmt::Display;
use std::num::NonZeroUsize;
Expand Down Expand Up @@ -133,7 +135,7 @@ pub struct IntegrationTest {
}

impl IntegrationTest {
pub fn execute(self, move_arg: Move) -> anyhow::Result<()> {
pub async fn execute(self, move_arg: Move) -> anyhow::Result<()> {
let rerooted_path = {
let path = match move_arg.package_path {
Some(_) => move_arg.package_path,
Expand All @@ -143,6 +145,9 @@ impl IntegrationTest {
SourcePackageLayout::try_find_root(&path.as_ref().unwrap().canonicalize()?)?
};

let rooch_dir = rooch_config_dir().unwrap();
let wallet_context = WalletContext::new(Some(rooch_dir.clone())).await.unwrap();

// force move to rebuild all packages, so that we can use compile_driver to generate the full compiled program.
let mut build_config = move_arg.build_config;
let _ = self
Expand All @@ -151,9 +156,7 @@ impl IntegrationTest {
.map(|(key, value)| {
build_config.additional_named_addresses.insert(
key.clone(),
NumericalAddress::parse_str(value.as_str())
.unwrap()
.into_inner(),
wallet_context.parse_account_arg(value.clone()).ok()?,
)
})
.collect::<Vec<_>>();
Expand Down
1 change: 1 addition & 0 deletions crates/rooch/src/commands/move_cli/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -117,6 +117,7 @@ impl CommandAction<String> for MoveCli {
MoveCommand::View(c) => c.execute_serialized().await,
MoveCommand::IntegrationTest(c) => c
.execute(move_args)
.await
.map(|_| "Success".to_owned())
.map_err(RoochError::from),
MoveCommand::Explain(c) => c
Expand Down

0 comments on commit fda73b2

Please sign in to comment.