Skip to content

Commit

Permalink
fix tests
Browse files Browse the repository at this point in the history
  • Loading branch information
maminrayej committed May 6, 2024
1 parent ec7f232 commit 41f380d
Showing 1 changed file with 7 additions and 6 deletions.
13 changes: 7 additions & 6 deletions lib/wasix/src/bin_factory/binary_package.rs
Original file line number Diff line number Diff line change
Expand Up @@ -237,17 +237,16 @@ mod tests {
std::fs::create_dir_all(&out).unwrap();
let file_txt = "Hello, World!";
std::fs::write(out.join("file.txt"), file_txt).unwrap();
let webc: Container = webc::wasmer_package::Package::from_manifest(manifest)
.unwrap()
.into();
let tasks = task_manager();
let mut runtime = PluggableRuntime::new(tasks);
runtime.set_package_loader(
BuiltinPackageLoader::new()
.with_shared_http_client(runtime.http_client().unwrap().clone()),
);

let pkg = BinaryPackage::from_webc(&webc, &runtime).await.unwrap();
let pkg = BinaryPackage::from_dir(&temp.path(), &runtime)
.await
.unwrap();

// We should have mapped "./out/file.txt" on the host to
// "/public/file.txt" on the guest.
Expand Down Expand Up @@ -290,7 +289,7 @@ mod tests {
let atom_path = temp.path().join("foo.wasm");
std::fs::write(&atom_path, b"").unwrap();

let webc: Container = webc::wasmer_package::Package::from_manifest(manifest)
let webc: Container = webc::wasmer_package::Package::from_manifest(&manifest)
.unwrap()
.into();

Expand All @@ -301,7 +300,9 @@ mod tests {
.with_shared_http_client(runtime.http_client().unwrap().clone()),
);

let pkg = BinaryPackage::from_webc(&webc, &runtime).await.unwrap();
let pkg = BinaryPackage::from_dir(&temp.path(), &runtime)
.await
.unwrap();

assert_eq!(pkg.commands.len(), 1);
let command = pkg.get_command("cmd").unwrap();
Expand Down

0 comments on commit 41f380d

Please sign in to comment.