Unique queue name for testing
@@ -8,6 +8,8 @@ from tomodachi.discovery.aws_sns_registration import AWSSNSRegistration
from tomodachi.protocol.json_base import JsonBase
from tomodachi.transport.aws_sns_sqs import aws_sns_sqs, aws_sns_sqs_publish
+data_uuid = str(uuid.uuid4())
+
@tomodachi.service
class AWSSNSSQSService(object):
@@ -33,7 +35,7 @@ class AWSSNSSQSService(object):
test_topic_metadata_topic = None
test_topic_service_uuid = None
wildcard_topic_data_received = False
- data_uuid = None
+ data_uuid = data_uuid
@aws_sns_sqs('test-topic')
async def test(self, data: Any, metadata: Any, service: Any) -> None:
@@ -42,14 +44,14 @@ class AWSSNSSQSService(object):
self.test_topic_metadata_topic = metadata.get('topic')
self.test_topic_service_uuid = service.get('uuid')
- @aws_sns_sqs('test-topic', queue_name='test-queue')
+ @aws_sns_sqs('test-topic-unique', queue_name='test-queue-'.format(data_uuid))
async def test_specified_queue_name(self, data: Any, metadata: Any, service: Any) -> None:
if data == self.data_uuid:
if self.test_topic_specified_queue_name_data_received:
raise Exception('test_topic_specified_queue_name_data_received already set')
self.test_topic_specified_queue_name_data_received = True
- @aws_sns_sqs('test-topic', queue_name='test-queue')
+ @aws_sns_sqs('test-topic-unique', queue_name='test-queue-'.format(data_uuid))
async def test_specified_queue_name_again(self, data: Any, metadata: Any, service: Any) -> None:
if data == self.data_uuid:
if self.test_topic_specified_queue_name_data_received:
@@ -77,11 +79,7 @@ class AWSSNSSQSService(object):
asyncio.ensure_future(_async())
self.data_uuid = str(uuid.uuid4())
- for _ in range(30):
- if self.test_topic_data_received:
- break
await publish(self.data_uuid, 'test-topic')
- await asyncio.sleep(0.1)
def stop_service(self) -> None:
if not self.closer.done():
