Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 10 additions & 1 deletion dockerdb/mongo_pytest.py
Original file line number Diff line number Diff line change
Expand Up @@ -96,7 +96,16 @@ def mongo(request):
insert_data(client, data)

if restore:
mongorestore(service, restore)
for i in range(3):
try:
mongorestore(service, restore)
break
except Exception as error:
if i == 2:
LOG.error('Error while restoring {}'.format(error))
raise error
else:
LOG.warn('Retrying to restore...')

yield service

Expand Down
7 changes: 2 additions & 5 deletions dockerdb/service.py
Original file line number Diff line number Diff line change
Expand Up @@ -94,14 +94,11 @@ def exec_run(self, command, input_file):

# TODO Find a way to avoid hardcoded sleep limits for python 2
# TODO Solutions is still unknown, see: STUD-583
python_version = sys.version_info[0]
if python_version < 3:
time.sleep(1)
time.sleep(1)

sock.shutdown(socket.SHUT_WR)

if python_version < 3:
time.sleep(0.2)
time.sleep(1)

sock.setblocking(True)
output += sock.recv(4096 * 100)
Expand Down