-
Notifications
You must be signed in to change notification settings - Fork 90
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Co-authored-by: Alexei Mochalov <[email protected]>
- Loading branch information
1 parent
84867b0
commit 57095a7
Showing
12 changed files
with
392 additions
and
73 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,45 @@ | ||
from unittest import mock | ||
|
||
import t4_lambda_pkgpush | ||
from quilt3.util import PhysicalKey | ||
|
||
|
||
@mock.patch("t4_lambda_pkgpush.S3_COPY_LAMBDA_CONCURRENCY", 1) | ||
def test_copy_file_list(): | ||
BUCKET = "bucket" | ||
VERSION_ID = "version-id" | ||
CREDENTIALS = t4_lambda_pkgpush.AWSCredentials( | ||
key="a", | ||
secret="b", | ||
token="c", | ||
) | ||
ENTRIES = [ | ||
("a", 4), | ||
("b", 5), | ||
("c", 1), | ||
] | ||
ENTRIES = { | ||
key: { | ||
"src": PhysicalKey(BUCKET, key, "src-version"), | ||
"dst": PhysicalKey(BUCKET, key, None), | ||
"result": PhysicalKey(BUCKET, key, VERSION_ID), | ||
"size": size, | ||
} | ||
for key, size in ENTRIES | ||
} | ||
|
||
with mock.patch("t4_lambda_pkgpush.invoke_copy_lambda", return_value=VERSION_ID) as invoke_copy_lambda_mock: | ||
with mock.patch("t4_lambda_pkgpush.AWSCredentials.from_boto_session", return_value=CREDENTIALS): | ||
# Check results has the same order as in supplied list. | ||
assert t4_lambda_pkgpush.copy_file_list([(e["src"], e["dst"], e["size"]) for e in ENTRIES.values()]) == [ | ||
e["result"] for e in ENTRIES.values() | ||
] | ||
# Check that larger files are processed first. | ||
assert invoke_copy_lambda_mock.call_args_list == [ | ||
mock.call( | ||
CREDENTIALS, | ||
e["src"], | ||
e["dst"], | ||
) | ||
for e in map(ENTRIES.__getitem__, ["b", "a", "c"]) | ||
] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.