From 90dfb1f89838e461439937992ab829357876f5de Mon Sep 17 00:00:00 2001 From: aemous Date: Tue, 24 Sep 2024 10:17:37 -0400 Subject: [PATCH] Fix failing CI tests and bugfix. --- .changes/next-release/bugfix-copy-81213.json | 5 +++++ awscli/customizations/s3/subcommands.py | 4 +++- tests/unit/customizations/s3/test_utils.py | 5 ----- 3 files changed, 8 insertions(+), 6 deletions(-) create mode 100644 .changes/next-release/bugfix-copy-81213.json diff --git a/.changes/next-release/bugfix-copy-81213.json b/.changes/next-release/bugfix-copy-81213.json new file mode 100644 index 000000000000..a20b987811fc --- /dev/null +++ b/.changes/next-release/bugfix-copy-81213.json @@ -0,0 +1,5 @@ +{ + "type": "bugfix", + "category": "copy", + "description": "Added support for ``ChecksumAlgorithm`` when uploading copy data in parts." +} diff --git a/awscli/customizations/s3/subcommands.py b/awscli/customizations/s3/subcommands.py index 3b469dced2e0..1aabe9896ddc 100644 --- a/awscli/customizations/s3/subcommands.py +++ b/awscli/customizations/s3/subcommands.py @@ -1286,11 +1286,13 @@ def _validate_path_args(self): if self._should_emit_validate_s3_paths_warning(): self._emit_validate_s3_paths_warning() + checksum_algorithm_allowed_paths = ['locals3', 's3s3'] if self.cmd in ['cp', 'sync'] else ['locals3'] + if params.get('checksum_algorithm'): self._raise_if_paths_type_incorrect_for_param( CHECKSUM_ALGORITHM['name'], params['paths_type'], - ['locals3', 's3s3']) + checksum_algorithm_allowed_paths) if params.get('checksum_mode'): self._raise_if_paths_type_incorrect_for_param( CHECKSUM_MODE['name'], diff --git a/tests/unit/customizations/s3/test_utils.py b/tests/unit/customizations/s3/test_utils.py index 7435f69872b4..8c44edc4c013 100644 --- a/tests/unit/customizations/s3/test_utils.py +++ b/tests/unit/customizations/s3/test_utils.py @@ -663,11 +663,6 @@ def test_put_object(self, cli_params): RequestParamsMapper.map_put_object_params(request_params, cli_params) assert request_params == {'ChecksumAlgorithm': 'CRC32'} - def test_upload_part(self, cli_params): - request_params = {} - RequestParamsMapper.map_upload_part_params(request_params, cli_params) - assert request_params == {'ChecksumAlgorithm': 'CRC32'} - class TestRequestParamsMapperChecksumMode: @pytest.fixture