2026-07-17 06:00:47 +02:00
|
|
|
use async_trait::async_trait;
|
|
|
|
|
use testing_framework_core::scenario::{Application, DynError};
|
2026-07-17 07:16:38 +02:00
|
|
|
use testing_framework_runner_local::LocalClusterProvisioner;
|
2026-07-17 06:00:47 +02:00
|
|
|
|
|
|
|
|
use crate::DeployContext;
|
|
|
|
|
|
|
|
|
|
/// Typed runtime capability returned by an application deployment.
|
|
|
|
|
///
|
|
|
|
|
/// Handles are cloned when retrieved from the runtime registry. Managed
|
|
|
|
|
/// resources must be acquired through TF adapters, which register scenario
|
|
|
|
|
/// cleanup independently from these clones.
|
|
|
|
|
pub trait AppHandle: Clone + Send + Sync + 'static {}
|
|
|
|
|
|
|
|
|
|
impl<T> AppHandle for T where T: Clone + Send + Sync + 'static {}
|
|
|
|
|
|
|
|
|
|
/// Deploys one reusable application preset and returns its typed handle.
|
|
|
|
|
#[async_trait]
|
2026-07-17 07:16:38 +02:00
|
|
|
pub trait AppDeployment<E, P = LocalClusterProvisioner>: Send + 'static
|
2026-07-17 06:00:47 +02:00
|
|
|
where
|
|
|
|
|
E: Application,
|
|
|
|
|
{
|
|
|
|
|
/// Runtime capability produced by this deployment.
|
|
|
|
|
type Handle: AppHandle;
|
|
|
|
|
|
|
|
|
|
/// Prepares the application and returns its typed runtime access handle.
|
|
|
|
|
///
|
|
|
|
|
/// Child deployments can be composed with [`DeployContext::deploy`] or
|
|
|
|
|
/// [`DeployContext::deploy_and_expose`]. Any handle exposed through the
|
|
|
|
|
/// context remains available through the scenario runtime.
|
2026-07-17 07:16:38 +02:00
|
|
|
async fn deploy(self, ctx: &mut DeployContext<E, P>) -> Result<Self::Handle, DynError>;
|
2026-07-17 06:00:47 +02:00
|
|
|
}
|