Skip to content
This repository was archived by the owner on Mar 23, 2026. It is now read-only.

Commit 3259419

Browse files
committed
harden tests
1 parent aca99bd commit 3259419

3 files changed

Lines changed: 13 additions & 9 deletions

File tree

tests/aws/services/sns/test_sns.py

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1451,6 +1451,8 @@ def test_creating_subscription(self, sns_create_topic, aws_client, snapshot):
14511451
resp = aws_client.sns.subscribe(
14521452
TopicArn=topic_arn, Protocol="http", Endpoint="http://example.com/"
14531453
)
1454+
# TODO: investigate why it leaves the subscription in `SNS.ListSubscriptions`, we maybe need to clean up
1455+
# after deleting topics, not fully in parity as AWS cleans up instantly
14541456
snapshot.match("create-subscription", resp)
14551457

14561458
# TODO: parametrize for email protocol
@@ -4017,6 +4019,7 @@ def test_delete_platform_endpoint_with_subscription(
40174019

40184020
app_name = f"platform-application-{short_uid()}"
40194021
snapshot.add_transformer(RegexTransformer(app_name, "<platform_application>"))
4022+
snapshot.add_transformer(snapshot.transform.key_value("NextToken"))
40204023
# if tested against AWS, the fixture needs to contain real credentials
40214024
principal, credential = platform_credentials
40224025
attributes = {"PlatformPrincipal": principal, "PlatformCredential": credential}
@@ -4033,7 +4036,8 @@ def test_delete_platform_endpoint_with_subscription(
40334036
if is_aws_cloud():
40344037
time.sleep(20)
40354038

4036-
response = aws_client.sns.list_subscriptions()
4039+
# we list subscriptions by topic, as some tests are not cleaning up properly
4040+
response = aws_client.sns.list_subscriptions_by_topic(TopicArn=topic_arn)
40374041
snapshot.match("list-subscriptions-pre-delete", response)
40384042

40394043
response = aws_client.sns.delete_endpoint(EndpointArn=endpoint_arn)
@@ -4043,7 +4047,7 @@ def test_delete_platform_endpoint_with_subscription(
40434047
if is_aws_cloud():
40444048
time.sleep(20)
40454049

4046-
response = aws_client.sns.list_subscriptions()
4050+
response = aws_client.sns.list_subscriptions_by_topic(TopicArn=topic_arn)
40474051
snapshot.match("list-subscriptions-post-delete", response)
40484052

40494053
@markers.aws.manual_setup_required

tests/aws/services/sns/test_sns.snapshot.json

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -6460,10 +6460,10 @@
64606460
}
64616461
},
64626462
"tests/aws/services/sns/test_sns.py::TestSNSPlatformEndpointCrud::test_delete_platform_endpoint_with_subscription": {
6463-
"recorded-date": "31-10-2025, 21:27:49",
6463+
"recorded-date": "04-11-2025, 19:18:31",
64646464
"recorded-content": {
64656465
"list-subscriptions-pre-delete": {
6466-
"NextToken": "AAHhOl6T07LJ89hFxXiaWC4QlQUd8UbuziOx37A3XgerhQ==",
6466+
"NextToken": "<next-token:1>",
64676467
"Subscriptions": [
64686468
{
64696469
"Endpoint": "arn:<partition>:sns:<region>:111111111111:endpoint/ADM/<platform_application>/<resource:1>",
@@ -6485,7 +6485,7 @@
64856485
}
64866486
},
64876487
"list-subscriptions-post-delete": {
6488-
"NextToken": "AAHxwWMatFh66c2j/bctn8NEhVsRAwebBzaS6enPfvneEA==",
6488+
"NextToken": "<next-token:2>",
64896489
"Subscriptions": [
64906490
{
64916491
"Endpoint": "arn:<partition>:sns:<region>:111111111111:endpoint/ADM/<platform_application>/<resource:1>",

tests/aws/services/sns/test_sns.validation.json

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -312,12 +312,12 @@
312312
}
313313
},
314314
"tests/aws/services/sns/test_sns.py::TestSNSPlatformEndpointCrud::test_delete_platform_endpoint_with_subscription": {
315-
"last_validated_date": "2025-10-31T21:27:49+00:00",
315+
"last_validated_date": "2025-11-04T19:18:31+00:00",
316316
"durations_in_seconds": {
317317
"setup": 0.01,
318-
"call": 43.6,
319-
"teardown": 1.23,
320-
"total": 44.84
318+
"call": 44.2,
319+
"teardown": 1.07,
320+
"total": 45.28
321321
}
322322
},
323323
"tests/aws/services/sns/test_sns.py::TestSNSPlatformEndpointCrud::test_get_platform_endpoint_attributes": {

0 commit comments

Comments
 (0)