Add a trust notifier task
This adds the ability to send keystone authentified notifications using trusts. To do so, you specify the posted URL with the "trust+" prefix, and Zaqar will create and store a trust when subscribing to a queue, if the trust not provided in the subscription options It also add a capability to the webhook task to be able to send more structured data in the notification, allowing to include the Zaqar message in the data. blueprint mistral-notifications DocImpact Change-Id: I12b9c1b34cdd220fcf1bdc2720043d4a8f75dc85
This commit is contained in:
parent
971c5a2e7a
commit
c6df105245
@ -130,7 +130,7 @@ message_ttl = {
|
||||
list_messages_links = {
|
||||
'type': 'array',
|
||||
'maxItems': 1,
|
||||
'minItems': 1,
|
||||
'minItems': 0,
|
||||
'items': {
|
||||
'type': 'object',
|
||||
'properties': {
|
||||
@ -143,7 +143,7 @@ list_messages_links = {
|
||||
|
||||
list_messages_response = {
|
||||
'type': 'array',
|
||||
'minItems': 1,
|
||||
'minItems': 0,
|
||||
'items': {
|
||||
'type': 'object',
|
||||
'properties': {
|
||||
|
@ -13,9 +13,12 @@
|
||||
# See the License for the specific language governing permissions and
|
||||
# limitations under the License.
|
||||
|
||||
import json
|
||||
import uuid
|
||||
|
||||
from tempest.common.utils import data_utils
|
||||
from tempest.lib import decorators
|
||||
from tempest import test
|
||||
|
||||
from zaqar.tests.tempest_plugin.tests import base
|
||||
|
||||
@ -91,6 +94,32 @@ class TestSubscriptions(base.BaseV2MessagingTest):
|
||||
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')
|
||||
self.addCleanup(self.client.delete_queue, sub_queue)
|
||||
subscriber = 'trust+{0}/{1}/queues/{2}/messages'.format(
|
||||
self.client.base_url, self.client.uri_prefix, sub_queue)
|
||||
post_body = json.dumps(
|
||||
{'messages': [{'body': '$zaqar_message$', 'ttl': 60}]})
|
||||
post_headers = {'X-Project-ID': self.client.tenant_id,
|
||||
'Client-ID': str(uuid.uuid4())}
|
||||
sub_body = {'ttl': 1200, 'subscriber': subscriber,
|
||||
'options': {'post_data': post_body,
|
||||
'post_headers': post_headers}}
|
||||
|
||||
self.create_subscription(queue_name=self.queue_name, rbody=sub_body)
|
||||
message_body = self.generate_message_body()
|
||||
self.post_messages(queue_name=self.queue_name, rbody=message_body)
|
||||
|
||||
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)
|
||||
expected = message_body['messages'][0]
|
||||
expected['queue_name'] = self.queue_name
|
||||
self.assertEqual(expected, messages[1]['messages'][0]['body'])
|
||||
|
||||
@classmethod
|
||||
def resource_cleanup(cls):
|
||||
cls.delete_queue(cls.queue_name)
|
||||
|
Loading…
Reference in New Issue
Block a user