Skip to content

Commit 764e496

Browse files
authored
Merge pull request #340 from reef-technologies/monitoring-enctyption-mode
Replace ReplicationScanResult.source_has_sse_c_enabled -> source_encryption_mode
2 parents ce7e38c + b6b6395 commit 764e496

File tree

3 files changed

+20
-9
lines changed

3 files changed

+20
-9
lines changed

CHANGELOG.md

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,9 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
66

77
## [Unreleased]
88

9+
### Fixed
10+
* Fix: replace `ReplicationScanResult.source_has_sse_c_enabled` with `source_encryption_mode`
11+
912
## [1.17.3] - 2022-07-15
1013

1114
### Fixed

b2sdk/replication/monitoring.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,7 @@ class ReplicationScanResult(AbstractScanResult):
4141
# source attrs
4242
source_replication_status: Optional[ReplicationStatus] = None
4343
source_has_hide_marker: Optional[bool] = None
44-
source_has_sse_c_enabled: Optional[bool] = None
44+
source_encryption_mode: Optional[EncryptionMode] = None
4545
source_has_large_metadata: Optional[bool] = None
4646
source_has_file_retention: Optional[bool] = None
4747
source_has_legal_hold: Optional[bool] = None
@@ -69,8 +69,8 @@ def from_files(
6969
source_file_version.replication_status,
7070
'source_has_hide_marker':
7171
not source_file.is_visible(),
72-
'source_has_sse_c_enabled':
73-
source_file_version.server_side_encryption.mode == EncryptionMode.SSE_C,
72+
'source_encryption_mode':
73+
source_file_version.server_side_encryption.mode,
7474
'source_has_large_metadata':
7575
source_file_version.has_large_header,
7676
'source_has_file_retention':

test/unit/replication/test_monitoring.py

Lines changed: 14 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@
2121
DEFAULT_REPLICATION_RESULT = dict(
2222
source_replication_status=None,
2323
source_has_hide_marker=False,
24-
source_has_sse_c_enabled=False,
24+
source_encryption_mode=EncryptionMode.NONE,
2525
source_has_large_metadata=False,
2626
source_has_file_retention=False,
2727
source_has_legal_hold=False,
@@ -60,7 +60,8 @@ def test_iter_pairs(source_bucket, destination_bucket, test_file, monitor):
6060
def test_scan_source(source_bucket, test_file, monitor):
6161
# upload various types of files to source and get a report
6262
files = [
63-
source_bucket.upload_local_file(test_file, 'folder/test-1.txt'),
63+
source_bucket.upload_local_file(test_file, 'folder/test-1-1.txt'),
64+
source_bucket.upload_local_file(test_file, 'folder/test-1-2.txt'),
6465
source_bucket.upload_local_file(test_file, 'folder/test-2.txt', encryption=SSE_B2_AES),
6566
source_bucket.upload_local_file(test_file,
6667
'not-in-folder.txt'), # monitor should ignore this
@@ -95,14 +96,21 @@ def test_scan_source(source_bucket, test_file, monitor):
9596
assert report.counter_by_status[ReplicationScanResult(
9697
**{
9798
**DEFAULT_REPLICATION_RESULT,
98-
'source_has_sse_c_enabled': True,
99+
'source_encryption_mode': EncryptionMode.SSE_B2,
100+
}
101+
)] == 1
102+
103+
assert report.counter_by_status[ReplicationScanResult(
104+
**{
105+
**DEFAULT_REPLICATION_RESULT,
106+
'source_encryption_mode': EncryptionMode.SSE_C,
99107
}
100108
)] == 2
101109

102110
assert report.counter_by_status[ReplicationScanResult(
103111
**{
104112
**DEFAULT_REPLICATION_RESULT,
105-
'source_has_sse_c_enabled': True,
113+
'source_encryption_mode': EncryptionMode.SSE_C,
106114
'source_has_file_retention': True,
107115
}
108116
)] == 1
@@ -117,7 +125,7 @@ def test_scan_source(source_bucket, test_file, monitor):
117125
assert report.counter_by_status[ReplicationScanResult(
118126
**{
119127
**DEFAULT_REPLICATION_RESULT,
120-
'source_has_sse_c_enabled': True,
128+
'source_encryption_mode': EncryptionMode.SSE_C,
121129
'source_has_large_metadata': True,
122130
}
123131
)] == 1
@@ -187,7 +195,7 @@ def test_scan_source_and_destination(
187195
**DEFAULT_REPLICATION_RESULT,
188196
'source_replication_status': None,
189197
'source_has_hide_marker': None,
190-
'source_has_sse_c_enabled': None,
198+
'source_encryption_mode': None,
191199
'source_has_large_metadata': None,
192200
'source_has_file_retention': None,
193201
'source_has_legal_hold': None,

0 commit comments

Comments
 (0)