mirror of
https://github.com/bigchaindb/bigchaindb.git
synced 2024-10-13 13:34:05 +00:00
Merge branch 'fix/1068/break-out-loop-connection'
This commit is contained in:
commit
18533db10a
@ -77,3 +77,5 @@ class RethinkDBConnection(Connection):
|
|||||||
wait_time = 2**i
|
wait_time = 2**i
|
||||||
logging.debug('Error connecting to database, waiting %ss', wait_time)
|
logging.debug('Error connecting to database, waiting %ss', wait_time)
|
||||||
time.sleep(wait_time)
|
time.sleep(wait_time)
|
||||||
|
else:
|
||||||
|
break
|
||||||
|
@ -1,6 +1,7 @@
|
|||||||
import time
|
import time
|
||||||
import multiprocessing as mp
|
import multiprocessing as mp
|
||||||
from threading import Thread
|
from threading import Thread
|
||||||
|
from unittest.mock import patch
|
||||||
|
|
||||||
import pytest
|
import pytest
|
||||||
import rethinkdb as r
|
import rethinkdb as r
|
||||||
@ -118,3 +119,15 @@ def test_changefeed_reconnects_when_connection_lost(monkeypatch):
|
|||||||
|
|
||||||
fact = changefeed.outqueue.get()['fact']
|
fact = changefeed.outqueue.get()['fact']
|
||||||
assert fact == 'Cats sleep 70% of their lives.'
|
assert fact == 'Cats sleep 70% of their lives.'
|
||||||
|
|
||||||
|
|
||||||
|
@patch('rethinkdb.connect')
|
||||||
|
def test_connection_happens_one_time_if_successful(mock_connect):
|
||||||
|
from bigchaindb.backend import connect
|
||||||
|
|
||||||
|
query = r.expr('1')
|
||||||
|
conn = connect('rethinkdb', 'localhost', 1337, 'whatev')
|
||||||
|
conn.run(query)
|
||||||
|
mock_connect.assert_called_once_with(host='localhost',
|
||||||
|
port=1337,
|
||||||
|
db='whatev')
|
||||||
|
Loading…
x
Reference in New Issue
Block a user