Skip to content

Conversation

smilkuri
Copy link
Contributor

@smilkuri smilkuri commented Sep 25, 2025

Issue

Internal JS-6197

Description

Adds request/response mapping validation tests for S3 Transfer Manager to ensure all required fields are properly copied between PutObject and multipart upload operations, to be compliant with the specification.

Testing

Locally

dev-dsk-smilkuri-1a-17aece6b % yarn test

 RUN  v3.2.4 /local/home/smilkuri/aws-sdk-js-v3/lib/lib-storage

 ✓ src/chunks/getChunkUint8Array.spec.ts (6 tests) 7ms
 ✓ src/index.spec.ts (1 test) 2ms
 ✓ src/request-response-mapping.spec.ts (5 tests) 29ms
 ✓ src/chunks/getDataReadable.spec.ts (3 tests) 189ms
 ✓ src/chunks/getDataReadableStream.spec.ts (4 tests) 189ms
 ✓ src/Upload.spec.ts (34 tests) 23567ms
   ✓ Upload > should add tags to the object if tags have been added multi-part  23494ms

 Test Files  6 passed (6)
      Tests  53 passed (53)
   Start at  14:57:49
   Duration  24.54s (transform 947ms, setup 0ms, collect 2.62s, tests 23.98s, environment 1ms, prepare 843ms)

Checklist

  • [n/a] If the PR is a feature, add integration tests (*.integ.spec.ts).
  • [n/a] If you wrote E2E tests, are they resilient to concurrent I/O?
  • [n/a] If adding new public functions, did you add the @public tag and enable doc generation on the package?

By submitting this pull request, I confirm that you can use, modify, copy, and redistribute this contribution, under the terms of your choice.

@smilkuri smilkuri requested a review from a team as a code owner September 25, 2025 15:26
Copy link
Contributor

@kuhe kuhe left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

use the integ harness to mock the responses of an MPU

CreateMPU -> UploadPart -> UploadPart ->. CompleteMPU

use client middleware to collect the output of the intermediate calls and then compare them to the Upload class' output.

expect(uploadResponse.BucketKeyEnabled).toBe(true);
expect(uploadResponse.ChecksumCRC32).toBe("test-checksum");
expect(uploadResponse.RequestCharged).toBe("requester");
});
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

test is tautological

expect(uploadResponse.BucketKeyEnabled).toBe(true);
expect(uploadResponse.ChecksumCRC32).toBe("test-checksum");
expect(uploadResponse.Location).toBe("https://test-bucket.s3.amazonaws.com/test-key");
});
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

test is tautological

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