@@ -54,7 +54,7 @@ pub struct MongoDBPortBinding {
54
54
#[ napi( js_name = "type" ) ]
55
55
pub binding_type : BindingType ,
56
56
pub ip : String ,
57
- pub port : u16 ,
57
+ pub port : Option < u16 > ,
58
58
}
59
59
60
60
#[ napi( string_enum) ]
@@ -231,7 +231,7 @@ mod tests {
231
231
state : atlas_local:: models:: State :: Running ,
232
232
port_bindings : Some ( atlas_local:: models:: MongoDBPortBinding {
233
233
binding_type : atlas_local:: models:: BindingType :: Loopback ,
234
- port : 27017 ,
234
+ port : Some ( 27017 ) ,
235
235
} ) ,
236
236
mongodb_type : atlas_local:: models:: MongodbType :: Community ,
237
237
mongodb_version : Version :: new ( 8 , 0 , 0 ) ,
@@ -257,7 +257,7 @@ mod tests {
257
257
let port_binding = deployment. port_bindings . unwrap ( ) ;
258
258
assert_eq ! ( port_binding. binding_type, BindingType :: Loopback ) ;
259
259
assert_eq ! ( port_binding. ip, "127.0.0.1" ) ;
260
- assert_eq ! ( port_binding. port, 27017 ) ;
260
+ assert_eq ! ( port_binding. port, Some ( 27017 ) ) ;
261
261
assert_eq ! ( deployment. mongodb_type, MongodbType :: Community ) ;
262
262
assert_eq ! ( deployment. mongodb_version, "8.0.0" ) ;
263
263
assert_eq ! (
@@ -310,83 +310,83 @@ mod tests {
310
310
fn test_mongodb_port_binding_from_lib_mongodb_port_binding_loopback ( ) {
311
311
let lib_mongodb_port_binding = atlas_local:: models:: MongoDBPortBinding {
312
312
binding_type : atlas_local:: models:: BindingType :: Loopback ,
313
- port : 27017 ,
313
+ port : Some ( 27017 ) ,
314
314
} ;
315
315
let mongodb_port_binding: MongoDBPortBinding = lib_mongodb_port_binding. into ( ) ;
316
316
assert_eq ! ( mongodb_port_binding. binding_type, BindingType :: Loopback ) ;
317
317
assert_eq ! ( mongodb_port_binding. ip, "127.0.0.1" ) ;
318
- assert_eq ! ( mongodb_port_binding. port, 27017 ) ;
318
+ assert_eq ! ( mongodb_port_binding. port, Some ( 27017 ) ) ;
319
319
}
320
320
321
321
#[ test]
322
322
fn test_mongodb_port_binding_from_lib_mongodb_port_binding_any_interface ( ) {
323
323
let lib_mongodb_port_binding = atlas_local:: models:: MongoDBPortBinding {
324
324
binding_type : atlas_local:: models:: BindingType :: AnyInterface ,
325
- port : 27017 ,
325
+ port : Some ( 27017 ) ,
326
326
} ;
327
327
let mongodb_port_binding: MongoDBPortBinding = lib_mongodb_port_binding. into ( ) ;
328
328
assert_eq ! ( mongodb_port_binding. binding_type, BindingType :: AnyInterface ) ;
329
329
assert_eq ! ( mongodb_port_binding. ip, "0.0.0.0" ) ;
330
- assert_eq ! ( mongodb_port_binding. port, 27017 ) ;
330
+ assert_eq ! ( mongodb_port_binding. port, Some ( 27017 ) ) ;
331
331
}
332
332
333
333
#[ test]
334
334
fn test_mongodb_port_binding_from_lib_mongodb_port_binding_specific ( ) {
335
335
let lib_mongodb_port_binding = atlas_local:: models:: MongoDBPortBinding {
336
336
binding_type : atlas_local:: models:: BindingType :: Specific ( "192.0.2.0" . parse ( ) . unwrap ( ) ) ,
337
- port : 27017 ,
337
+ port : Some ( 27017 ) ,
338
338
} ;
339
339
let mongodb_port_binding: MongoDBPortBinding = lib_mongodb_port_binding. into ( ) ;
340
340
assert_eq ! ( mongodb_port_binding. binding_type, BindingType :: Specific ) ;
341
341
assert_eq ! ( mongodb_port_binding. ip, "192.0.2.0" ) ;
342
- assert_eq ! ( mongodb_port_binding. port, 27017 ) ;
342
+ assert_eq ! ( mongodb_port_binding. port, Some ( 27017 ) ) ;
343
343
}
344
344
345
345
#[ test]
346
346
fn test_mongodb_port_binding_lib_into_mongodb_port_binding_loopback ( ) {
347
347
let mongodb_port_binding = MongoDBPortBinding {
348
348
binding_type : BindingType :: Loopback ,
349
349
ip : "127.0.0.1" . to_string ( ) ,
350
- port : 27017 ,
350
+ port : Some ( 27017 ) ,
351
351
} ;
352
352
let lib_mongodb_port_binding: atlas_local:: models:: MongoDBPortBinding =
353
353
mongodb_port_binding. into ( ) ;
354
354
assert_eq ! (
355
355
lib_mongodb_port_binding. binding_type,
356
356
atlas_local:: models:: BindingType :: Loopback
357
357
) ;
358
- assert_eq ! ( lib_mongodb_port_binding. port, 27017 ) ;
358
+ assert_eq ! ( lib_mongodb_port_binding. port, Some ( 27017 ) ) ;
359
359
}
360
360
361
361
#[ test]
362
362
fn test_mongodb_port_binding_lib_into_mongodb_port_binding_any_interface ( ) {
363
363
let mongodb_port_binding = MongoDBPortBinding {
364
364
binding_type : BindingType :: AnyInterface ,
365
365
ip : "0.0.0.0" . to_string ( ) ,
366
- port : 27017 ,
366
+ port : Some ( 27017 ) ,
367
367
} ;
368
368
let lib_mongodb_port_binding: atlas_local:: models:: MongoDBPortBinding =
369
369
mongodb_port_binding. into ( ) ;
370
370
assert_eq ! (
371
371
lib_mongodb_port_binding. binding_type,
372
372
atlas_local:: models:: BindingType :: AnyInterface
373
373
) ;
374
- assert_eq ! ( lib_mongodb_port_binding. port, 27017 ) ;
374
+ assert_eq ! ( lib_mongodb_port_binding. port, Some ( 27017 ) ) ;
375
375
}
376
376
#[ test]
377
377
fn test_mongodb_port_binding_lib_into_mongodb_port_binding_specific ( ) {
378
378
let mongodb_port_binding = MongoDBPortBinding {
379
379
binding_type : BindingType :: Specific ,
380
380
ip : "192.0.2.0" . to_string ( ) ,
381
- port : 27017 ,
381
+ port : Some ( 27017 ) ,
382
382
} ;
383
383
let lib_mongodb_port_binding: atlas_local:: models:: MongoDBPortBinding =
384
384
mongodb_port_binding. into ( ) ;
385
385
assert_eq ! (
386
386
lib_mongodb_port_binding. binding_type,
387
387
atlas_local:: models:: BindingType :: Specific ( "192.0.2.0" . parse( ) . unwrap( ) )
388
388
) ;
389
- assert_eq ! ( lib_mongodb_port_binding. port, 27017 ) ;
389
+ assert_eq ! ( lib_mongodb_port_binding. port, Some ( 27017 ) ) ;
390
390
}
391
391
392
392
#[ test]
0 commit comments