Skip to content
Open
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
39 changes: 39 additions & 0 deletions crates/spk-cli/cmd-make-binary/src/cmd_make_binary_test.rs
Original file line number Diff line number Diff line change
Expand Up @@ -81,3 +81,42 @@ build:
.await
.expect("With override, build script should succeed.");
}

#[rstest]
#[case::v0("v0/platform")]
#[case::v1("v1/platform")]
#[tokio::test]
async fn build_a_platform(tmpdir: tempfile::TempDir, #[case] api: &str) {
let _rt = spfs_runtime().await;

let filename = tmpdir.path().join("simple.spk.yaml");
{
let mut file = File::create(&filename).unwrap();
file.write_all(
format!(
r#"
platform: demo-platform/1.0.0
api: {api}
requirements: []
"#
)
.as_bytes(),
)
.unwrap();
}

let filename_str = filename.as_os_str().to_str().unwrap();

// First, don't override the variable on the command line (test the test).
let mut opt = Opt::try_parse_from([
"make-binary",
// Don't exec a new process to move into a new runtime, this confuses
// coverage testing.
"--no-runtime",
"--disable-repo=origin",
"--here",
filename_str,
])
.unwrap();
opt.mkb.run().await.expect("Build should succeed.");
}
Loading