Skip to content

Commit d42b0d7

Browse files
author
Mohamed Zeidan
committed
fixed unit tests
1 parent 65dc895 commit d42b0d7

File tree

1 file changed

+12
-8
lines changed

1 file changed

+12
-8
lines changed

tests/unit/sagemaker/jumpstart/estimator/test_sagemaker_config.py

Lines changed: 12 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,7 @@
1818
from sagemaker.config.config_schema import (
1919
MODEL_ENABLE_NETWORK_ISOLATION_PATH,
2020
MODEL_EXECUTION_ROLE_ARN_PATH,
21+
TELEMETRY_OPT_OUT_PATH,
2122
TRAINING_JOB_ENABLE_NETWORK_ISOLATION_PATH,
2223
TRAINING_JOB_INTER_CONTAINER_ENCRYPTION_PATH,
2324
TRAINING_JOB_ROLE_ARN_PATH,
@@ -75,6 +76,9 @@ def config_value_impl(sagemaker_session: Session, config_path: str, sagemaker_co
7576
if config_path == MODEL_ENABLE_NETWORK_ISOLATION_PATH:
7677
return config_inference_enable_network_isolation
7778

79+
if config_path == TELEMETRY_OPT_OUT_PATH:
80+
return False # Default to telemetry enabled for tests
81+
7882
raise AssertionError(f"Bad config path: {config_path}")
7983

8084

@@ -130,7 +134,7 @@ def test_without_arg_overwrites_without_kwarg_collisions_with_config(
130134

131135
estimator.deploy()
132136

133-
self.assertEqual(mock_get_sagemaker_config_value.call_count, 3)
137+
self.assertEqual(mock_get_sagemaker_config_value.call_count, 4)
134138

135139
self.assertEqual(mock_estimator_deploy.call_args[1].get("role"), config_inference_role)
136140

@@ -200,7 +204,7 @@ def test_without_arg_overwrites_with_kwarg_collisions_with_config(
200204

201205
estimator.deploy()
202206

203-
self.assertEqual(mock_get_sagemaker_config_value.call_count, 6)
207+
self.assertEqual(mock_get_sagemaker_config_value.call_count, 7)
204208

205209
self.assertEqual(mock_estimator_deploy.call_args[1].get("role"), config_inference_role)
206210

@@ -280,7 +284,7 @@ def test_with_arg_overwrites_with_kwarg_collisions_with_config(
280284
enable_network_isolation=override_inference_enable_network_isolation,
281285
)
282286

283-
self.assertEqual(mock_get_sagemaker_config_value.call_count, 3)
287+
self.assertEqual(mock_get_sagemaker_config_value.call_count, 4)
284288

285289
self.assertEqual(
286290
mock_estimator_deploy.call_args[1].get("role"), mock_inference_override_role
@@ -355,7 +359,7 @@ def test_with_arg_overwrites_without_kwarg_collisions_with_config(
355359
enable_network_isolation=override_inference_enable_network_isolation,
356360
)
357361

358-
self.assertEqual(mock_get_sagemaker_config_value.call_count, 3)
362+
self.assertEqual(mock_get_sagemaker_config_value.call_count, 4)
359363

360364
self.assertEqual(
361365
mock_estimator_deploy.call_args[1].get("role"), mock_inference_override_role
@@ -421,7 +425,7 @@ def test_without_arg_overwrites_without_kwarg_collisions_without_config(
421425

422426
mock_retrieve_model_init_kwargs.return_value = {}
423427

424-
self.assertEqual(mock_get_sagemaker_config_value.call_count, 3)
428+
self.assertEqual(mock_get_sagemaker_config_value.call_count, 4)
425429

426430
self.assertEqual(mock_estimator_deploy.call_args[1].get("role"), execution_role)
427431

@@ -492,7 +496,7 @@ def test_without_arg_overwrites_with_kwarg_collisions_without_config(
492496

493497
estimator.deploy()
494498

495-
self.assertEqual(mock_get_sagemaker_config_value.call_count, 6)
499+
self.assertEqual(mock_get_sagemaker_config_value.call_count, 7)
496500

497501
self.assertEqual(mock_estimator_deploy.call_args[1].get("role"), execution_role)
498502

@@ -568,7 +572,7 @@ def test_with_arg_overwrites_with_kwarg_collisions_without_config(
568572
enable_network_isolation=override_inference_enable_network_isolation,
569573
)
570574

571-
self.assertEqual(mock_get_sagemaker_config_value.call_count, 3)
575+
self.assertEqual(mock_get_sagemaker_config_value.call_count, 4)
572576

573577
self.assertEqual(mock_estimator_deploy.call_args[1].get("role"), override_inference_role)
574578

@@ -634,7 +638,7 @@ def test_with_arg_overwrites_without_kwarg_collisions_without_config(
634638
enable_network_isolation=override_enable_network_isolation,
635639
)
636640

637-
self.assertEqual(mock_get_sagemaker_config_value.call_count, 3)
641+
self.assertEqual(mock_get_sagemaker_config_value.call_count, 4)
638642

639643
self.assertEqual(mock_estimator_deploy.call_args[1].get("role"), override_inference_role)
640644

0 commit comments

Comments
 (0)