()
| 831 | #[test] |
| 832 | #[cfg(feature = "component-model")] |
| 833 | fn total_component_instances_limit() -> Result<()> { |
| 834 | const TOTAL_COMPONENT_INSTANCES: u32 = 5; |
| 835 | |
| 836 | let mut pool = crate::small_pool_config(); |
| 837 | pool.total_component_instances(TOTAL_COMPONENT_INSTANCES); |
| 838 | let mut config = Config::new(); |
| 839 | config.wasm_component_model(true); |
| 840 | config.allocation_strategy(pool); |
| 841 | |
| 842 | let engine = Engine::new(&config)?; |
| 843 | let linker = wasmtime::component::Linker::new(&engine); |
| 844 | let component = wasmtime::component::Component::new(&engine, "(component)")?; |
| 845 | |
| 846 | let mut store = Store::new(&engine, ()); |
| 847 | for _ in 0..TOTAL_COMPONENT_INSTANCES { |
| 848 | linker.instantiate(&mut store, &component)?; |
| 849 | } |
| 850 | |
| 851 | match linker.instantiate(&mut store, &component) { |
| 852 | Ok(_) => panic!("should have hit component instance limit"), |
| 853 | Err(e) => assert!(e.is::<PoolConcurrencyLimitError>()), |
| 854 | } |
| 855 | |
| 856 | drop(store); |
| 857 | let mut store = Store::new(&engine, ()); |
| 858 | for _ in 0..TOTAL_COMPONENT_INSTANCES { |
| 859 | linker.instantiate(&mut store, &component)?; |
| 860 | } |
| 861 | |
| 862 | Ok(()) |
| 863 | } |
| 864 | |
| 865 | #[test] |
| 866 | #[cfg(feature = "component-model")] |
nothing calls this directly
no test coverage detected