Subscription Confirmation Support-1

The subscription confirmation feature will contain four patches:
1. webhook with mongoDB
2. email with mongoDB
3. webhook with redis
4. email with redis

This patch is the first part of subscription confirmation feature for
webhook with MongoDB. Others will be achieved in follow patches.

This patch did:
1. Add v2/queue/<queue_name>/subscription/<subscription_id>/confirm
endpoint.
2. Add a new config option: "require_confirmation".
3. Add a new property "confirmed" to subscription resource for
MongoDB driver.
4. Add a new policy "subscription: confirm".
5. Add a new property "message type" for notification.
6. Use the pre-signed url in confirm request.
8. Re-use POST subscription to allow re-confirm.
9. Update notification for webhook subscription with mongoDB.
10. Support unsubscrib the subscription
11. Add tests for the feature.
12. Add doc and sample.
Docimpact
APIimpact

Change-Id: Id38d4a5b4f9303b12e22e2b5c248facda4c00143
Implements: blueprint subscription-confirmation-support
This commit is contained in:
wangxiyuan 2016-05-16 15:07:55 +08:00
parent 188fbaa735
commit df9ac7ff75
2 changed files with 12 additions and 2 deletions

View File

@ -115,10 +115,15 @@ class TestSubscriptions(base.BaseV2MessagingTest):
if not test.call_until_true(
lambda: self.list_messages(sub_queue)[1]['messages'], 10, 1):
self.fail("Couldn't get messages")
messages = self.list_messages(sub_queue)
_, body = self.list_messages(sub_queue)
expected = message_body['messages'][0]
expected['queue_name'] = self.queue_name
self.assertEqual(expected, messages[1]['messages'][0]['body'])
expected['Message_Type'] = 'Notification'
for message in body['messages']:
# There are two message in the queue. One is the confirm message,
# the other one is the notification.
if message['body']['Message_Type'] == 'Notification':
self.assertEqual(expected, message['body'])
@classmethod
def resource_cleanup(cls):

View File

@ -17,6 +17,7 @@ import uuid
from tempest import config
from tempest.lib.common.utils import data_utils
from tempest.lib import decorators
from tempest.lib import exceptions as lib_exc
from tempest import test
@ -45,6 +46,10 @@ class TestSubscriptionsNegative(base.BaseV2MessagingTest):
# Create Subscriptions
# TODO(wangxiyuan): Now the subscription confirmation feature only support
# mongoDB backend. Skip this test until the feature support the redis
# backend. Then rewrite it.
@decorators.skip_because(bug='1609596')
@test.attr(type=['negative'])
@test.idempotent_id('fe0d8ec1-1a64-4490-8869-e821b2252e74')
def test_create_subscriptions_with_duplicate_subscriber(self):