Skip to content

test: fix broken and flaky CI Health V2 integ tests - #6386

Merged
lucasjia-aws merged 1 commit into
aws:master-v2from
lucasjia-aws:fix/ci-health-v2-integ-flakes-v2
Oct 6, 2026
Merged

lucasjia-aws merged 1 commit into
aws:master-v2from
lucasjia-aws:fix/ci-health-v2-integ-flakes-v2

Conversation

@lucasjia-aws

Copy link
Copy Markdown
Collaborator

Summary

The scheduled CI Health V2 workflow (slow-tests-v2 and canaries-v2-master, run against master-v2) has been red every day for weeks. Example run: https://github.com/aws/sagemaker-python-sdk/actions/runs/37412457307. This PR fixes the test-side causes; no SDK source changes.

Root causes and fixes

test_sagemaker_config_cross_context_injection (fails every run): DescribeEndpoint/DescribeEndpointConfig now return MetricsConfig: {EnableDetailedObservability: True} by default, and the default VolumeSizeInGB for ml.c5.xlarge changed from 4 to 8. Neither is set by the SDK or the sagemaker_config, so the test now drops them before comparing.

lineage test_context.py::test_action (ERROR every run since 2026-09-28): The autouse cleanup_endpoints fixture in tests/integ/sagemaker/serve/test_base_model_builder_deploy.py deleted every endpoint on the first ListEndpoints page of the shared account before and after each test. On 2026-09-28 it deleted the lineage static endpoint SdkIntegTestStaticEndpoint20 (confirmed in CloudTrail), along with endpoints other running tests were using. ListEndpoints does not return EndpointConfigName, so the endpoint config was left behind; the lineage fixture's redeploy then failed on CreateEndpointConfig, the ValidationException was swallowed as "already exists", and the test ended in list_contexts(SourceUri=None). The sweep is replaced by per-test cleanup of only the resources each test creates, and the lineage fixture now recreates the endpoint from the surviving config and fails with a clear message if it still cannot.

test_deployment_steps_execute_end_to_end (flaky): SageMaker applies NameContains per result page, so a single unpaginated list_endpoint_configs(NameContains=stamp) returns an empty page once more than 10 newer configs exist, which is routine while the canary runs 120 workers in the same account. The same unpaginated calls in cleanup also leaked the test's endpoint. Lookups and cleanup now page through results, with CreationTimeAfter and page size 100 to keep paging cheap.

test_advanced_right_size_and_deploy_unregistered_model_sklearn: CreateInferenceRecommendationsJob was throttled when several module fixtures started IR jobs at once. retry_and_back_off received the already-evaluated right_size() result, so it never retried, and the fixture swallowed the exception and returned None, so the test reported AttributeError/UnboundLocalError instead. The helper now takes a callable, retries throttling with jittered back-off (deleting the model right_size() pre-created before retrying), fixtures re-raise after cleanup, and tests guard predictor in finally.

Insufficient capacity: test_jumpstart_gated_model (ml.g6e.xlarge), the private hub gated model/estimator tests (ml.g5.2xlarge) and test_huggingface_torch_distributed_g5_glue (ml.g5.4xlarge) fail on InsufficientInstanceCapacity or wait for capacity until timeout. They now use the existing x_fail_if_ice (and fit_estimator_with_capacity_xfail for the HF training job), matching how sibling tests already handle capacity.

Testing

black (24.3.0) and flake8 (7.1.2) pass on all changed files, and pytest --collect-only collects all affected integ modules. Offline mock checks covered the retry helper, the paginated lookups (parameters validated with botocore Stubber), the scoped endpoint cleanup, and all lineage endpoint recovery paths. The integ tests themselves were not run locally because they need the CI account; they will be exercised by the next CI Health V2 run.

- sagemaker_config: ignore service-side defaults (MetricsConfig,
  VolumeSizeInGB) that the SDK never sets
- serve: stop deleting every endpoint in the shared account before and
  after each ModelBuilder deploy test; clean up only the test's own
  endpoint, endpoint config and model
- lineage: recreate the static endpoint from its surviving endpoint
  config instead of silently continuing without an endpoint
- deployment steps: page through list_* results, since NameContains is
  applied per page and the run's resources can fall off page one
- inference recommender: make retry_and_back_off actually retry
  throttled right_size() calls, and stop fixtures from swallowing errors
- mark gated JumpStart and HF g5 tests as xfail on insufficient capacity
@lucasjia-aws
lucasjia-aws requested a review from a team as a code owner October 6, 2026 20:55
@lucasjia-aws
lucasjia-aws requested a review from nargokul October 6, 2026 20:55
@lucasjia-aws
lucasjia-aws merged commit 82534ad into aws:master-v2 Oct 6, 2026
2 checks passed
@lucasjia-aws
lucasjia-aws deleted the fix/ci-health-v2-integ-flakes-v2 branch October 12, 2026 17:42

This branch was previously deployed

1 inactive deployment
auto-approve — f9e1e078 Deployed Oct 6, 2026 by lucasjia-aws via wait-for-approval #248
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants