diff options
author | Victor Shyba <victor1984@riseup.net> | 2017-10-27 18:58:03 -0300 |
---|---|---|
committer | drebs <drebs@riseup.net> | 2017-10-31 16:53:02 -0200 |
commit | 17b4ab3d98439cf5e7e7893da1f1b9f6a08ab82c (patch) | |
tree | fe310f4a3639da2e6386afb79e47e0a2da842932 | |
parent | 3306ea69ee33cdafa8803f9c717b60b9f3d3b4a0 (diff) |
[bug] set errbacks before gathering results
-rw-r--r-- | src/leap/soledad/common/couch/state.py | 5 | ||||
-rw-r--r-- | tests/couch/test_state.py | 4 |
2 files changed, 4 insertions, 5 deletions
diff --git a/src/leap/soledad/common/couch/state.py b/src/leap/soledad/common/couch/state.py index 38098e3f..5614b32f 100644 --- a/src/leap/soledad/common/couch/state.py +++ b/src/leap/soledad/common/couch/state.py @@ -93,9 +93,8 @@ def _check_db_schema_version(url, db, auth, agent=None): def _stop(failure, reactor): - exception = failure.value.subFailure.value logger.error("Failure while checking schema versions: %r - %s" - % (exception, exception.message)) + % (failure, failure.message)) reactor.addSystemEventTrigger('after', 'shutdown', os._exit, 1) reactor.stop() @@ -124,9 +123,9 @@ def check_schema_versions(couch_url, agent=None, reactor=reactor): if not db.startswith('user-'): continue d = semaphore.run(_check_db_schema_version, url, db, auth, agent=agent) + d.addErrback(_stop, reactor=reactor) deferreds.append(d) d = defer.gatherResults(deferreds, consumeErrors=True) - d.addErrback(_stop, reactor=reactor) yield d diff --git a/tests/couch/test_state.py b/tests/couch/test_state.py index 673d9c41..27db5abe 100644 --- a/tests/couch/test_state.py +++ b/tests/couch/test_state.py @@ -47,7 +47,7 @@ class CouchDesignDocsTests(CouchDBTestCase): mocked_reactor = mock.Mock() yield check_schema_versions( self.couch_url, agent=self.agent, reactor=mocked_reactor) - self.assertTrue(mocked_reactor.stop.call_count == 1) + mocked_reactor.stop.assert_called() @defer.inlineCallbacks def test__check_db_schema_version_missing_config_doc_raises(self): @@ -62,4 +62,4 @@ class CouchDesignDocsTests(CouchDBTestCase): mocked_reactor = mock.Mock() yield check_schema_versions( self.couch_url, agent=self.agent, reactor=mocked_reactor) - self.assertTrue(mocked_reactor.stop.call_count == 1) + mocked_reactor.stop.assert_called() |