Commit Graph

174 Commits

Author SHA1 Message Date
irahulranjan
7b97141184
fix Fifo queue delivers duplicate message(s) (#3538)
* fix https://github.com/localstack/localstack/issues/3339

* fixe lint issues

* Fix review comments
- move deduplication time to constants
- make tests parameterized
- update tests as per review comments

* change variable name expectedCount => expected_count

* fix tests for python 2.7
increase deduplication mock config to account for delays

* ignore time mocking test in server mode
2020-12-13 14:39:10 +00:00
Bert Blommers
273ca63d59 Linting 2020-11-11 15:55:37 +00:00
Bert Blommers
cb6731f340 Convert fixtures/exceptions to Pytest 2020-11-11 15:54:01 +00:00
Matěj Cepl
6d364dc7aa Pytest model of exceptions uses 'value' attribute instead of 'exception'. 2020-11-11 12:21:04 +01:00
Matěj Cepl
5697ff87a8 Back to Black 2020-11-10 14:12:38 +01:00
Matěj Cepl
ea489bce6c Finish porting from nose to pytest. 2020-11-10 08:25:05 +01:00
Matěj Cepl
77dc60ea97 Port test suite from nose to pytest.
This just eliminates all errors on the tests collection. Elimination of
failures is left to the next commit.
2020-11-10 08:23:44 +01:00
Artem
53cc3dd67a
Fix SQS md5 attribute hashing. (#3403)
* Fix sqs md5 attribute hashing.

* Fix test name.

* Fix format.
2020-10-27 12:13:47 +00:00
usmangani1
fcc85a9645
Including Message attributes when ALL is passed (#3393)
* Including Message attributes when ALL is passes

* Added tests

Co-authored-by: usmankb <usman@krazybee.com>
2020-10-19 09:04:38 +01:00
Brian Pandola
a2bd4515eb
Add better support for SQS MaximumMessageSize attribute (#3374)
Closes #3205
2020-10-10 17:54:36 +01:00
usmangani1
a65c0f004c
Fix:SQS Receive Message (MessageAttributes) in response (#3303)
* Fix:SQS Receive Message (MessageAttributes) in response

* Fixed tests

Co-authored-by: usmankb <usman@krazybee.com>
2020-10-05 10:10:24 +01:00
usmangani1
f9ce99f0d1
Fix:SQS md5 calculation for custom string data type. (#3346)
* Fix:SQS md5 calculation for custom string data type.

* Linting

Co-authored-by: Bert Blommers <info@bertblommers.nl>
2020-09-30 18:40:00 +01:00
usmangani1
1c3ba83fc2
Fix : SQS Create Queue with attributes (#3345)
* Considering only new attributes while queue creation

* Linting

Co-authored-by: usmankb <usman@krazybee.com>
Co-authored-by: Bert Blommers <info@bertblommers.nl>
2020-09-30 16:34:15 +01:00
Bert Blommers
0ab21f62a8 Linting 2020-09-13 19:42:38 +01:00
Bert Blommers
db1d7123f6 List dependencies for services - add integration test to verify 2020-09-13 16:08:23 +01:00
usmangani1
3ea46617d9
Fix:sqs get-queue-attributes response template (#3255)
* Fix:sqs get-queue-attributes response template

* Fix:removed debug statements

* Modified the template

* "fixed build issues"

* Linting

Co-authored-by: usmankb <usman@krazybee.com>
Co-authored-by: Bert Blommers <info@bertblommers.nl>
2020-09-01 18:05:25 +01:00
usmangani1
0a89f9d1df
Fix:SQS:Added Non existent queue name in ERROR RESPONSE (#3261)
* Fix:SQS:Added Non existent queue name in ERROR RESPONSE

* Linting

Co-authored-by: Bert Blommers <info@bertblommers.nl>
2020-08-27 17:31:20 +01:00
Yuuki Takahashi
99736c3101
fix clear pending messages when call purge_queue (#3208) 2020-08-03 15:09:25 +01:00
Waldemar Hummer
08a08b6af8
Fix SQS tag list from CloudFormation resource creation (#3197)
* fix sqs tag list from cloudformation resource creation

the method `create_from_cloudformation_json` of the Sqs resource
does not handle the difference of format of the Tags field in the
resource template and the format expected in Sqs resource class.

In cfn resource template Tags is specified as a list of dicts. But
the Sqs resource expects that the tags field be a single dict.
This behaviour causes a crash when a queue is created with tags
from `create_from_cloudformation_json` and later the list_queue_tags
is called because it tries to call `items` from `queue.tags` but
tags is actually a list of dicts.

* fix comment

* fix linter

* minor

Co-authored-by: Hudo Assenco <hudo.assenco@gmail.com>
2020-07-29 11:44:02 +01:00
Ninh Khong
97139d4253
Fix : SQS - Added support for attribute labels for send_message function (#3181)
* Fix : SQS - Added support for attribute labels for send_message function

* Add integration test on receive message function

* Add send message invalid datetype integration test and fix SQS MessageAttributesInvalid exceptions
2020-07-28 14:34:26 +01:00
ryanlchandler
bf8eb11dc3
Adding MessageGroupId and MessageDeduplicationId (#3163)
Adding MessageGroupId and MessageDeduplicationId when sent from batch (#3101)
2020-07-22 13:09:12 +01:00
Bert Blommers
1ef3094e45 SQS - Return multiple group-messages in the same request 2020-05-24 12:12:35 +01:00
Kevin Neal
52cbdd72e7 update SQS MaximumMessageSize from 64K to 256K 2020-05-02 16:40:52 -07:00
usmankb
1431348161 Fix SQS send_message_batch empty array Exception handling 2020-05-02 01:33:58 +05:30
jmsanders
0b7e990bbf Limit SQS list_queues response to 1000 queues
The maximum number of queues that the ListQueues API can return is 1000:

https://docs.aws.amazon.com/AWSSimpleQueueService/latest/APIReference/API_ListQueues.html
2020-02-07 15:54:42 -06:00
gruebel
44024ab74b Fix sqs permission handling & add more error handling 2020-01-30 22:42:27 +01:00
Asher Foa
b4127040d1 remove this change. 2020-01-23 10:16:12 -08:00
Asher Foa
d9d055c75d Fix more typos. 2020-01-23 10:15:02 -08:00
Steve Pulec
a32b3c4b59 Fix SQS get_queue_attributes to allow RedrivePolicy. Closes #2682. 2020-01-22 19:38:07 -06:00
Fabio Dias
743dd46399 black linting 2019-12-16 21:25:20 -05:00
Fabio Dias
fd9ac4b9a5 ACCOUNT_ID moved to moto.core, MOTO_ACCOUNT_ID env var override 2019-12-16 21:05:29 -05:00
Fabio Dias
bc615797b1 typo 2019-12-16 19:56:11 -05:00
Fabio Dias
b83a750630 Added references to moto.iam.models.ACCOUNT_ID instead of hardcoded id 2019-12-16 19:56:11 -05:00
Bjorn Olsen
97c20dd11d Added AWS DataSync mocks and tests 2019-11-04 17:41:46 +02:00
Bjorn Olsen
9c00f572d6 First working tests! 2019-11-01 19:24:21 +02:00
Asher Foa
96e5b1993d Run black on moto & test directories. 2019-10-31 10:36:05 -07:00
gruebel
c5059ad3d1 Fix test server error 2019-10-28 17:21:01 +01:00
gruebel
51117c948a Add error handling to sqs.delete_message 2019-10-27 12:46:59 +01:00
gruebel
c3cb411c07 Refactor sqs.get_queue_attributes & add AttributeNames handling 2019-10-27 12:13:33 +01:00
gruebel
6573f69087 Refactor sqs.get_queue_url 2019-10-26 22:26:48 +02:00
gruebel
23978e644f Refactor sqs.send_message_batch 2019-10-26 22:08:45 +02:00
gruebel
19a34ea57a Add error handling for sqs.list_queue_tags 2019-10-17 22:38:16 +02:00
gruebel
dbfb319def Add error handling for sqs.tag_queue 2019-10-17 22:36:37 +02:00
gruebel
65c5502a62 Add error handling for sqs.send_message_batch 2019-10-17 22:09:14 +02:00
gruebel
ce3f1eed66 fix test server error 2019-10-13 20:32:53 +02:00
gruebel
49045fe680 Add tags parameter to sqs.create_queue 2019-10-13 14:51:31 +02:00
gruebel
9ac20ad5f1 store SQS RedrivePolicy maxReceiveCount value as int 2019-08-31 19:28:09 +02:00
Robert Lewis
acdb1c9768 Add requestid checking for sqs 2019-01-20 22:54:05 -08:00
Steve Pulec
0ab07bc482
Merge pull request #1763 from nate/fix/receive_message_wait_time_seconds
Force receive_message_wait_time_seconds to be int
2018-09-22 16:49:24 -04:00
Nathan Sutton
8393c7f20b Don't error on double create queue with same attrs
Creating a queue a second time with the same attributes should not raise
an error. This change makes it work correctly.
2018-08-08 21:10:13 -05:00
Nathan Sutton
9d1c665310 Force receive_message_wait_time_seconds to be int
When a queue is created with the ReceiveMessageWaitTimeSeconds
attribute the value is never converted to an integer. When the
ReceiveMessage action is called it tries to compare the string
ReceiveMessageWaitTimeSeconds with the min and max wait times which
raises a TypeError.

The solution is to convert this value to an integer before comparing.
2018-08-08 19:14:56 -05:00
Steve Pulec
1689a2808f Fix creating SQS queue with same attributes. Closes #1663. 2018-05-31 23:05:50 -04:00
Daniel Birnstiel
9b8e62e1f1 Add MessageGroupId support to SQS queues (fixes #1655) 2018-05-30 15:29:57 +02:00
Iain Bullard
fad4394474 SQS add missing validation to ReceiveMessage (#1595)
* SQS receive_message - enforce bounds on MaxNumberOfMessages as AWS does

* SQS receive_message - enforce bounds on WaitTimeSeconds as AWS does
2018-04-24 09:51:49 -07:00
Darien Hager
6332ed9df9 Add test that certain FIFO-queue attributes flow through from sender to receiver 2018-04-19 00:16:03 -07:00
Iain Bullard
6dce7dcb18 Improve SQS Compatibility with AWS (#1520)
* Return correct error code when fetching a queue that does not exist

* Improve SQS Queue get and set attributes

* Queue creation and set_attributes uses the same code path
    - ensure bool/int values are cast correctly
* RedrivePolicy is handled properly with set_attributes
    - _setup_dlq is called
    - is json decoded, so that returned RedrivePolicy is not json
      encoded twice
* As per AWS not all attributes are returned when they are not set, for
  example RedrivePolicy, FifoQueue, Policy, Kms*
* WaitTimeSeconds is not a queue attribute switch to
  ReceiveMessageWaitTimeSeconds
2018-03-21 08:48:08 -07:00
Dan W Anderson
616095602a test for redrive policy 2018-01-23 18:33:23 -08:00
Terry Cain
e2bdaa07ea Fix test cases that manipulate time 2017-10-29 19:11:52 +00:00
Terry Cain
75f0deb828 Completed SQS Implementation 2017-10-29 18:59:40 +00:00
Jack Danger
dc40fce146 implement SQS QueueDoesNotExist error 2017-10-10 13:05:48 -07:00
Terry Cain
a91c025398
Cleanup, and fix #1105 2017-09-22 20:08:20 +01:00
Waldemar Hummer
ce2f3e6e2b fix receiving of messages from queues with a dot character in their name 2017-08-05 15:47:40 +10:00
Ferran Puig
e4f42d5880 Don't use exponential notation for SQS message timestamps 2017-07-03 16:17:01 +02:00
Luis Jimenez
898031b40c SQSResponse: include MD5OfMessageAttributes parameter only when there are message attributes 2017-06-29 09:27:31 -04:00
brett55
7033d142a0 - Bug fix for infinite loop when WaitTimeSeconds was set to 0
- Added 2 unit tests
2017-06-01 09:51:33 -06:00
Jack Danger
bdecd26397 Merge pull request #919 from JackDanger/md5-of-sqs-messages
MD5 calculation of SQS message attributes
2017-05-22 18:23:51 -07:00
Jack Danger Canty
6679def702 Python 2/3 compat for MD5 of SQS attributes 2017-05-22 18:11:59 -07:00
Jack Danger Canty
daba699147 binary values are sent as base64-encoded strings 2017-05-22 18:11:59 -07:00
Jack Danger Canty
5e88b5d1b4 MD5 calculation of SQS message attributes
This implements the same MD5 hashing pattern as implemented in the Ruby
and Java AWS SDKs

Doesn't yet handle list types but if you're reading this you might be
surprised how easy that is to add. Give it a shot and if you get stuck
reach out to me for help.
2017-05-22 18:11:59 -07:00
Jack Danger Canty
aad1e17787 Shorter sleeps in SQS test
One of these tests actually waited the entire 60 seconds of the
visibility timeout but that value appears to have been copied
from a previous test that didn't. Updating all tests with shorter
timeouts so folks who copy setup code in the future don't fall
into this trap
2017-05-15 15:06:28 -07:00
Kate Heddleston
992b475093 testing create, get, list, delete policy versions 2017-05-15 14:56:30 -07:00
Steve Pulec
a0a205328d Cleanup SQS body encoding. Closes #458, #460. 2017-03-19 11:03:55 -04:00
Steve Pulec
cda553abfb Change tests to use default server port of 5000. 2017-03-12 21:04:19 -04:00
Steve Pulec
896f040fca Fix sqs tests for server mode. 2017-03-05 10:09:19 -05:00
Steve Pulec
3b4ef2cf15 Merge in master. 2017-03-05 09:58:39 -05:00
Chris LaRose
56f9409ca9 Use request URL to generate SQS queue URLs; fixes #626 (#827) 2017-03-04 22:53:14 -05:00
Steve Pulec
f37bad0e00 Lints. 2017-02-23 21:37:43 -05:00
Steve Pulec
81836b6981 Get standalone server mode working for all tests. 2017-02-23 19:43:48 -05:00
Steve Pulec
fe46b4c5b9 Remove extra line in test. 2017-02-20 15:50:49 -05:00
Steve Pulec
fde721bed7 Testing new version of decorator. 2017-02-15 22:35:45 -05:00
Steve Pulec
9076e48fee Fix sqs tests region. 2017-02-11 19:50:26 -05:00
Steve Pulec
2d03182ae2 Migrate some sqs tests to boto3. 2017-02-11 19:41:09 -05:00
Raghavendra Prabhu
34a28b0fd5 Use region from ctor to set queue_arn.
Without this, any region passed to boto3.resource is ignored and unit
tests depending on it break.
2016-08-17 22:12:00 +01:00
Steve Pulec
ececa8009b Merge pull request #665 from macheins/fix-broken-sqs-queue-arn-attribute
Fix broken SQS QueueArn attribute
2016-07-24 09:28:47 -04:00
macheins
b152996ddf Changed unit test to reflect changes 2016-07-19 14:20:33 +02:00
Nuno Santos
8ffd4e51ec Fix retrieving inexistent queue errors when using boto3.
Handle 404 errors when trying to retrieve a SQS queue that does not
exist. Add get_queue and get_inexistent_queue tests for boto3.
2016-07-16 12:09:34 +01:00
Steve Pulec
ea43f41470 Merge pull request #625 from nfvs/fix_whitespace
Strip extra whitespace and newlines from SQS response templates.
2016-06-17 17:51:07 -04:00
Nuno Santos
68eeb5948b Strip extra whitespace and newlines from SQS response templates.
Fixes #623
2016-06-02 12:26:50 +02:00
Matt Long
9b7902018f Respect VisibilityTimeout when calling receive_message
Previously, receive_message would always use the queue's default
visibility timeout instead of the value passed as a query parameter when
calling the receive_message method on an SQS connection.
2016-05-31 15:13:49 -07:00
Scott Leishman
3fd33c03bf boto3 SQS set attributes fix. 2016-02-19 23:32:01 -08:00
Ian Dees
5115e50bd0 The message has to be bigger 2015-11-10 11:39:00 -05:00
Ian Dees
a4e86494e1 Add a test for a message that is too long 2015-11-10 11:24:55 -05:00
Steve Pulec
f72613cc47 Fix queue urls for other regions. Closes #411. 2015-09-19 09:18:16 -04:00
Dustin J. Mitchell
7470a9f68b update test_messages_polling to assume messages are returned immediately 2015-08-31 11:54:17 -04:00
Jot
178d1c3a93 Added support for WaitTimeSeconds in SQS #392 2015-08-13 02:58:14 +02:00
Steve Pulec
519726a70a Cleaning up SQS for boto3. Closes #385. 2015-08-02 09:45:40 -04:00
Steve Pulec
0195e04053 Allow deleting of SQS invisible messages. Closes #352. 2015-05-29 23:26:43 -04:00
Steve Pulec
6b44e41249 Add SQS purge_queue action. Closes #349. 2015-05-29 23:21:14 -04:00
Steve Pulec
aa7233a2db Fixes for multi-region SQS. 2014-11-16 17:57:46 -05:00
Joseph Lawson
832e903f26 test sqs with xml characters 2014-10-22 16:03:42 -04:00