summaryrefslogtreecommitdiff
path: root/dev-python/moto/files/moto-3.1.1-32bit-time_t.patch
blob: f4ab312f0332707df6c082af5bb1576f5e240f1d (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
From 878ce5bfd58060324fe58cb0a84653c02d895be4 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Micha=C5=82=20G=C3=B3rny?= <mgorny@gentoo.org>
Date: Sun, 20 Mar 2022 10:19:18 +0100
Subject: [PATCH] Fix test failures on systems with 32-bit time_t

Skip tests if OverflowError is raised when boto3 is processing
timestamps.  This is a known limitation of boto3 on 32-bit platforms
(https://github.com/boto/botocore/issues/2355).

Catching OverflowError is the best option here since some 32-bit
platforms (e.g. NetBSD) use 64-bit time_t, and others are working
on providing a switch to the 64-bit type (e.g. glibc).
---
 tests/test_acm/test_acm.py         |  5 ++++-
 tests/test_budgets/test_budgets.py | 14 ++++++++++----
 2 files changed, 14 insertions(+), 5 deletions(-)

diff --git a/tests/test_acm/test_acm.py b/tests/test_acm/test_acm.py
index b48897c1..6594787a 100644
--- a/tests/test_acm/test_acm.py
+++ b/tests/test_acm/test_acm.py
@@ -160,7 +160,10 @@ def test_describe_certificate():
     client = boto3.client("acm", region_name="eu-central-1")
     arn = _import_cert(client)
 
-    resp = client.describe_certificate(CertificateArn=arn)
+    try:
+        resp = client.describe_certificate(CertificateArn=arn)
+    except OverflowError:
+        pytest.skip("This test requires 64-bit time_t")
     resp["Certificate"]["CertificateArn"].should.equal(arn)
     resp["Certificate"]["DomainName"].should.equal(SERVER_COMMON_NAME)
     resp["Certificate"]["Issuer"].should.equal("Moto")
diff --git a/tests/test_budgets/test_budgets.py b/tests/test_budgets/test_budgets.py
index 578a7298..b3de3121 100644
--- a/tests/test_budgets/test_budgets.py
+++ b/tests/test_budgets/test_budgets.py
@@ -22,9 +22,12 @@ def test_create_and_describe_budget_minimal_params():
     )
     resp["ResponseMetadata"]["HTTPStatusCode"].should.equal(200)
 
-    budget = client.describe_budget(AccountId=ACCOUNT_ID, BudgetName="testbudget")[
-        "Budget"
-    ]
+    try:
+        budget = client.describe_budget(AccountId=ACCOUNT_ID, BudgetName="testbudget")[
+            "Budget"
+        ]
+    except OverflowError:
+        pytest.skip("This test requires 64-bit time_t")
     budget.should.have.key("BudgetLimit")
     budget["BudgetLimit"].should.have.key("Amount")
     budget["BudgetLimit"]["Amount"].should.equal("10")
@@ -140,7 +143,10 @@ def test_create_and_describe_all_budgets():
         },
     )
 
-    res = client.describe_budgets(AccountId=ACCOUNT_ID)
+    try:
+        res = client.describe_budgets(AccountId=ACCOUNT_ID)
+    except OverflowError:
+        pytest.skip("This test requires 64-bit time_t")
     res["Budgets"].should.have.length_of(1)
 
 
-- 
2.35.1