diff --git a/Cargo.lock b/Cargo.lock index 7550ad1f4..9ca4afde0 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -556,8 +556,10 @@ dependencies = [ "caps", "chrono", "containerd-shim", + "containerd-shim-wasm-test-modules", "crossbeam", "dbus", + "env_logger", "git-version", "libc", "libcontainer", @@ -576,11 +578,10 @@ dependencies = [ ] [[package]] -name = "containerd-shim-wasm-test" +name = "containerd-shim-wasm-test-modules" version = "0.2.0" dependencies = [ "anyhow", - "containerd-shim-wasm", "env_logger", "lazy_static", "libc", @@ -598,7 +599,6 @@ dependencies = [ "anyhow", "containerd-shim", "containerd-shim-wasm", - "containerd-shim-wasm-test", "libc", "log", "oci-spec", @@ -615,7 +615,6 @@ dependencies = [ "anyhow", "containerd-shim", "containerd-shim-wasm", - "containerd-shim-wasm-test", "log", "oci-spec", "serial_test", @@ -633,7 +632,6 @@ dependencies = [ "anyhow", "containerd-shim", "containerd-shim-wasm", - "containerd-shim-wasm-test", "log", "oci-spec", "serial_test", diff --git a/Cargo.toml b/Cargo.toml index 0be2dd2f7..098c81690 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -1,7 +1,7 @@ [workspace] members = [ "crates/containerd-shim-wasm", - "crates/containerd-shim-wasm-test", + "crates/containerd-shim-wasm-test-modules", "crates/wasi-demo-app", "crates/oci-tar-builder", "crates/containerd-shim-wasmedge", @@ -24,7 +24,7 @@ cap-std = "1.0" chrono = { version = "0.4", default-features = false, features = ["clock"] } containerd-shim = "0.5.0" containerd-shim-wasm = { path = "crates/containerd-shim-wasm" } -containerd-shim-wasm-test = { path = "crates/containerd-shim-wasm-test" } +containerd-shim-wasm-test-modules = { path = "crates/containerd-shim-wasm-test-modules" } crossbeam = { version = "0.8.2", default-features = false } env_logger = "0.10" libc = "0.2.147" @@ -36,6 +36,7 @@ serde = "1.0" serde_json = "1.0" sha256 = "1.4.0" tar = "0.4" +tempfile = "3.8" thiserror = "1.0" ttrpc = "0.8.0" wat = "*" # Use whatever version wasmtime will make us pull diff --git a/Makefile b/Makefile index 3e4f779f6..9ba5ed3eb 100644 --- a/Makefile +++ b/Makefile @@ -47,8 +47,8 @@ check: check-wasm $(RUNTIMES:%=check-%); check-common: check-wasm; check-wasm: - $(CARGO) +nightly fmt $(TARGET_FLAG) -p oci-tar-builder -p wasi-demo-app -p containerd-shim-wasm -p containerd-shim-wasm-test -- --check - $(CARGO) clippy $(TARGET_FLAG) $(FEATURES_wasm) -p oci-tar-builder -p wasi-demo-app -p containerd-shim-wasm -p containerd-shim-wasm-test -- $(WARNINGS) + $(CARGO) +nightly fmt $(TARGET_FLAG) -p oci-tar-builder -p wasi-demo-app -p containerd-shim-wasm -p containerd-shim-wasm-test-modules -- --check + $(CARGO) clippy $(TARGET_FLAG) $(FEATURES_wasm) -p oci-tar-builder -p wasi-demo-app -p containerd-shim-wasm -p containerd-shim-wasm-test-modules -- $(WARNINGS) check-%: $(CARGO) +nightly fmt $(TARGET_FLAG) -p containerd-shim-$* -- --check @@ -59,8 +59,8 @@ fix: fix-wasm $(RUNTIMES:%=fix-%); fix-common: fix-wasm; fix-wasm: - $(CARGO) +nightly fmt $(TARGET_FLAG) -p oci-tar-builder -p wasi-demo-app -p containerd-shim-wasm -p containerd-shim-wasm-test - $(CARGO) clippy $(TARGET_FLAG) $(FEATURES_wasm) --fix -p oci-tar-builder -p wasi-demo-app -p containerd-shim-wasm -p containerd-shim-wasm-test -- $(WARNINGS) + $(CARGO) +nightly fmt $(TARGET_FLAG) -p oci-tar-builder -p wasi-demo-app -p containerd-shim-wasm -p containerd-shim-wasm-test-modules + $(CARGO) clippy $(TARGET_FLAG) $(FEATURES_wasm) --fix -p oci-tar-builder -p wasi-demo-app -p containerd-shim-wasm -p containerd-shim-wasm-test-modules -- $(WARNINGS) fix-%: $(CARGO) +nightly fmt $(TARGET_FLAG) -p containerd-shim-$* @@ -72,7 +72,7 @@ test: test-wasm $(RUNTIMES:%=test-%); test-common: test-wasm; test-wasm: # oci-tar-builder and wasi-demo-app have no tests - RUST_LOG=trace $(CARGO) test $(TARGET_FLAG) --package containerd-shim-wasm $(FEATURES_wasm) --verbose -- --nocapture + RUST_LOG=trace $(CARGO) test $(TARGET_FLAG) --package containerd-shim-wasm $(FEATURES_wasm) --verbose -- --nocapture --test-threads=1 test-wasmedge: # run tests in one thread to prevent paralellism diff --git a/crates/containerd-shim-wasm-test/Cargo.toml b/crates/containerd-shim-wasm-test-modules/Cargo.toml similarity index 74% rename from crates/containerd-shim-wasm-test/Cargo.toml rename to crates/containerd-shim-wasm-test-modules/Cargo.toml index dec58651e..b8abbee03 100644 --- a/crates/containerd-shim-wasm-test/Cargo.toml +++ b/crates/containerd-shim-wasm-test-modules/Cargo.toml @@ -1,13 +1,12 @@ [package] -name = "containerd-shim-wasm-test" -description = "Library for testing containerd shims for wasm" +name = "containerd-shim-wasm-test-modules" +description = "Set of WebAssembly modules for testing containerd shims for wasm" version.workspace = true edition.workspace = true license.workspace = true [dependencies] anyhow = { workspace = true } -containerd-shim-wasm = { workspace = true } env_logger = "0.10" libc = { workspace = true } log = { workspace = true } diff --git a/crates/containerd-shim-wasm-test/build.rs b/crates/containerd-shim-wasm-test-modules/build.rs similarity index 100% rename from crates/containerd-shim-wasm-test/build.rs rename to crates/containerd-shim-wasm-test-modules/build.rs diff --git a/crates/containerd-shim-wasm-test/src/modules.rs b/crates/containerd-shim-wasm-test-modules/src/lib.rs similarity index 100% rename from crates/containerd-shim-wasm-test/src/modules.rs rename to crates/containerd-shim-wasm-test-modules/src/lib.rs diff --git a/crates/containerd-shim-wasm-test/src/modules/custom_entrypoint.wat b/crates/containerd-shim-wasm-test-modules/src/modules/custom_entrypoint.wat similarity index 100% rename from crates/containerd-shim-wasm-test/src/modules/custom_entrypoint.wat rename to crates/containerd-shim-wasm-test-modules/src/modules/custom_entrypoint.wat diff --git a/crates/containerd-shim-wasm-test/src/modules/exit_code.wat b/crates/containerd-shim-wasm-test-modules/src/modules/exit_code.wat similarity index 100% rename from crates/containerd-shim-wasm-test/src/modules/exit_code.wat rename to crates/containerd-shim-wasm-test-modules/src/modules/exit_code.wat diff --git a/crates/containerd-shim-wasm-test/src/modules/has_default_devices.rs b/crates/containerd-shim-wasm-test-modules/src/modules/has_default_devices.rs similarity index 100% rename from crates/containerd-shim-wasm-test/src/modules/has_default_devices.rs rename to crates/containerd-shim-wasm-test-modules/src/modules/has_default_devices.rs diff --git a/crates/containerd-shim-wasm-test/src/modules/hello_world.wat b/crates/containerd-shim-wasm-test-modules/src/modules/hello_world.wat similarity index 100% rename from crates/containerd-shim-wasm-test/src/modules/hello_world.wat rename to crates/containerd-shim-wasm-test-modules/src/modules/hello_world.wat diff --git a/crates/containerd-shim-wasm-test/src/modules/seccomp.rs b/crates/containerd-shim-wasm-test-modules/src/modules/seccomp.rs similarity index 100% rename from crates/containerd-shim-wasm-test/src/modules/seccomp.rs rename to crates/containerd-shim-wasm-test-modules/src/modules/seccomp.rs diff --git a/crates/containerd-shim-wasm-test/src/modules/unreachable.wat b/crates/containerd-shim-wasm-test-modules/src/modules/unreachable.wat similarity index 100% rename from crates/containerd-shim-wasm-test/src/modules/unreachable.wat rename to crates/containerd-shim-wasm-test-modules/src/modules/unreachable.wat diff --git a/crates/containerd-shim-wasm/Cargo.toml b/crates/containerd-shim-wasm/Cargo.toml index 6cdea5181..f272e86a4 100644 --- a/crates/containerd-shim-wasm/Cargo.toml +++ b/crates/containerd-shim-wasm/Cargo.toml @@ -14,15 +14,18 @@ doctest = false [dependencies] anyhow = { workspace = true } chrono = { workspace = true } -git-version = "0.3.5" containerd-shim = { workspace = true } +containerd-shim-wasm-test-modules = { workspace = true, optional = true } crossbeam = { workspace = true } +env_logger = { workspace = true, optional = true } +git-version = "0.3.5" libc = { workspace = true } log = { workspace = true } oci-spec = { workspace = true } protobuf = "3.2" serde = { workspace = true } serde_json = { workspace = true } +tempfile = { workspace = true, optional = true } thiserror = { workspace = true } ttrpc = { workspace = true } wat = { workspace = true } @@ -40,8 +43,11 @@ windows-sys = { workspace = true, features = ["Win32_Foundation", "Win32_Storage ttrpc-codegen = { version = "0.4.2", optional = true } [dev-dependencies] -tempfile = "3.8" +containerd-shim-wasm-test-modules = { workspace = true } +env_logger = { workspace = true } +tempfile = { workspace = true } [features] +testing = ["dep:containerd-shim-wasm-test-modules", "dep:env_logger", "dep:tempfile"] generate_bindings = ["ttrpc-codegen"] generate_doc = [] diff --git a/crates/containerd-shim-wasm/src/container/mod.rs b/crates/containerd-shim-wasm/src/container/mod.rs index 199e043a1..51bd6d093 100644 --- a/crates/containerd-shim-wasm/src/container/mod.rs +++ b/crates/containerd-shim-wasm/src/container/mod.rs @@ -21,3 +21,6 @@ pub use path::PathResolve; pub use crate::sandbox::stdio::Stdio; use crate::sys::container::instance; + +#[cfg(test)] +mod tests; diff --git a/crates/containerd-shim-wasm/src/container/tests.rs b/crates/containerd-shim-wasm/src/container/tests.rs new file mode 100644 index 000000000..bbf83869b --- /dev/null +++ b/crates/containerd-shim-wasm/src/container/tests.rs @@ -0,0 +1,38 @@ +use anyhow::bail; + +use crate::container::{Engine, RuntimeContext, Stdio}; +use crate::sys::container::instance::Instance; +use crate::testing::WasiTest; + +#[derive(Clone, Default)] +struct EngineFailingValidation; + +impl Engine for EngineFailingValidation { + fn name() -> &'static str { + "wasi_instance" + } + fn can_handle(&self, _ctx: &impl RuntimeContext) -> anyhow::Result<()> { + bail!("can't handle"); + } + fn run_wasi(&self, _ctx: &impl RuntimeContext, _stdio: Stdio) -> anyhow::Result { + Ok(0) + } +} + +type InstanceFailingValidation = Instance; + +#[test] +#[cfg(unix)] // not yet implemented on Windows +fn test_validation_error() -> anyhow::Result<()> { + // A validation error should fail when creating the container + // as opposed to failing when starting it. + + let result = WasiTest::::builder()? + .with_start_fn("foo")? + .with_wasm("/invalid_entrypoint.wasm")? + .build(); + + assert!(result.is_err()); + + Ok(()) +} diff --git a/crates/containerd-shim-wasm/src/lib.rs b/crates/containerd-shim-wasm/src/lib.rs index 21238b842..a61a914f5 100644 --- a/crates/containerd-shim-wasm/src/lib.rs +++ b/crates/containerd-shim-wasm/src/lib.rs @@ -10,3 +10,6 @@ pub mod services; #[cfg_attr(unix, path = "sys/unix/mod.rs")] #[cfg_attr(windows, path = "sys/windows/mod.rs")] pub(crate) mod sys; + +#[cfg(any(test, feature = "testing"))] +pub mod testing; diff --git a/crates/containerd-shim-wasm/src/sandbox/instance.rs b/crates/containerd-shim-wasm/src/sandbox/instance.rs index d4d71ac5b..d702ceb6a 100644 --- a/crates/containerd-shim-wasm/src/sandbox/instance.rs +++ b/crates/containerd-shim-wasm/src/sandbox/instance.rs @@ -112,7 +112,9 @@ pub trait Instance { type Engine: Send + Sync + Clone; /// Create a new instance - fn new(id: String, cfg: Option<&InstanceConfig>) -> Self; + fn new(id: String, cfg: Option<&InstanceConfig>) -> Result + where + Self: Sized; /// Start the instance /// The returned value should be a unique ID (such as a PID) for the instance. @@ -178,10 +180,10 @@ pub struct Nop { impl Instance for Nop { type Engine = (); - fn new(_id: String, _cfg: Option<&InstanceConfig>) -> Self { - Nop { + fn new(_id: String, _cfg: Option<&InstanceConfig>) -> Result { + Ok(Nop { exit_code: Arc::new((Mutex::new(None), Condvar::new())), - } + }) } fn start(&self) -> Result { Ok(std::process::id()) @@ -220,7 +222,7 @@ mod noptests { #[test] fn test_nop_kill_sigkill() -> Result<(), Error> { - let nop = Nop::new("".to_string(), None); + let nop = Nop::new("".to_string(), None)?; let (tx, rx) = channel(); let waiter = Wait::new(tx); @@ -233,7 +235,7 @@ mod noptests { #[test] fn test_nop_kill_sigterm() -> Result<(), Error> { - let nop = Nop::new("".to_string(), None); + let nop = Nop::new("".to_string(), None)?; let (tx, rx) = channel(); let waiter = Wait::new(tx); @@ -246,7 +248,7 @@ mod noptests { #[test] fn test_nop_kill_sigint() -> Result<(), Error> { - let nop = Nop::new("".to_string(), None); + let nop = Nop::new("".to_string(), None)?; let (tx, rx) = channel(); let waiter = Wait::new(tx); @@ -258,8 +260,9 @@ mod noptests { } #[test] - fn test_nop_delete_after_create() { - let nop = Nop::new("".to_string(), None); - nop.delete().unwrap(); + fn test_nop_delete_after_create() -> Result<(), Error> { + let nop = Nop::new("".to_string(), None)?; + nop.delete()?; + Ok(()) } } diff --git a/crates/containerd-shim-wasm/src/sandbox/shim.rs b/crates/containerd-shim-wasm/src/sandbox/shim.rs index 77be5703c..9b5533a41 100644 --- a/crates/containerd-shim-wasm/src/sandbox/shim.rs +++ b/crates/containerd-shim-wasm/src/sandbox/shim.rs @@ -746,10 +746,10 @@ impl Local { ); InstanceData { instance: None, - base: Some(Nop::new(id, None)), + base: Some(Nop::new(id, None).unwrap()), cfg, pid: RwLock::new(None), - status: Arc::new((Mutex::new(None), Condvar::new())), + status: Arc::default(), state: Arc::new(RwLock::new(TaskStateWrapper::Created( TaskState:: { s: std::marker::PhantomData, @@ -954,11 +954,11 @@ impl Local { self.instances.write().unwrap().insert( req.id().to_string(), Arc::new(InstanceData { - instance: Some(T::new(req.id().to_string(), Some(&builder))), + instance: Some(T::new(req.id().to_string(), Some(&builder))?), base: None, cfg: builder, pid: RwLock::new(None), - status: Arc::new((Mutex::new(None), Condvar::new())), + status: Arc::default(), state: Arc::new(RwLock::new(TaskStateWrapper::Created( TaskState:: { s: std::marker::PhantomData, @@ -1097,9 +1097,7 @@ impl Local { ..Default::default() }; - let status = i.status.0.lock().unwrap(); - if status.is_some() { - let ec = status.unwrap(); + if let Some(ec) = *i.status.0.lock().unwrap() { event.exit_status = ec.0; resp.exit_status = ec.0; @@ -1111,7 +1109,6 @@ impl Local { event.set_exited_at(timestamp.clone()); resp.set_exited_at(timestamp); } - drop(status); self.instances.write().unwrap().remove(req.id()); @@ -1175,12 +1172,7 @@ impl Local { state.set_pid(pid.unwrap()); - let status = i.status.0.lock().unwrap(); - - let code = *status; - drop(status); - - if let Some(c) = code { + if let Some(c) = *i.status.0.lock().unwrap() { state.set_status(Status::STOPPED); let ec = c; state.exit_status = ec.0; diff --git a/crates/containerd-shim-wasm/src/sys/unix/container/instance.rs b/crates/containerd-shim-wasm/src/sys/unix/container/instance.rs index 39ba7e9fd..a7b2b1c49 100644 --- a/crates/containerd-shim-wasm/src/sys/unix/container/instance.rs +++ b/crates/containerd-shim-wasm/src/sys/unix/container/instance.rs @@ -1,3 +1,4 @@ +use std::marker::PhantomData; use std::path::{Path, PathBuf}; use std::thread; @@ -20,33 +21,37 @@ use crate::sys::container::executor::Executor; static DEFAULT_CONTAINER_ROOT_DIR: &str = "/run/containerd"; pub struct Instance { - engine: E, exit_code: ExitCode, - stdio: Stdio, - bundle: PathBuf, rootdir: PathBuf, id: String, + _phantom: PhantomData, } impl SandboxInstance for Instance { type Engine = E; - fn new(id: String, cfg: Option<&InstanceConfig>) -> Self { - let cfg = cfg.unwrap(); + fn new(id: String, cfg: Option<&InstanceConfig>) -> Result { + let cfg = cfg.context("missing configuration")?; let engine = cfg.get_engine(); - let bundle = cfg.get_bundle().unwrap_or_default().into(); + let bundle = cfg.get_bundle().context("missing bundle")?; let namespace = cfg.get_namespace(); let rootdir = Path::new(DEFAULT_CONTAINER_ROOT_DIR).join(E::name()); - let rootdir = determine_rootdir(&bundle, &namespace, rootdir).unwrap(); - let stdio = Stdio::init_from_cfg(cfg).expect("failed to open stdio"); - Self { + let rootdir = determine_rootdir(&bundle, &namespace, rootdir)?; + let stdio = Stdio::init_from_cfg(cfg)?; + + ContainerBuilder::new(id.clone(), SyscallType::Linux) + .with_executor(Executor::new(engine, stdio)) + .with_root_path(rootdir.clone())? + .as_init(&bundle) + .with_systemd(false) + .build()?; + + Ok(Self { id, exit_code: ExitCode::default(), - engine, - stdio, - bundle, rootdir, - } + _phantom: Default::default(), + }) } /// Start the instance @@ -54,18 +59,12 @@ impl SandboxInstance for Instance { /// Nothing internally should be using this ID, but it is returned to containerd where a user may want to use it. fn start(&self) -> Result { log::info!("starting instance: {}", self.id); - let mut container = ContainerBuilder::new(self.id.clone(), SyscallType::Linux) - .with_executor(Executor::new(self.engine.clone(), self.stdio.take())) - .with_root_path(self.rootdir.clone())? - .as_init(&self.bundle) - .with_systemd(false) - .build()?; + let container_root = get_instance_root(&self.rootdir, &self.id)?; + let mut container = Container::load(container_root)?; let pid = container.pid().context("failed to get pid")?.as_raw(); - container.start().map_err(|err| { - SandboxError::Any(anyhow::anyhow!("failed to start container: {}", err)) - })?; + container.start()?; let exit_code = self.exit_code.clone(); thread::spawn(move || { @@ -110,30 +109,20 @@ impl SandboxInstance for Instance { fn delete(&self) -> Result<(), SandboxError> { log::info!("deleting instance: {}", self.id); match instance_exists(&self.rootdir, &self.id) { - Ok(exists) => { - if !exists { - return Ok(()); - } - } + Ok(true) => {} + Ok(false) => return Ok(()), Err(err) => { log::error!("could not find the container, skipping cleanup: {}", err); return Ok(()); } } let container_root = get_instance_root(&self.rootdir, &self.id)?; - let container = Container::load(container_root) - .with_context(|| format!("could not load state for container {}", self.id)); - match container { - Ok(mut container) => container.delete(true).map_err(|err| { - SandboxError::Any(anyhow::anyhow!( - "failed to delete container {}: {}", - &self.id, - err - )) - })?, + match Container::load(container_root) { + Ok(mut container) => { + container.delete(true)?; + } Err(err) => { log::error!("could not find the container, skipping cleanup: {}", err); - return Ok(()); } } Ok(()) diff --git a/crates/containerd-shim-wasm/src/sys/windows/container/instance.rs b/crates/containerd-shim-wasm/src/sys/windows/container/instance.rs index 0cd561e4e..340b91aee 100644 --- a/crates/containerd-shim-wasm/src/sys/windows/container/instance.rs +++ b/crates/containerd-shim-wasm/src/sys/windows/container/instance.rs @@ -9,7 +9,7 @@ pub struct Instance(PhantomData); impl SandboxInstance for Instance { type Engine = E; - fn new(_id: String, _cfg: Option<&InstanceConfig>) -> Self { + fn new(_id: String, _cfg: Option<&InstanceConfig>) -> Result { todo!(); } diff --git a/crates/containerd-shim-wasm-test/src/lib.rs b/crates/containerd-shim-wasm/src/testing.rs similarity index 96% rename from crates/containerd-shim-wasm-test/src/lib.rs rename to crates/containerd-shim-wasm/src/testing.rs index 53b693a95..62a6e77e9 100644 --- a/crates/containerd-shim-wasm-test/src/lib.rs +++ b/crates/containerd-shim-wasm/src/testing.rs @@ -8,17 +8,12 @@ use std::sync::mpsc::channel; use std::time::Duration; use anyhow::{bail, Result}; -#[cfg(unix)] -use libc::SIGKILL; - -#[cfg(windows)] -const SIGKILL: i32 = 9; - -use containerd_shim_wasm::sandbox::instance::Wait; -use containerd_shim_wasm::sandbox::{Instance, InstanceConfig}; +pub use containerd_shim_wasm_test_modules as modules; use oci_spec::runtime::{ProcessBuilder, RootBuilder, SpecBuilder}; -pub mod modules; +use crate::sandbox::instance::Wait; +use crate::sandbox::{Instance, InstanceConfig}; +use crate::sys::signals::SIGKILL; pub struct WasiTestBuilder where @@ -137,7 +132,7 @@ where .set_stderr(dir.join("stderr").to_string_lossy().to_string()) .set_stdin(dir.join("stdin").to_string_lossy().to_string()); - let instance = WasiInstance::new("test".to_string(), Some(&cfg)); + let instance = WasiInstance::new("test".to_string(), Some(&cfg))?; Ok(WasiTest { instance, tempdir }) } } diff --git a/crates/containerd-shim-wasmedge/Cargo.toml b/crates/containerd-shim-wasmedge/Cargo.toml index ebb224d64..53e32b76d 100644 --- a/crates/containerd-shim-wasmedge/Cargo.toml +++ b/crates/containerd-shim-wasmedge/Cargo.toml @@ -15,7 +15,7 @@ wasmedge-sdk = { version = "0.12.2" } wasmedge-sys = "*" [dev-dependencies] -containerd-shim-wasm-test = { workspace = true } +containerd-shim-wasm = { workspace = true, features = ["testing"] } libc = { workspace = true } serial_test = "*" diff --git a/crates/containerd-shim-wasmedge/src/tests.rs b/crates/containerd-shim-wasmedge/src/tests.rs index a290e95ae..61887e1ac 100644 --- a/crates/containerd-shim-wasmedge/src/tests.rs +++ b/crates/containerd-shim-wasmedge/src/tests.rs @@ -1,8 +1,8 @@ use std::time::Duration; //use containerd_shim_wasm::sandbox::Instance; -use containerd_shim_wasm_test::modules::*; -use containerd_shim_wasm_test::WasiTest; +use containerd_shim_wasm::testing::modules::*; +use containerd_shim_wasm::testing::WasiTest; use serial_test::serial; use crate::instance::WasmEdgeInstance as WasiInstance; diff --git a/crates/containerd-shim-wasmer/Cargo.toml b/crates/containerd-shim-wasmer/Cargo.toml index fbf11f02f..32a6230c7 100644 --- a/crates/containerd-shim-wasmer/Cargo.toml +++ b/crates/containerd-shim-wasmer/Cargo.toml @@ -17,7 +17,7 @@ wasmer-compiler = { version = "4.1.2", features = ["compiler"] } wasmer-wasix = { version = "0.12.0" } [dev-dependencies] -containerd-shim-wasm-test = { workspace = true } +containerd-shim-wasm = { workspace = true, features = ["testing"] } serial_test = "*" [[bin]] diff --git a/crates/containerd-shim-wasmer/src/tests.rs b/crates/containerd-shim-wasmer/src/tests.rs index c3ce8d2e4..15ee5b478 100644 --- a/crates/containerd-shim-wasmer/src/tests.rs +++ b/crates/containerd-shim-wasmer/src/tests.rs @@ -1,8 +1,8 @@ use std::time::Duration; //use containerd_shim_wasm::sandbox::Instance; -use containerd_shim_wasm_test::modules::*; -use containerd_shim_wasm_test::WasiTest; +use containerd_shim_wasm::testing::modules::*; +use containerd_shim_wasm::testing::WasiTest; use serial_test::serial; use crate::instance::WasmerInstance as WasiInstance; diff --git a/crates/containerd-shim-wasmtime/Cargo.toml b/crates/containerd-shim-wasmtime/Cargo.toml index b40f76755..06131e85f 100644 --- a/crates/containerd-shim-wasmtime/Cargo.toml +++ b/crates/containerd-shim-wasmtime/Cargo.toml @@ -29,7 +29,7 @@ wasmtime-wasi = { version = "11.0", features = ["exit"] } wasi-common = "11.0" [dev-dependencies] -containerd-shim-wasm-test = { workspace = true } +containerd-shim-wasm = { workspace = true, features = ["testing"] } serial_test = "*" [[bin]] diff --git a/crates/containerd-shim-wasmtime/src/tests.rs b/crates/containerd-shim-wasmtime/src/tests.rs index 27dbd70c8..e3ed046dd 100644 --- a/crates/containerd-shim-wasmtime/src/tests.rs +++ b/crates/containerd-shim-wasmtime/src/tests.rs @@ -1,8 +1,8 @@ use std::time::Duration; //use containerd_shim_wasm::sandbox::Instance; -use containerd_shim_wasm_test::modules::*; -use containerd_shim_wasm_test::WasiTest; +use containerd_shim_wasm::testing::modules::*; +use containerd_shim_wasm::testing::WasiTest; use serial_test::serial; use crate::instance::WasmtimeInstance as WasiInstance;