Skip to content

Commit 5587387

Browse files
Merge pull request #6 from mongodb-js/MCP-194
feat: Add wait for healthy options to CreateDeploymentOptions
2 parents 1781b67 + 1fdbe70 commit 5587387

File tree

3 files changed

+18
-2
lines changed

3 files changed

+18
-2
lines changed

Cargo.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ crate-type = ["cdylib"]
1010

1111
[dependencies]
1212
anyhow = "1.0.99"
13-
atlas-local = { git = "https://github.com/mongodb/atlas-local-lib.git", rev = "323a879b8385e8e572f8545e3273fafa5698f8c6" }
13+
atlas-local = { git = "https://github.com/mongodb/atlas-local-lib.git", rev = "fa7cb7aa67e9169f48864a81f3b63f1cf35c81bb" }
1414
bollard = "0.19.2"
1515
napi = { version = "3.0.0", features = ["async", "anyhow"] }
1616
napi-derive = "3.0.0"

index.d.ts

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,8 @@ export interface CreateDeploymentOptions {
1717
name?: string
1818
image?: string
1919
mongodbVersion?: string
20+
waitUntilHealthy?: boolean
21+
waitUntilHealthyTimeout?: number
2022
creationSource?: CreationSource
2123
localSeedLocation?: string
2224
mongodbInitdbDatabase?: string

src/models/create_deployment.rs

Lines changed: 15 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
use crate::models::list_deployments::{CreationSource, MongoDBPortBinding};
22
use napi_derive::napi;
33
use semver::Version;
4+
use std::time::Duration;
45

56
#[napi(object)]
67
pub struct CreateDeploymentOptions {
@@ -11,7 +12,9 @@ pub struct CreateDeploymentOptions {
1112
pub image: Option<String>,
1213
pub mongodb_version: Option<String>,
1314

14-
// Creation source
15+
// Creation Options
16+
pub wait_until_healthy: Option<bool>,
17+
pub wait_until_healthy_timeout: Option<u32>,
1518
pub creation_source: Option<CreationSource>,
1619

1720
// Initial database configuration
@@ -49,6 +52,10 @@ impl From<CreateDeploymentOptions> for atlas_local::models::CreateDeploymentOpti
4952
name: source.name,
5053
image: source.image,
5154
mongodb_version: version,
55+
wait_until_healthy: source.wait_until_healthy,
56+
wait_until_healthy_timeout: source
57+
.wait_until_healthy_timeout
58+
.map(|timeout| Duration::from_secs(timeout as u64)),
5259
creation_source: source
5360
.creation_source
5461
.map(atlas_local::models::CreationSource::from),
@@ -81,6 +88,8 @@ mod tests {
8188
name: Some("test_deployment".to_string()),
8289
image: Some("mongodb/mongodb-atlas-local".to_string()),
8390
mongodb_version: Some("8.0.0".to_string()),
91+
wait_until_healthy: Some(true),
92+
wait_until_healthy_timeout: Some(30),
8493
creation_source: Some(CreationSource {
8594
source_type: CreationSourceType::MCPServer,
8695
source: "MCPSERVER".to_string(),
@@ -115,6 +124,11 @@ mod tests {
115124
lib_create_deployment_options.mongodb_version,
116125
Some(Version::new(8, 0, 0))
117126
);
127+
assert_eq!(lib_create_deployment_options.wait_until_healthy, Some(true));
128+
assert_eq!(
129+
lib_create_deployment_options.wait_until_healthy_timeout,
130+
Some(Duration::from_secs(30))
131+
);
118132
assert_eq!(
119133
lib_create_deployment_options.creation_source,
120134
Some(atlas_local::models::CreationSource::MCPServer)

0 commit comments

Comments
 (0)