Skip to content

feat(integ): add S3 integration tests for media blocks#461

Draft
Unshure wants to merge 1 commit intomainfrom
agent-tasks/180
Draft

feat(integ): add S3 integration tests for media blocks#461
Unshure wants to merge 1 commit intomainfrom
agent-tasks/180

Conversation

@Unshure
Copy link
Member

@Unshure Unshure commented Jan 30, 2026

Motivation

The SDK's media block types (ImageBlock, DocumentBlock, VideoBlock) support S3 location sources, but this functionality lacked integration test coverage. Without S3 integration tests, regressions in S3 location handling could go undetected in CI.

This PR adds integration tests that validate media blocks can be loaded from S3 sources, following the pattern established in the Python SDK (PR #1572).

Resolves #180

Public API Changes

No public API changes. This PR adds integration test infrastructure only.

Implementation Approach

The tests use Vitest's inject() pattern to share S3 URIs across test files:

  1. Global Setup: During test setup, the S3 test helper uploads test files (yellow.png, letter.pdf, blue.mp4) to an account-specific S3 bucket (strands-integ-tests-resources-{accountId})
  2. Context Injection: S3 URIs are provided via inject('s3-resources') for use in any test file
  3. Graceful Skip: Tests skip automatically when AWS credentials are unavailable (local development)

S3 Bucket Strategy (from Python SDK)

  • Bucket name: strands-integ-tests-resources-{accountId}
  • Region: us-west-2
  • Bucket persists between runs (not deleted after tests)

Test Coverage

Tests validate that Bedrock can process media from S3 locations:

  • Image from S3 (ImageBlock with s3Location source)
  • Document from S3 (DocumentBlock with s3Location source)
  • Video from S3 (VideoBlock with s3Location source, uses Nova Pro for video support)

- Add @aws-sdk/client-s3 and @aws-sdk/client-sts as dev dependencies
- Add blue.mp4 video file for video S3 location testing
- Create s3-test-helper.ts with utilities for S3 bucket setup and file upload
- Update vitest.d.ts with S3 resources context type
- Update global setup to upload test files to S3 and provide URIs via inject()
- Add integration tests for image, document, and video from S3 locations
- Tests skip gracefully when AWS credentials unavailable
dbschmigelski pushed a commit to dbschmigelski/sdk-typescript that referenced this pull request Feb 5, 2026
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.

Add S3 integration tests for media blocks

2 participants