Skip to content

Bug: e2e tests are brittle and fail on python 3.7 #2151

Closed
@rubenfonseca

Description

@rubenfonseca

Expected Behaviour

I except the E2E tests to pass consistently across all runtimes.

Current Behaviour

Example of a failed build: https://github.com/awslabs/aws-lambda-powertools-python/actions/runs/4737304653/jobs/8409947101

Code snippet

The tests/e2e/idempotency/test_idempotency_dynamodb.py E2E tests fails randomly with:

>       assert first_execution_response == second_execution_response
E       assert '[{"state": "FINISHED", "exception": null, "output": {"thread_name": "ThreadPoolExecutor-0_1", "time": "1681855179.1311567"}}, {"state": "FINISHED", "exception": null, "output": {"thread_name": "ThreadPoolExecutor-0_0", "time": "1681855179.[170](https://github.com/awslabs/aws-lambda-powertools-python/actions/runs/4737304653/jobs/8409947391#step:9:171)8796"}}]' == '[{"state": "FINISHED", "exception": null, "output": {"thread_name": "ThreadPoolExecutor-0_0", "time": "1681855179.1708796"}}, {"state": "FINISHED", "exception": null, "output": {"thread_name": "ThreadPoolExecutor-0_1", "time": "1681855179.1311567"}}]'
E         - [{"state": "FINISHED", "exception": null, "output": {"thread_name": "ThreadPoolExecutor-0_0", "time": "1681855179.1708796"}}, {"state": "FINISHED", "exception": null, "output": {"thread_name": "ThreadPoolExecutor-0_1", "time": "1681855179.1311567"}}]

The tests/e2e/streaming/handlers/s3_object_handler.py E2E test fails constantly on python 3.7:

E       assert None == 'hello world'
E        +  where None = <built-in method get of dict object at 0x7f2909dbc2d0>('body')
E        +    where <built-in method get of dict object at 0x7f2909dbc2d0> = {'errorMessage': "Unable to marshal response: b'hello world' is not JSON serializable", 'errorType': 'Runtime.MarshalError', 'stackTrace': []}.get

Possible Solution

  • Fix the problem with python 3.7 by decoding the binary data
  • Fix the brittleness of the idempotency test by disregarding the order of the returned messages

Steps to Reproduce

make e2e-test

AWS Lambda Powertools for Python version

latest

AWS Lambda function runtime

3.7

Packaging format used

PyPi

Debugging logs

No response

Metadata

Metadata

Assignees

Labels

bugSomething isn't workingtests

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions