cc-lb-runtime-wasmtime 0.1.3

Wasmtime-based plugin runtime for cc-lb. Host-side wasm plugin admission + dispatch.
use crate::{
    HotEngineAllocationStrategy, HotEngineConfig, RuntimeSlotKey, WasmtimeRuntime,
    WasmtimeRuntimeError,
};

#[test]
fn engine_build_only() {
    let rt = WasmtimeRuntime::with_defaults().expect("engine build");
    let _ = rt.engine();
    assert_eq!(rt.slot_count(), 0);
}

#[test]
fn pooling_engine_builds_when_selected() {
    let rt = WasmtimeRuntime::new(HotEngineConfig {
        allocation_strategy: HotEngineAllocationStrategy::Pooling,
        ..HotEngineConfig::default()
    })
    .expect("pooling engine build");

    let _ = rt.engine();
    assert_eq!(rt.slot_count(), 0);
}

#[test]
fn missing_slot_returns_error() {
    let rt = WasmtimeRuntime::with_defaults().expect("engine build");
    let err = rt
        .call_filter(&RuntimeSlotKey::global("nonexistent"), &[])
        .expect_err("must fail on missing slot");
    assert!(matches!(err, WasmtimeRuntimeError::ModuleRejected { .. }));
}