diff --git a/tests/logging.conf b/tests/debug-logging.conf similarity index 100% rename from tests/logging.conf rename to tests/debug-logging.conf diff --git a/tests/samsa/client/tests.py b/tests/samsa/client/tests.py index 18070551d..86786134a 100644 --- a/tests/samsa/client/tests.py +++ b/tests/samsa/client/tests.py @@ -14,6 +14,7 @@ limitations under the License. """ +import logging import time from samsa.client import Client, Message, OFFSET_EARLIEST, OFFSET_LATEST @@ -21,6 +22,8 @@ ManagedConsumer, ManagedProducer) +logger = logging.getLogger(__name__) + # class ClientTestCase(unittest2.TestCase): # def test_produce(self): # raise NotImplementedError @@ -58,12 +61,17 @@ def assertPassesWithMultipleAttempts(self, fn, attempts, timeout=1, backoff=None backoff = lambda attempt, timeout: timeout for attempt in xrange(1, attempts + 1): + logger.debug('Starting attempt %s for %s...', attempt, fn) try: fn() + logger.info('Passed attempt %s for %s', attempt, fn) break except AssertionError: if attempt < attempts: - time.sleep(backoff(attempt, timeout)) + wait = backoff(attempt, timeout) + logger.exception('Failed attempt %s for %s, waiting for %s seconds', + attempt, fn, wait) + time.sleep(wait) else: raise