@@ -141,6 +141,7 @@ def test_sklearn_with_all_parameters(exists_mock, isfile_mock, ecr_prefix, sagem
141141 subnets = ["my_subnet_id" ],
142142 security_group_ids = ["my_security_group_id" ],
143143 enable_network_isolation = True ,
144+ encrypt_inter_container_traffic = True ,
144145 ),
145146 sagemaker_session = sagemaker_session ,
146147 )
@@ -330,6 +331,7 @@ def test_script_processor_with_all_parameters(exists_mock, isfile_mock, sagemake
330331 subnets = ["my_subnet_id" ],
331332 security_group_ids = ["my_security_group_id" ],
332333 enable_network_isolation = True ,
334+ encrypt_inter_container_traffic = True ,
333335 ),
334336 sagemaker_session = sagemaker_session ,
335337 )
@@ -386,6 +388,49 @@ def test_processor_with_required_parameters(sagemaker_session):
386388 sagemaker_session .process .assert_called_with (** expected_args )
387389
388390
391+ def test_processor_with_missing_network_config_parameters (sagemaker_session ):
392+ processor = Processor (
393+ role = ROLE ,
394+ image_uri = CUSTOM_IMAGE_URI ,
395+ instance_count = 1 ,
396+ instance_type = "ml.m4.xlarge" ,
397+ sagemaker_session = sagemaker_session ,
398+ network_config = NetworkConfig (enable_network_isolation = True ),
399+ )
400+
401+ processor .run ()
402+
403+ expected_args = _get_expected_args (processor ._current_job_name )
404+ del expected_args ["app_specification" ]["ContainerEntrypoint" ]
405+ expected_args ["inputs" ] = []
406+ expected_args ["network_config" ] = {"EnableNetworkIsolation" : True }
407+
408+ sagemaker_session .process .assert_called_with (** expected_args )
409+
410+
411+ def test_processor_with_encryption_parameter_in_network_config (sagemaker_session ):
412+ processor = Processor (
413+ role = ROLE ,
414+ image_uri = CUSTOM_IMAGE_URI ,
415+ instance_count = 1 ,
416+ instance_type = "ml.m4.xlarge" ,
417+ sagemaker_session = sagemaker_session ,
418+ network_config = NetworkConfig (encrypt_inter_container_traffic = False ),
419+ )
420+
421+ processor .run ()
422+
423+ expected_args = _get_expected_args (processor ._current_job_name )
424+ del expected_args ["app_specification" ]["ContainerEntrypoint" ]
425+ expected_args ["inputs" ] = []
426+ expected_args ["network_config" ] = {
427+ "EnableNetworkIsolation" : False ,
428+ "EnableInterContainerTrafficEncryption" : False ,
429+ }
430+
431+ sagemaker_session .process .assert_called_with (** expected_args )
432+
433+
389434def test_processor_with_all_parameters (sagemaker_session ):
390435 processor = Processor (
391436 role = ROLE ,
@@ -405,6 +450,7 @@ def test_processor_with_all_parameters(sagemaker_session):
405450 subnets = ["my_subnet_id" ],
406451 security_group_ids = ["my_security_group_id" ],
407452 enable_network_isolation = True ,
453+ encrypt_inter_container_traffic = True ,
408454 ),
409455 )
410456
@@ -580,6 +626,7 @@ def _get_expected_args_all_parameters(job_name):
580626 "environment" : {"my_env_variable" : "my_env_variable_value" },
581627 "network_config" : {
582628 "EnableNetworkIsolation" : True ,
629+ "EnableInterContainerTrafficEncryption" : True ,
583630 "VpcConfig" : {
584631 "SecurityGroupIds" : ["my_security_group_id" ],
585632 "Subnets" : ["my_subnet_id" ],
0 commit comments