Skip to content

Commit d1905c2

Browse files
committed
Merge branch 'master' into dss-params
* master: Revert "Bump httpie from 1.0.2 to 1.0.3 (#2397)" (#2401) Bump httpie from 1.0.2 to 1.0.3 (#2397) Fix flaky test: TestFileApi.test_file_get_checkout . (#2396) Add retries to verification in _test_gs_cache(). (#2372) Added details of notify intervals (#2368)
2 parents f5d0c4d + 4a3416b commit d1905c2

File tree

3 files changed

+20
-10
lines changed

3 files changed

+20
-10
lines changed

daemons/dss-notify-v2/Readme.md

+7-2
Original file line numberDiff line numberDiff line change
@@ -18,8 +18,8 @@ or via SQS queue:
1818
* Lambda-triggered via SQS `dss-notify-v2-{DSS_DEPLOYMENT_STAGE}`
1919

2020
If notification delivery fails, a notification record is made in the queue. Delivery will be attempted once
21-
after 15 minutes, and again every hour for 7 days. Delivery delay and duration is configured via SQS DelaySeconds
22-
and VisibilityTimeout.
21+
after 15 minutes, and again every hour for 7 days. Delivery delay and duration is
22+
configured via SQS attribute DelaySeconds.
2323

2424
Event handlers in the dss-notify-v2 daemon use utility functions in
2525
[dss.events.handlers.notify_v2](../../dss/events/handlers/notify_v2.py).
@@ -66,6 +66,11 @@ of the subscription owner, and the sort key is the subscription uuid. There is o
6666
Subscriptions are accessed via owner for API actions. When notifications are triggered during an object storage event,
6767
subscriptions are fetched from the backend via `scan`.
6868

69+
If notification delivery fails, a notification record is made in the queue.Delivery will be attempted immediately
70+
after failure and at time intervals of one minute, ten minutes, one hour, six hours, and 16 hours
71+
after the first failure. Delivery would then continue for the next 6 days at 24 hour intervals. After day 7, no further notification will be delivered and the subscription will be
72+
removed from the delivery service. The old subscription will remain and the user would need to delete it and create a new subscription in order to receive new notifications.
73+
6974
### Bundle Metadata Document
7075

7176
The bundle metadata document is constructed from json files present in the bundle manifest, and

tests/test_checkout_caching.py

+9-2
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@
44
import sys
55
import unittest
66
import tempfile
7+
import time
78
from google.cloud import storage
89
from unittest import mock
910

@@ -186,8 +187,14 @@ def _test_gs_cache(self, src_data, content_type, checkout_bucket):
186187
# parameters of copy_worker are arbitrary, only passed because required.
187188
event = gscopyclient.implementation.copy_worker(event, spoof_context)
188189
# verify
189-
bucket = client.get_bucket(checkout_bucket)
190-
blob_class = bucket.get_blob(test_dst_key).storage_class
190+
for retry in [1, 1, 1]:
191+
try:
192+
bucket = client.get_bucket(checkout_bucket)
193+
blob_class = bucket.get_blob(test_dst_key).storage_class
194+
except AttributeError:
195+
time.sleep(retry)
196+
else:
197+
break
191198
# cleanup
192199
gs_blobstore.delete(replica.bucket, test_src_key)
193200
gs_blobstore.delete(checkout_bucket, test_dst_key)

tests/test_file.py

+4-6
Original file line numberDiff line numberDiff line change
@@ -704,12 +704,8 @@ def test_checkout():
704704
test_checkout()
705705

706706
with self.subTest(f"{replica}: Initiates checkout and returns 302 immediately for GET on stale checkout file."):
707-
@eventually(30, 1)
708-
def test_creation_date_updated(key, prev_creation_date):
709-
self.assertTrue(prev_creation_date < handle.get_creation_date(replica.checkout_bucket, key))
710-
711707
now = datetime.datetime.now(datetime.timezone.utc)
712-
old_creation_date = handle.get_creation_date(replica.checkout_bucket, file_key)
708+
creation_date = handle.get_creation_date(replica.checkout_bucket, file_key)
713709
creation_date_fn = ("cloud_blobstore.s3.S3BlobStore.get_creation_date"
714710
if replica.name == "aws"
715711
else "cloud_blobstore.gs.GSBlobStore.get_creation_date")
@@ -718,7 +714,9 @@ def test_creation_date_updated(key, prev_creation_date):
718714
blob_ttl_days = int(os.environ['DSS_BLOB_PUBLIC_TTL_DAYS'])
719715
mock_creation_date.return_value = now - datetime.timedelta(days=blob_ttl_days + 1)
720716
self.assertGetResponse(url, requests.codes.found, headers=get_auth_header(), redirect_follow_retries=0)
721-
test_creation_date_updated(file_key, old_creation_date)
717+
self.assertTrue(creation_date > handle.get_creation_date(replica.checkout_bucket, file_key),
718+
f'\ncurr_creation_date: {creation_date}'
719+
f'\nprev_creation_date: {handle.get_creation_date(replica.checkout_bucket)}')
722720

723721
handle.delete(test_bucket, f"files/{file_uuid}.{version}")
724722
handle.delete(replica.checkout_bucket, file_key)

0 commit comments

Comments
 (0)