awslabs / aws-crt-python

Python bindings for the AWS Common Runtime
Apache License 2.0
87 stars 42 forks source link

unittest fail on riscv64 device #535

Closed Xunop closed 11 months ago

Xunop commented 11 months ago

Describe the bug

The unittest will fail on riecv64 devices or devices with low performance.

Expected Behavior

Pass all unit tests.

Current Behavior

relevant logs:

======================================================================
FAIL: test_shutdown_complete_singleton (test_io.EventLoopGroupTest.test_shutdown_complete_singleton)
----------------------------------------------------------------------
Traceback (most recent call last):
  File "/build/python-awscrt/src/aws-crt-python/test/test_io.py", line 41, in test_shutdown_complete_singleton
    self.assertTrue(shutdown_event.wait(TIMEOUT))
AssertionError: False is not true

----------------------------------------------------------------------
Ran 292 tests in 156.700s

FAILED (failures=1, errors=1, skipped=152)

Reproduction Steps

pyver=$(python -c "import sys; print('{}{}'.format(*sys.version_info[:2]))")
export PYTHONPATH="$PWD:$PWD/build/lib.linux-$CARCH-cpython-$pyver"
python -m unittest discover test

Possible Solution

Extension of time limits:

diff --git a/test/__init__.py b/test/__init__.py
index 4b2d44e..50d9313 100644
--- a/test/__init__.py
+++ b/test/__init__.py
@@ -14,7 +14,7 @@ from awscrt.io import init_logging, LogLevel
 import unittest
 import sys

-TIMEOUT = 10.0
+TIMEOUT = 30.0

 class NativeResourceTest(unittest.TestCase):
diff --git a/test/test_http_client.py b/test/test_http_client.py
index a9cb459..b9f413a 100644
--- a/test/test_http_client.py
+++ b/test/test_http_client.py
@@ -359,7 +359,7 @@ class TestClient(NativeResourceTest):
         stream.activate()

         # wait for stream to complete (use long timeout, it's a big file)
-        stream_completion_result = stream.completion_future.result(60)
+        stream_completion_result = stream.completion_future.result(80)

         # check result
         self.assertEqual(200, response.status_code)

Additional Information/Context

N/A

aws-crt-python version used

v0.19.18

Python version used

3.11.6

Operating System and version

archlinux riscv64

jmklix commented 11 months ago

I made a PR to update the timeout as you showed above