Page Menu
Home
Software Heritage
Search
Configure Global Search
Log In
Files
F7066468
D5085.id18152.diff
No One
Temporary
Actions
View File
Edit File
Delete File
View Transforms
Subscribe
Mute Notifications
Award Token
Flag For Later
Size
1 KB
Subscribers
None
D5085.id18152.diff
View Options
diff --git a/swh/storage/tests/test_replay.py b/swh/storage/tests/test_replay.py
--- a/swh/storage/tests/test_replay.py
+++ b/swh/storage/tests/test_replay.py
@@ -269,8 +269,9 @@
]
+@pytest.mark.parametrize("privileged", [True, False])
def test_storage_play_anonymized(
- kafka_prefix: str, kafka_consumer_group: str, kafka_server: str
+ kafka_prefix: str, kafka_consumer_group: str, kafka_server: str, privileged: bool,
):
"""Optimal replayer scenario.
@@ -278,6 +279,7 @@
- writes objects to the topic
- replayer consumes objects from the topic and replay them
+ This tests the behavior with both a privileged and non-privileged replayer
"""
writer_config = {
"cls": "kafka",
@@ -307,30 +309,15 @@
group_id=kafka_consumer_group,
prefix=kafka_prefix,
stop_after_objects=nb_sent,
- privileged=False,
+ privileged=privileged,
)
worker_fn = functools.partial(process_replay_objects, storage=dst_storage)
nb_inserted = replayer.process(worker_fn)
replayer.consumer.commit()
- assert nb_sent == nb_inserted
- check_replayed(storage, dst_storage, expected_anonymized=True)
-
- # Fill a destination storage from Kafka **with stock (non-anonymized) topics**
- dst_storage = get_storage(cls="memory")
- replayer = JournalClient(
- brokers=kafka_server,
- group_id=f"{kafka_consumer_group}-2",
- prefix=kafka_prefix,
- stop_after_objects=nb_sent,
- privileged=True,
- )
- worker_fn = functools.partial(process_replay_objects, storage=dst_storage)
- nb_inserted = replayer.process(worker_fn)
- replayer.consumer.commit()
assert nb_sent == nb_inserted
- check_replayed(storage, dst_storage, expected_anonymized=False)
+ check_replayed(storage, dst_storage, expected_anonymized=not privileged)
def check_replayed(src, dst, expected_anonymized=False):
File Metadata
Details
Attached
Mime Type
text/plain
Expires
Nov 5 2024, 11:08 AM (11 w, 19 h ago)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
3227832
Attached To
D5085: Switch anonymized replayer test to use pytest parametrization
Event Timeline
Log In to Comment