@@ -54,7 +54,7 @@ pub struct MongoDBPortBinding {
5454 #[ napi( js_name = "type" ) ]
5555 pub binding_type : BindingType ,
5656 pub ip : String ,
57- pub port : u16 ,
57+ pub port : Option < u16 > ,
5858}
5959
6060#[ napi( string_enum) ]
@@ -231,7 +231,7 @@ mod tests {
231231 state : atlas_local:: models:: State :: Running ,
232232 port_bindings : Some ( atlas_local:: models:: MongoDBPortBinding {
233233 binding_type : atlas_local:: models:: BindingType :: Loopback ,
234- port : 27017 ,
234+ port : Some ( 27017 ) ,
235235 } ) ,
236236 mongodb_type : atlas_local:: models:: MongodbType :: Community ,
237237 mongodb_version : Version :: new ( 8 , 0 , 0 ) ,
@@ -257,7 +257,7 @@ mod tests {
257257 let port_binding = deployment. port_bindings . unwrap ( ) ;
258258 assert_eq ! ( port_binding. binding_type, BindingType :: Loopback ) ;
259259 assert_eq ! ( port_binding. ip, "127.0.0.1" ) ;
260- assert_eq ! ( port_binding. port, 27017 ) ;
260+ assert_eq ! ( port_binding. port, Some ( 27017 ) ) ;
261261 assert_eq ! ( deployment. mongodb_type, MongodbType :: Community ) ;
262262 assert_eq ! ( deployment. mongodb_version, "8.0.0" ) ;
263263 assert_eq ! (
@@ -310,83 +310,83 @@ mod tests {
310310 fn test_mongodb_port_binding_from_lib_mongodb_port_binding_loopback ( ) {
311311 let lib_mongodb_port_binding = atlas_local:: models:: MongoDBPortBinding {
312312 binding_type : atlas_local:: models:: BindingType :: Loopback ,
313- port : 27017 ,
313+ port : Some ( 27017 ) ,
314314 } ;
315315 let mongodb_port_binding: MongoDBPortBinding = lib_mongodb_port_binding. into ( ) ;
316316 assert_eq ! ( mongodb_port_binding. binding_type, BindingType :: Loopback ) ;
317317 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 ) ) ;
319319 }
320320
321321 #[ test]
322322 fn test_mongodb_port_binding_from_lib_mongodb_port_binding_any_interface ( ) {
323323 let lib_mongodb_port_binding = atlas_local:: models:: MongoDBPortBinding {
324324 binding_type : atlas_local:: models:: BindingType :: AnyInterface ,
325- port : 27017 ,
325+ port : Some ( 27017 ) ,
326326 } ;
327327 let mongodb_port_binding: MongoDBPortBinding = lib_mongodb_port_binding. into ( ) ;
328328 assert_eq ! ( mongodb_port_binding. binding_type, BindingType :: AnyInterface ) ;
329329 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 ) ) ;
331331 }
332332
333333 #[ test]
334334 fn test_mongodb_port_binding_from_lib_mongodb_port_binding_specific ( ) {
335335 let lib_mongodb_port_binding = atlas_local:: models:: MongoDBPortBinding {
336336 binding_type : atlas_local:: models:: BindingType :: Specific ( "192.0.2.0" . parse ( ) . unwrap ( ) ) ,
337- port : 27017 ,
337+ port : Some ( 27017 ) ,
338338 } ;
339339 let mongodb_port_binding: MongoDBPortBinding = lib_mongodb_port_binding. into ( ) ;
340340 assert_eq ! ( mongodb_port_binding. binding_type, BindingType :: Specific ) ;
341341 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 ) ) ;
343343 }
344344
345345 #[ test]
346346 fn test_mongodb_port_binding_lib_into_mongodb_port_binding_loopback ( ) {
347347 let mongodb_port_binding = MongoDBPortBinding {
348348 binding_type : BindingType :: Loopback ,
349349 ip : "127.0.0.1" . to_string ( ) ,
350- port : 27017 ,
350+ port : Some ( 27017 ) ,
351351 } ;
352352 let lib_mongodb_port_binding: atlas_local:: models:: MongoDBPortBinding =
353353 mongodb_port_binding. into ( ) ;
354354 assert_eq ! (
355355 lib_mongodb_port_binding. binding_type,
356356 atlas_local:: models:: BindingType :: Loopback
357357 ) ;
358- assert_eq ! ( lib_mongodb_port_binding. port, 27017 ) ;
358+ assert_eq ! ( lib_mongodb_port_binding. port, Some ( 27017 ) ) ;
359359 }
360360
361361 #[ test]
362362 fn test_mongodb_port_binding_lib_into_mongodb_port_binding_any_interface ( ) {
363363 let mongodb_port_binding = MongoDBPortBinding {
364364 binding_type : BindingType :: AnyInterface ,
365365 ip : "0.0.0.0" . to_string ( ) ,
366- port : 27017 ,
366+ port : Some ( 27017 ) ,
367367 } ;
368368 let lib_mongodb_port_binding: atlas_local:: models:: MongoDBPortBinding =
369369 mongodb_port_binding. into ( ) ;
370370 assert_eq ! (
371371 lib_mongodb_port_binding. binding_type,
372372 atlas_local:: models:: BindingType :: AnyInterface
373373 ) ;
374- assert_eq ! ( lib_mongodb_port_binding. port, 27017 ) ;
374+ assert_eq ! ( lib_mongodb_port_binding. port, Some ( 27017 ) ) ;
375375 }
376376 #[ test]
377377 fn test_mongodb_port_binding_lib_into_mongodb_port_binding_specific ( ) {
378378 let mongodb_port_binding = MongoDBPortBinding {
379379 binding_type : BindingType :: Specific ,
380380 ip : "192.0.2.0" . to_string ( ) ,
381- port : 27017 ,
381+ port : Some ( 27017 ) ,
382382 } ;
383383 let lib_mongodb_port_binding: atlas_local:: models:: MongoDBPortBinding =
384384 mongodb_port_binding. into ( ) ;
385385 assert_eq ! (
386386 lib_mongodb_port_binding. binding_type,
387387 atlas_local:: models:: BindingType :: Specific ( "192.0.2.0" . parse( ) . unwrap( ) )
388388 ) ;
389- assert_eq ! ( lib_mongodb_port_binding. port, 27017 ) ;
389+ assert_eq ! ( lib_mongodb_port_binding. port, Some ( 27017 ) ) ;
390390 }
391391
392392 #[ test]
0 commit comments