def testCommitWithRetryTemporaryFailure(self):
     mock_operation = mock.MagicMock()
     mock_operation.commit = mock.Mock(
         side_effect=[face.AbortionError(None, None, None, None), True])
     with mock.patch.object(time, "sleep") as mock_time:
         self.db.CallWithRetry(mock_operation.commit, "write")
         # 1 failure == 1 sleep
         self.assertEqual(mock_time.call_count, 1)
 def testCommitWithRetryCompleteFailure(self):
   mock_operation = mock.MagicMock()
   mock_operation.commit = mock.Mock(side_effect=face.AbortionError(
       None, None, None, None))
   with self.assertRaises(cloud_bigtable_data_store.AccessError):
     with mock.patch.object(time, "sleep") as mock_time:
       self.db.CallWithRetry(mock_operation.commit, "write")
       self.assertEqual(mock_time.call_count,
                        config.CONFIG["CloudBigtable.retry_max_attempts"])