Subscription Confirmation Support-2

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

This patch did:
1. Add "confirmed" to redis model.
2. Add "confirm" and "get_with_subscriber" function.
3. Update the unit and tempest test.

Change-Id: I4fe2710c314e733c87f2e20a1f4c04a572a89f14
Implements: blueprint subscription-confirmation-support
This commit is contained in:
wangxiyuan 2016-08-09 17:47:56 +08:00
parent 678fcdd36b
commit ab026cdc31
2 changed files with 22 additions and 23 deletions

View File

@ -94,6 +94,28 @@ class TestSubscriptions(base.BaseV2MessagingTest):
subscription_id = result[1]["subscription_id"]
self.delete_subscription(self.queue_name, subscription_id)
@test.idempotent_id('fe0d8ec1-1a64-4490-8869-e821b2252e74')
def test_create_subscriptions_with_duplicate_subscriber(self):
# Adding subscriptions to the queue
results = self._create_subscriptions()
s_id1 = results[0][1]['subscription_id']
# Adding a subscription with duplicate subscriber, it will reconfirm
# the subscription and run well.
rbody = {'subscriber': 'http://fake:8080',
'options': {'MessagingKeyMsg': 'MessagingValueMsg'},
'ttl': 293305}
resp, body = self.create_subscription(self.queue_name, rbody)
s_id2 = body['subscription_id']
self.assertEqual('201', resp['status'])
self.assertEqual(s_id2, s_id1)
# Delete the subscriptions created
for result in results:
subscription_id = result[1]["subscription_id"]
self.delete_subscription(self.queue_name, subscription_id)
@decorators.idempotent_id('ff4344b4-ba78-44c5-9ffc-44e53e484f76')
def test_trust_subscription(self):
sub_queue = data_utils.rand_name('Queues-Test')

View File

@ -17,7 +17,6 @@ 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
@ -44,28 +43,6 @@ class TestSubscriptionsNegative(base.BaseV2MessagingTest):
results.append((resp, body))
return results
# 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):
# Adding a subscription to the queue
results = self._create_subscriptions()
# Adding a duplicate subscriber
rbody = {'subscriber': 'http://fake:8080',
'options': {'MessagingKeyMsg': 'MessagingValueMsg'},
'ttl': 293305}
self.assertRaises(lib_exc.Conflict,
self.create_subscription, self.queue_name, rbody)
# Delete the subscriptions created
for result in results:
subscription_id = result[1]["subscription_id"]
self.delete_subscription(self.queue_name, subscription_id)
@test.attr(type=['negative'])
@test.idempotent_id('0bda2907-a783-4614-af16-23d7a7d53b72')
def test_create_subscriptions_with_invalid_body(self):