Ministack: Free, open-source local AWS emulator - 60+ services, Terraform compatible, real databases. Free forever. MIT licensed.
Python awsaws-emulatoraws-localaws-sdkdevtoolsdockerdynamodbec2emulatorlambdalocalstacklocalstack-alternativeministackmock-awsopen-sourcepythons3sqsterraform
fix(iot): fix flaky test (#1412)
Nahuel Nuceradbe792d2c21f
diff --git a/tests/conftest.py b/tests/conftest.pyindex 33817023..40c17660 100644--- a/tests/conftest.py+++ b/tests/conftest.py@@ -155,6 +155,23 @@ _SERIAL_TESTS = {# parallel worker calling GetRegistrationCode either side of the delete sees# the code change under it. Same account-global mutation class as above."tests/test_iot.py::test_iot_registration_code_stable_until_deleted",+ # IoT topic-rule Lambda-action tests: each creates one Lambda per test,+ # cold-starts its container, and polls an SQS sink under a bounded timeout.+ # Same cold-start-burst-under-xdist shape as the apigw Lambda tests above —+ # they pass serially (~3.5s each) but the tail ones lose the cold start+ # against _poll_sink's 12s window on the shared CI runner. Surfaced when the+ # device-shadow work lengthened the test_iot_data.py shard; the tests+ # themselves are correct, so run them in the serial phase.+ "tests/test_iot_data.py::test_iot_topic_rule_routes_publish_to_lambda",+ "tests/test_iot_data.py::test_iot_basic_ingest_routes_to_lambda",+ "tests/test_iot_data.py::test_iot_disabled_rule_does_not_fire",+ "tests/test_iot_data.py::test_iot_rule_encode_base64_projection_basic_ingest",+ "tests/test_iot_data.py::test_iot_rule_encode_base64_projection_topic_filter",+ "tests/test_iot_data.py::test_iot_rule_attribute_projection",+ "tests/test_iot_data.py::test_iot_rule_where_clause_gates_dispatch",+ "tests/test_iot_data.py::test_iot_rule_where_topic_function_under_basic_ingest",+ "tests/test_iot_data.py::test_iot_rule_where_or_clause_dispatches_either_branch",+ "tests/test_iot_data.py::test_iot_jitr_registration_event_drives_a_topic_rule",}diff --git a/tests/test_iot.py b/tests/test_iot.pyindex 70915dac..67d68358 100644--- a/tests/test_iot.py+++ b/tests/test_iot.py@@ -4542,6 +4542,7 @@ def test_iot_jitr_registered_event_published_when_auto_registration_enabled():assert status == 200assert (json.loads(body)["certificateDescription"]["caCertificateId"] == ca_id+ )# ----------------------------------------------------------------------@@ -4733,12 +4734,13 @@ def test_iot_jitr_no_event_when_auto_registration_disabled():)assert (json.loads(body)["certificateDescription"]["caCertificateId"] == ca_id- assert len(frames["$aws/things/dev2/shadow/update/accepted"]) == 1- assert "$aws/things/dev2/shadow/update/delta" not in frames- assert len(frames["$aws/things/dev2/shadow/update/documents"]) == 1+ )++ try:+ asyncio.run(_run())finally:- iot_module._shadows.clear()- reset()+ iot_module.reset()+ iot_module.broker_reset()def test_shadow_mqtt_update_rejections():@@ -5152,6 +5154,9 @@ def test_iot_update_ca_certificate_rejects_invalid_enum_values(iot_client):assert "clientToken" not in rejected[0]assert rejected[1]["code"] == 409assert rejected[1]["clientToken"] == "t9"++ try:+ asyncio.run(_run())finally:iot_module._shadows.clear()reset()