Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

test_sqs sometimes fail. #5230

Closed
cm-iwata opened this issue Jun 15, 2022 · 0 comments · Fixed by #5231
Closed

test_sqs sometimes fail. #5230

cm-iwata opened this issue Jun 15, 2022 · 0 comments · Fixed by #5231

Comments

@cm-iwata
Copy link
Contributor

test_sqs sometimes pass. but, and also sometimes fail like this.
https://github.com/spulec/moto/runs/6861570976?check_suite_focus=true

Here is detail log.
2022-06-13T13:19:42.2405310Z =================================== FAILURES ===================================
2022-06-13T13:19:42.2405769Z ______________ test_change_message_visibility_on_visible_message _______________
2022-06-13T13:19:42.2406124Z
2022-06-13T13:19:42.2406726Z self = <sure.AssertionBuilder object at 0x7fb372262090>, args = ('0',), kw = {}
2022-06-13T13:19:42.2407049Z
2022-06-13T13:19:42.2407223Z     @wraps(func)
2022-06-13T13:19:42.2407559Z     def wrapper(self, *args, **kw):
2022-06-13T13:19:42.2407898Z         try:
2022-06-13T13:19:42.2408236Z >           value = func(self, *args, **kw)
2022-06-13T13:19:42.2408473Z
2022-06-13T13:19:42.2408917Z /opt/hostedtoolcache/Python/3.7.13/x64/lib/python3.7/site-packages/sure/__init__.py:408:
2022-06-13T13:19:42.2409729Z _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
2022-06-13T13:19:42.2409987Z
2022-06-13T13:19:42.2410383Z self = <sure.AssertionBuilder object at 0x7fb372262090>, what = '0'
2022-06-13T13:19:42.2410778Z epsilon = None
2022-06-13T13:19:42.2411002Z
2022-06-13T13:19:42.2411184Z     @assertionmethod
2022-06-13T13:19:42.2411546Z     def equal(self, what, epsilon=None):
2022-06-13T13:19:42.2411959Z         """compares given object ``X``  with an expected ``Y`` object.
2022-06-13T13:19:42.2412338Z
2022-06-13T13:19:42.2412733Z         It primarily assures that the compared objects are absolute equal ``==``.
2022-06-13T13:19:42.2413105Z
2022-06-13T13:19:42.2413432Z         :param what: the expected value
2022-06-13T13:19:42.2414022Z         :param epsilon: a delta to leverage upper-bound floating point permissiveness
2022-06-13T13:19:42.2414435Z         """
2022-06-13T13:19:42.2414722Z
2022-06-13T13:19:42.2415002Z         try:
2022-06-13T13:19:42.2415391Z             comparison = DeepComparison(self.obj, what, epsilon).compare()
2022-06-13T13:19:42.2415794Z             error = False
2022-06-13T13:19:42.2416141Z         except AssertionError as e:
2022-06-13T13:19:42.2416479Z             error = e
2022-06-13T13:19:42.2416807Z             comparison = None
2022-06-13T13:19:42.2417119Z
2022-06-13T13:19:42.2417460Z         if isinstance(comparison, DeepExplanation):
2022-06-13T13:19:42.2417891Z             error = comparison.get_assertion(self.obj, what)
2022-06-13T13:19:42.2418258Z
2022-06-13T13:19:42.2418559Z         if self.negative:
2022-06-13T13:19:42.2418882Z             if error:
2022-06-13T13:19:42.2419200Z                 return True
2022-06-13T13:19:42.2419502Z
2022-06-13T13:19:42.2419861Z             msg = "%s should differ from %s, but is the same thing"
2022-06-13T13:19:42.2420304Z             raise AssertionError(msg % (safe_repr(self.obj), safe_repr(what)))
2022-06-13T13:19:42.2420687Z
2022-06-13T13:19:42.2421001Z         else:
2022-06-13T13:19:42.2421313Z             if not error:
2022-06-13T13:19:42.2421789Z                 return True
2022-06-13T13:19:42.2422140Z >           raise error
2022-06-13T13:19:42.2422718Z
2022-06-13T13:19:42.2423197Z /opt/hostedtoolcache/Python/3.7.13/x64/lib/python3.7/site-packages/sure/__init__.py:729:
2022-06-13T13:19:42.2423673Z _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
2022-06-13T13:19:42.2423673Z _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
2022-06-13T13:19:42.2425058Z
2022-06-13T13:19:42.2425742Z self = <sure.AssertionBuilder object at 0x7fb372262090>, what = '0'
2022-06-13T13:19:42.2426057Z epsilon = None
2022-06-13T13:19:42.2426203Z
2022-06-13T13:19:42.2426292Z     @assertionmethod
2022-06-13T13:19:42.2426566Z     def equal(self, what, epsilon=None):
2022-06-13T13:19:42.2427484Z         """compares given object ``X``  with an expected ``Y`` object.
2022-06-13T13:19:42.2427787Z
2022-06-13T13:19:42.2428106Z         It primarily assures that the compared objects are absolute equal ``==``.
2022-06-13T13:19:42.2428605Z
2022-06-13T13:19:42.2429186Z         :param what: the expected value
2022-06-13T13:19:42.2429749Z         :param epsilon: a delta to leverage upper-bound floating point permissiveness
2022-06-13T13:19:42.2430078Z         """
2022-06-13T13:19:42.2430280Z
2022-06-13T13:19:42.2430462Z         try:
2022-06-13T13:19:42.2430781Z >           comparison = DeepComparison(self.obj, what, epsilon).compare()
2022-06-13T13:19:42.2431010Z
2022-06-13T13:19:42.2431360Z /opt/hostedtoolcache/Python/3.7.13/x64/lib/python3.7/site-packages/sure/__init__.py:710:
2022-06-13T13:19:42.2431732Z _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
2022-06-13T13:19:42.2431909Z
2022-06-13T13:19:42.2432085Z self = <sure.core.DeepComparison object at 0x7fb2f2876810>
2022-06-13T13:19:42.2432304Z
2022-06-13T13:19:42.2432411Z     def compare(self):
2022-06-13T13:19:42.2432665Z         X, Y = self.operands
2022-06-13T13:19:42.2433031Z
2022-06-13T13:19:42.2433268Z         if isinstance(X, _CallList):
2022-06-13T13:19:42.2433524Z             X = list(X)
2022-06-13T13:19:42.2433721Z
2022-06-13T13:19:42.2433950Z         if isinstance(Y, _CallList):
2022-06-13T13:19:42.2434202Z             X = list(Y)
2022-06-13T13:19:42.2434399Z
2022-06-13T13:19:42.2434619Z         c = self.get_context()
2022-06-13T13:19:42.2434917Z         if self.is_complex(X) and type(X) is type(Y):
2022-06-13T13:19:42.2435237Z             return self.compare_complex_stuff(X, Y)
2022-06-13T13:19:42.2435505Z
2022-06-13T13:19:42.2435737Z         def safe_format_repr(string):
2022-06-13T13:19:42.2436156Z             "Escape '{' and '}' in string for use with str.format()"
2022-06-13T13:19:42.2436533Z             if not isinstance(string, (string_types, binary_type)):
2022-06-13T13:19:42.2436840Z                 return string
2022-06-13T13:19:42.2437049Z
2022-06-13T13:19:42.2437285Z             orig_str_type = type(string)
2022-06-13T13:19:42.2440086Z             if isinstance(string, binary_type):
2022-06-13T13:19:42.2440584Z                 safe_repr = string.replace(b'{', b'{{').replace(b'}', b'}}')
2022-06-13T13:19:42.2440880Z             else:
2022-06-13T13:19:42.2441275Z                 safe_repr = string.replace('{', '{{').replace('}', '}}')
2022-06-13T13:19:42.2441551Z
2022-06-13T13:19:42.2441998Z             # NOTE: str.replace() automatically converted the 'string' to 'unicode' in Python 2
2022-06-13T13:19:42.2442374Z             return orig_str_type(safe_repr)
2022-06-13T13:19:42.2442628Z
2022-06-13T13:19:42.2442870Z         # get safe representation for X and Y
2022-06-13T13:19:42.2443216Z         safe_X, safe_Y = safe_format_repr(X), safe_format_repr(Y)
2022-06-13T13:19:42.2443492Z
2022-06-13T13:19:42.2443776Z         # maintaining backwards compatibility between error messages
2022-06-13T13:19:42.2444079Z         kwargs = {}
2022-06-13T13:19:42.2444361Z         if self.is_simple(X) and self.is_simple(Y):
2022-06-13T13:19:42.2444857Z             kwargs['msg_format'] = 'X{{0}} is {0!r} whereas Y{{1}} is {1!r}'.format(safe_X, safe_Y)
2022-06-13T13:19:42.2445204Z         elif type(X) is not type(Y):
2022-06-13T13:19:42.2445662Z             kwargs['msg_format'] = 'X{{0}} is a {0} and Y{{1}} is a {1} instead'.format(
2022-06-13T13:19:42.2446009Z                 type(X).__name__, type(Y).__name__)
2022-06-13T13:19:42.2446305Z         exp = self.compare_generic(X, Y, **kwargs)
2022-06-13T13:19:42.2446563Z
2022-06-13T13:19:42.2446824Z         if isinstance(exp, DeepExplanation):
2022-06-13T13:19:42.2447280Z             original_X, original_Y = c.parent.operands
2022-06-13T13:19:42.2447629Z >           raise exp.as_assertion(original_X, original_Y)
2022-06-13T13:19:42.2447830Z
2022-06-13T13:19:42.2448170Z /opt/hostedtoolcache/Python/3.7.13/x64/lib/python3.7/site-packages/sure/core.py:254:
2022-06-13T13:19:42.2448552Z _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
2022-06-13T13:19:42.2448717Z
2022-06-13T13:19:42.2448945Z self = "X is '1' whereas Y is '0'", X = '1', Y = '0'
2022-06-13T13:19:42.2449168Z
2022-06-13T13:19:42.2449288Z     def as_assertion(self, X, Y):
2022-06-13T13:19:42.2449571Z >       raise self.get_assertion(X, Y)
2022-06-13T13:19:42.2449842Z E       AssertionError: given
2022-06-13T13:19:42.2450129Z E       X = '1'
2022-06-13T13:19:42.2450345Z E           and
2022-06-13T13:19:42.2450589Z E       Y = '0'
2022-06-13T13:19:42.2450905Z E       X is '1' whereas Y is '0'
2022-06-13T13:19:42.2451067Z
2022-06-13T13:19:42.2451437Z /opt/hostedtoolcache/Python/3.7.13/x64/lib/python3.7/site-packages/sure/core.py:57: AssertionError
2022-06-13T13:19:42.2451712Z
2022-06-13T13:19:42.2451901Z During handling of the above exception, another exception occurred:
2022-06-13T13:19:42.2452128Z
2022-06-13T13:19:42.2452200Z     @mock_sqs
2022-06-13T13:19:42.2452495Z     def test_change_message_visibility_on_visible_message():
2022-06-13T13:19:42.2452942Z         sqs = boto3.resource("sqs", region_name="us-east-1")
2022-06-13T13:19:42.2453325Z         queue = sqs.create_queue(
2022-06-13T13:19:42.2453667Z             QueueName=str(uuid4())[0:6], Attributes={"VisibilityTimeout": "1"}
2022-06-13T13:19:42.2453964Z         )
2022-06-13T13:19:42.2454148Z
2022-06-13T13:19:42.2454419Z         queue.send_message(MessageBody="test message")
2022-06-13T13:19:42.2454788Z         messages = queue.receive_messages(MaxNumberOfMessages=1)
2022-06-13T13:19:42.2455145Z         messages.should.have.length_of(1)
2022-06-13T13:19:42.2455393Z
2022-06-13T13:19:42.2455610Z         queue.reload()
2022-06-13T13:19:42.2455961Z >       queue.attributes["ApproximateNumberOfMessages"].should.equal("0")
2022-06-13T13:19:42.2456197Z
2022-06-13T13:19:42.2456316Z tests/test_sqs/test_sqs.py:1646:
2022-06-13T13:19:42.2456610Z _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
2022-06-13T13:19:42.2456781Z
2022-06-13T13:19:42.2457083Z self = <sure.AssertionBuilder object at 0x7fb372262090>, args = ('0',), kw = {}
2022-06-13T13:19:42.2457309Z
2022-06-13T13:19:42.2457401Z     @wraps(func)
2022-06-13T13:19:42.2457643Z     def wrapper(self, *args, **kw):
2022-06-13T13:19:42.2457888Z         try:
2022-06-13T13:19:42.2458139Z             value = func(self, *args, **kw)
2022-06-13T13:19:42.2458411Z         except AssertionError as e:
2022-06-13T13:19:42.2458690Z >           raise AssertionError(e)
2022-06-13T13:19:42.2458966Z E           AssertionError: given
2022-06-13T13:19:42.2459247Z E           X = '1'
2022-06-13T13:19:42.2459470Z E               and
2022-06-13T13:19:42.2459734Z E           Y = '0'
2022-06-13T13:19:42.2460028Z E           X is '1' whereas Y is '0'
2022-06-13T13:19:42.2460194Z
2022-06-13T13:19:42.2460589Z /opt/hostedtoolcache/Python/3.7.13/x64/lib/python3.7/site-packages/sure/__init__.py:410: AssertionError
2022-06-13T13:19:42.2461020Z =============================== warnings summary ===============================

I guess VisibilityTimeout may too short for test case
https://github.com/spulec/moto/blob/9640ec20d125248ac91243591c7db50daabfd135/tests/test_sqs/test_sqs.py#L1638

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant