danielfm / pybreaker

Python implementation of the Circuit Breaker pattern.
BSD 3-Clause "New" or "Revised" License
508 stars 74 forks source link

Added support to redis cluster storage, without transaction on opened… #56

Closed felipeagger closed 2 years ago

felipeagger commented 3 years ago

Added support to redis cluster storage, without redis.transaction (because it is not supported by cluster mode) on opened_at.setter

new storage class CircuitRedisClusterStorage.

felipeagger commented 2 years ago

TestCase Done! CircuitBreakerRedisTestCase.test_cluster_mode

danielfm commented 2 years ago

Thanks. The test here is failing in my env (Python 3.10.2), could you take a look?

======================================================================
FAIL: test_cluster_mode (tests.CircuitBreakerRedisTestCase)
----------------------------------------------------------------------
Traceback (most recent call last):
  File "/home/danielfm/Projects/personal/active/pybreaker/src/tests.py", line 741, in test_cluster_mode
    self.assertEqual(storage.opened_at, now)
AssertionError: datetime.datetime(2022, 3, 2, 17, 37, 25) != datetime.datetime(2022, 3, 2, 17, 37, 25, 863723)

----------------------------------------------------------------------
Ran 71 tests in 7.099s

FAILED (failures=1)
Test failed: <unittest.runner.TextTestResult run=71 errors=0 failures=1>
error: Test failed: <unittest.runner.TextTestResult run=71 errors=0 failures=1>
felipeagger commented 2 years ago

Thanks. The test here is failing in my env (Python 3.10.2), could you take a look?

======================================================================
FAIL: test_cluster_mode (tests.CircuitBreakerRedisTestCase)
----------------------------------------------------------------------
Traceback (most recent call last):
  File "/home/danielfm/Projects/personal/active/pybreaker/src/tests.py", line 741, in test_cluster_mode
    self.assertEqual(storage.opened_at, now)
AssertionError: datetime.datetime(2022, 3, 2, 17, 37, 25) != datetime.datetime(2022, 3, 2, 17, 37, 25, 863723)

----------------------------------------------------------------------
Ran 71 tests in 7.099s

FAILED (failures=1)
Test failed: <unittest.runner.TextTestResult run=71 errors=0 failures=1>
error: Test failed: <unittest.runner.TextTestResult run=71 errors=0 failures=1>

Adjusted!

=================================================== test session starts ===================================================================================================================================================
platform linux -- Python 3.10.2, pytest-7.0.1, pluggy-1.0.0
rootdir: /.../pybreaker
collected 71 items                                                                                                                                                                                                                                                                                                        

src/tests.py .......................................................................                                                                                                                                                                                                                                [100%]

============================================ 71 passed, 140 warnings in 7.02s =============================================================================================================================================
danielfm commented 2 years ago

Thanks.