Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix wrong use of super for exact-timestamps sync #964

Merged
merged 2 commits into from
Oct 23, 2014
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions CHANGELOG.rst
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,8 @@ CHANGELOG
Next Release (TBD)
==================

* bugfix:``aws s3 sync``: Fix issue when uploading with ``--exact-timestamps``
(`issue 964 <https://github.com/aws/aws-cli/pull/964>`__)
* bugfix:Retry: Fix issue where certain error codes were not being retried
(`botocore issue 361 <https://github.com/boto/botocore/pull/361>`__)
* bugfix:``aws emr ssh``: Fix issue when using waiter interface to
Expand Down
4 changes: 2 additions & 2 deletions awscli/customizations/s3/syncstrategy/exacttimestamps.py
Original file line number Diff line number Diff line change
Expand Up @@ -50,5 +50,5 @@ def compare_time(self, src_file, dest_file):
if cmd == 'download':
return self.total_seconds(delta) == 0
else:
return super(SizeOnlySyncStrategy, self).compare_time(src_file,
dest_file)
return super(ExactTimestampsSync, self).compare_time(src_file,
dest_file)
23 changes: 23 additions & 0 deletions tests/unit/customizations/s3/syncstrategy/test_exacttimestamps.py
Original file line number Diff line number Diff line change
Expand Up @@ -113,6 +113,29 @@ def test_compare_exact_timestamps_same_age_diff_size(self):
src_file, dst_file)
self.assertTrue(should_sync)

def test_compare_exact_timestamps_diff_age_not_download(self):
"""
Confirm that same sized files are synced when the timestamps differ,
the type of operation is not a download, and ``exact_timestamps``
is set.
"""
time_src = datetime.datetime.now()
time_dst = time_src - datetime.timedelta(days=1)

src_file = FileStat(src='', dest='',
compare_key='test.py', size=10,
last_update=time_src, src_type='s3',
dest_type='local', operation_name='upload')

dst_file = FileStat(src='', dest='',
compare_key='test.py', size=10,
last_update=time_dst, src_type='local',
dest_type='s3', operation_name='')

should_sync = self.sync_strategy.determine_should_sync(
src_file, dst_file)
self.assertTrue(should_sync)


if __name__ == "__main__":
unittest.main()