Skip to content

Commit a1e7add

Browse files
author
Rishabh Devnani
committed
fix(tests): Use the shared session fixtures in the new integ tests
Both new integ tests defined local sagemaker_session and pipeline_session fixtures returning a bare Session() / PipelineSession(), shadowing the shared ones in tests/integ/conftest.py. CI runs the integ suite with AWS_DEFAULT_REGION unset, so a bare session has no region and both tests error at setup with "Must setup local AWS configuration with a region supported by SageMaker". The local role fixture went too, since the shared conftest provides one. The shared fixtures build on a boto3.Session carrying an explicit region, which is exactly what was missing. Found on the v2 equivalent of these tests, where CI reported it; the same shadowing was present here and would have failed the same way once these tests ran. Testing: both integ tests re-run against the service using the shared fixtures -- lineage in 15.62s with AWS_DEFAULT_REGION unset, and the chained EndpointConfig -> Endpoint -> InferenceComponent pipeline in 413.44s -- with no resources left behind. 327 workflow unit tests still pass. --- X-AI-Prompt: did you read the comment on the pr? X-AI-Tool: kiro-cli
1 parent 2665140 commit a1e7add

2 files changed

Lines changed: 8 additions & 30 deletions

File tree

‎sagemaker-mlops/tests/integ/workflow/test_deployment_steps.py‎

Lines changed: 4 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -31,8 +31,6 @@
3131
import pytest
3232

3333
from sagemaker.core import image_uris
34-
from sagemaker.core.helper.session_helper import Session, get_execution_role
35-
from sagemaker.core.workflow.pipeline_context import PipelineSession
3634
from sagemaker.mlops.workflow.endpoint_step import EndpointConfigStep, EndpointStep
3735
from sagemaker.mlops.workflow.inference_component_step import InferenceComponentStep
3836
from sagemaker.mlops.workflow.pipeline import Pipeline
@@ -42,19 +40,10 @@
4240
POLL_SECONDS = 30
4341

4442

45-
@pytest.fixture
46-
def sagemaker_session():
47-
return Session()
48-
49-
50-
@pytest.fixture
51-
def pipeline_session():
52-
return PipelineSession()
53-
54-
55-
@pytest.fixture
56-
def role():
57-
return get_execution_role()
43+
# sagemaker_session, pipeline_session and role come from tests/integ/conftest.py.
44+
# They build their sessions on a boto3.Session carrying an explicit region, which a
45+
# bare Session() would not have: CI runs the integ suite with AWS_DEFAULT_REGION
46+
# unset.
5847

5948

6049
def test_deployment_steps_execute_end_to_end(sagemaker_session, pipeline_session, role):

‎sagemaker-mlops/tests/integ/workflow/test_lineage_step.py‎

Lines changed: 4 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -36,11 +36,9 @@
3636

3737
import pytest
3838

39-
from sagemaker.core.helper.session_helper import Session, get_execution_role
4039
from sagemaker.core.lineage.action import Action
4140
from sagemaker.core.lineage.artifact import Artifact
4241
from sagemaker.core.lineage.context import Context
43-
from sagemaker.core.workflow.pipeline_context import PipelineSession
4442
from sagemaker.mlops.workflow.lineage_step import (
4543
LineageAssociation,
4644
LineageEntityReference,
@@ -49,19 +47,10 @@
4947
from sagemaker.mlops.workflow.pipeline import Pipeline
5048

5149

52-
@pytest.fixture
53-
def sagemaker_session():
54-
return Session()
55-
56-
57-
@pytest.fixture
58-
def pipeline_session():
59-
return PipelineSession()
60-
61-
62-
@pytest.fixture
63-
def role():
64-
return get_execution_role()
50+
# sagemaker_session, pipeline_session and role come from tests/integ/conftest.py.
51+
# They build their sessions on a boto3.Session carrying an explicit region, which a
52+
# bare Session() would not have: CI runs the integ suite with AWS_DEFAULT_REGION
53+
# unset.
6554

6655

6756
def test_lineage_step_execute_end_to_end(sagemaker_session, pipeline_session, role):

0 commit comments

Comments
 (0)