mango: revisit test database recreation logic

Databases used for integration testing are being recreated by
unbounded recursion which can blow up the stack in case of
unrecoverable errors.

Replace the tail recursion for a regular loop, set an upper limit
for the number of tries, and signal the problem with a more
descriptive message.  Introduce an increasing delay between the
subsequent tries for tolerance against transient errors.
1 file changed