feat(runtime): unregister service revisions
Add a lifecycle-serialized unregister operation that stops a resident Actor before releasing its registered and compiled Component. Return the existing not-registered and unavailable errors without leaving a partially removed live revision, and cover Actor and registration count cleanup.
This commit is contained in:
@@ -283,6 +283,23 @@ fn kv_capability_requires_a_backend_and_enforces_limits() {
|
||||
runtime.stop(&key).unwrap();
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn unregister_stops_actor_and_releases_compiled_revision() {
|
||||
let runtime = Runtime::new(RuntimeConfig::default()).expect("runtime should start");
|
||||
let key = register_component(&runtime, "unregister", "echo_component.wasm", test_limits());
|
||||
runtime.start(&key, Vec::new()).unwrap();
|
||||
|
||||
runtime.unregister(&key).unwrap();
|
||||
|
||||
let stats = runtime.stats().unwrap();
|
||||
assert_eq!(stats.registered_services, 0);
|
||||
assert_eq!(stats.running_actors, 0);
|
||||
assert!(matches!(
|
||||
runtime.start(&key, Vec::new()),
|
||||
Err(RuntimeError::ServiceNotRegistered(missing)) if missing == key
|
||||
));
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn registration_rejects_non_whitelisted_wasi_imports() {
|
||||
let runtime = Runtime::new(RuntimeConfig::default()).expect("runtime should start");
|
||||
|
||||
Reference in New Issue
Block a user