Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Migrate sui-move shell tests to sui crate #20995

Merged
merged 10 commits into from
Jan 29, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

5 changes: 1 addition & 4 deletions crates/sui-move/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -49,6 +49,7 @@ tempfile.workspace = true
walkdir.workspace = true
insta-cmd.workspace = true
insta.workspace = true
fs_extra.workspace = true

move-package.workspace = true

Expand All @@ -61,9 +62,5 @@ sui-simulator.workspace = true
[package.metadata.cargo-udeps.ignore]
normal = ["jemalloc-ctl"]

[[test]]
name = "cli_tests"
harness = false

[lints]
workspace = true
79 changes: 0 additions & 79 deletions crates/sui-move/tests/cli_tests.rs

This file was deleted.

11 changes: 0 additions & 11 deletions crates/sui-move/tests/snapshots/cli_tests__dummy__dummy.sh.snap

This file was deleted.

This file was deleted.

This file was deleted.

This file was deleted.

This file was deleted.

This file was deleted.

7 changes: 6 additions & 1 deletion crates/sui/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,6 @@ futures.workspace = true
http.workspace = true
im.workspace = true
inquire.workspace = true
insta.workspace = true
json_to_table.workspace = true
miette.workspace = true
num-bigint.workspace = true
Expand Down Expand Up @@ -110,6 +109,8 @@ fs_extra.workspace = true
expect-test.workspace = true
assert_cmd.workspace = true
toml.workspace = true
insta.workspace = true
insta-cmd.workspace = true

test-cluster.workspace = true
sui-macros.workspace = true
Expand All @@ -132,6 +133,10 @@ test = false
name = "ptb_files_tests"
harness = false

[[test]]
name = "shell_tests"
harness = false

[features]
tracing = [
"sui-types/tracing",
Expand Down
90 changes: 0 additions & 90 deletions crates/sui/tests/cli_tests.rs
Original file line number Diff line number Diff line change
Expand Up @@ -355,43 +355,6 @@ async fn test_ptb_publish() -> Result<(), anyhow::Error> {
Ok(())
}

// fixing issue https://github.com/MystenLabs/sui/issues/6546
#[tokio::test]
async fn test_regression_6546() -> Result<(), anyhow::Error> {
let mut test_cluster = TestClusterBuilder::new().build().await;
let address = test_cluster.get_address_0();
let context = &mut test_cluster.wallet;

let SuiClientCommandResult::Objects(coins) = SuiClientCommands::Objects {
address: Some(KeyIdentity::Address(address)),
}
.execute(context)
.await?
else {
panic!()
};
let config_path = test_cluster.swarm.dir().join(SUI_CLIENT_CONFIG);

test_with_sui_binary(&[
"client",
"--client.config",
config_path.to_str().unwrap(),
"call",
"--package",
"0x2",
"--module",
"sui",
"--function",
"transfer",
"--args",
&coins.first().unwrap().object()?.object_id.to_string(),
&test_cluster.get_address_1().to_string(),
"--gas-budget",
"100000000",
])
.await
}

#[sim_test]
async fn test_custom_genesis() -> Result<(), anyhow::Error> {
// Create and save genesis config file
Expand Down Expand Up @@ -3944,59 +3907,6 @@ async fn test_clever_errors() -> Result<(), anyhow::Error> {
Ok(())
}

#[tokio::test]
async fn test_move_build_bytecode_with_address_resolution() -> Result<(), anyhow::Error> {
let test_cluster = TestClusterBuilder::new().build().await;
let config_path = test_cluster.swarm.dir().join(SUI_CLIENT_CONFIG);

// Package setup: a simple package depends on another and copied to tmpdir
let mut simple_package_path = PathBuf::from(TEST_DATA_DIR);
simple_package_path.push("simple");

let mut depends_on_simple_package_path = PathBuf::from(TEST_DATA_DIR);
depends_on_simple_package_path.push("depends_on_simple");

let tmp_dir = tempfile::tempdir().unwrap();

fs_extra::dir::copy(
&simple_package_path,
&tmp_dir,
&fs_extra::dir::CopyOptions::default(),
)?;

fs_extra::dir::copy(
&depends_on_simple_package_path,
&tmp_dir,
&fs_extra::dir::CopyOptions::default(),
)?;

// Publish simple package.
let simple_tmp_dir = tmp_dir.path().join("simple");
test_with_sui_binary(&[
"client",
"--client.config",
config_path.to_str().unwrap(),
"publish",
simple_tmp_dir.to_str().unwrap(),
])
.await?;

// Build the package that depends on 'simple' package. Addresses must resolve successfully
// from the `Move.lock` for this command to succeed at all.
let depends_on_simple_tmp_dir = tmp_dir.path().join("depends_on_simple");
test_with_sui_binary(&[
"move",
"--client.config",
config_path.to_str().unwrap(),
"build",
"--dump-bytecode-as-base64",
"--path",
depends_on_simple_tmp_dir.to_str().unwrap(),
])
.await?;
Ok(())
}

#[tokio::test]
async fn test_parse_host_port() {
let input = "127.0.0.0";
Expand Down
Loading
Loading