diff --git a/Cargo.toml b/Cargo.toml index 1af2de8..0348a4c 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -10,7 +10,7 @@ crate-type = ["cdylib"] [dependencies] anyhow = "1.0.99" -atlas-local = { git = "https://github.com/mongodb/atlas-local-lib.git", rev = "323a879b8385e8e572f8545e3273fafa5698f8c6" } +atlas-local = { git = "https://github.com/mongodb/atlas-local-lib.git", rev = "fa7cb7aa67e9169f48864a81f3b63f1cf35c81bb" } bollard = "0.19.2" napi = { version = "3.0.0", features = ["async", "anyhow"] } napi-derive = "3.0.0" diff --git a/index.d.ts b/index.d.ts index 87f361d..af104f3 100644 --- a/index.d.ts +++ b/index.d.ts @@ -17,6 +17,8 @@ export interface CreateDeploymentOptions { name?: string image?: string mongodbVersion?: string + waitUntilHealthy?: boolean + waitUntilHealthyTimeout?: number creationSource?: CreationSource localSeedLocation?: string mongodbInitdbDatabase?: string diff --git a/src/models/create_deployment.rs b/src/models/create_deployment.rs index 3b74fd5..400dcd6 100644 --- a/src/models/create_deployment.rs +++ b/src/models/create_deployment.rs @@ -1,6 +1,7 @@ use crate::models::list_deployments::{CreationSource, MongoDBPortBinding}; use napi_derive::napi; use semver::Version; +use std::time::Duration; #[napi(object)] pub struct CreateDeploymentOptions { @@ -11,7 +12,9 @@ pub struct CreateDeploymentOptions { pub image: Option, pub mongodb_version: Option, - // Creation source + // Creation Options + pub wait_until_healthy: Option, + pub wait_until_healthy_timeout: Option, pub creation_source: Option, // Initial database configuration @@ -49,6 +52,10 @@ impl From for atlas_local::models::CreateDeploymentOpti name: source.name, image: source.image, mongodb_version: version, + wait_until_healthy: source.wait_until_healthy, + wait_until_healthy_timeout: source + .wait_until_healthy_timeout + .map(|timeout| Duration::from_secs(timeout as u64)), creation_source: source .creation_source .map(atlas_local::models::CreationSource::from), @@ -81,6 +88,8 @@ mod tests { name: Some("test_deployment".to_string()), image: Some("mongodb/mongodb-atlas-local".to_string()), mongodb_version: Some("8.0.0".to_string()), + wait_until_healthy: Some(true), + wait_until_healthy_timeout: Some(30), creation_source: Some(CreationSource { source_type: CreationSourceType::MCPServer, source: "MCPSERVER".to_string(), @@ -115,6 +124,11 @@ mod tests { lib_create_deployment_options.mongodb_version, Some(Version::new(8, 0, 0)) ); + assert_eq!(lib_create_deployment_options.wait_until_healthy, Some(true)); + assert_eq!( + lib_create_deployment_options.wait_until_healthy_timeout, + Some(Duration::from_secs(30)) + ); assert_eq!( lib_create_deployment_options.creation_source, Some(atlas_local::models::CreationSource::MCPServer)