Fix incorrect exception handling (pass without any log record) by adding log record

Use `logger.warning('Ignoring exception: {!r}'.format(e))` as exception hadnler in `pass` places
Closes-bug: #1551130

Change-Id: I27d9b9901b1ec382533c43b1f18ee72b996c08d8
This commit is contained in:
Alexey Stepanov 2016-02-29 12:29:13 +03:00
parent 026e9c6b61
commit fae4f24153
5 changed files with 29 additions and 15 deletions

View File

@ -13,6 +13,7 @@
# under the License. # under the License.
import time import time
import traceback
from urlparse import urlparse from urlparse import urlparse
from cinderclient import client as cinderclient from cinderclient import client as cinderclient
@ -150,8 +151,9 @@ class Common(object):
else: else:
image = [i.id for i in self.nova.images.list()] image = [i.id for i in self.nova.images.list()]
break break
except: except Exception as e:
pass logger.warning('Ignoring exception: {!r}'.format(e))
logger.debug(traceback.format_exc())
else: else:
raise Exception('Can not get image') raise Exception('Can not get image')

View File

@ -15,6 +15,7 @@
import os import os
import re import re
import sys import sys
import traceback
import yaml import yaml
import zlib import zlib
from urllib2 import urlopen from urllib2 import urlopen
@ -222,8 +223,9 @@ def get_package_test_info(package, pkg_type, tests_path, patch_target):
test = yaml.load(open(path).read()) test = yaml.load(open(path).read())
if 'system_tests' in test.keys(): if 'system_tests' in test.keys():
tests.update(test['system_tests']['tags']) tests.update(test['system_tests']['tags'])
except IOError: except IOError as e:
pass logger.warning('Ignoring exception: {!r}'.format(e))
logger.debug(traceback.format_exc())
return tests return tests

View File

@ -13,12 +13,12 @@
# under the License. # under the License.
import sys import sys
import traceback
from proboscis.asserts import assert_true from proboscis.asserts import assert_true
from proboscis import test from proboscis import test
from proboscis import SkipTest from proboscis import SkipTest
from fuelweb_test import logger from fuelweb_test import logger
from fuelweb_test.helpers.decorators import log_snapshot_after_test from fuelweb_test.helpers.decorators import log_snapshot_after_test
from fuelweb_test.helpers.decorators import upload_manifests from fuelweb_test.helpers.decorators import upload_manifests
@ -49,9 +49,10 @@ class NeutronTun(TestBasic):
test_group = sys.argv[-1] test_group = sys.argv[-1]
try: try:
self.check_run(snapshot_name=snapshot_name) self.check_run(snapshot_name=snapshot_name)
except SkipTest: except SkipTest as e:
if expected_group in test_group: if expected_group in test_group:
pass logger.warning('Ignoring exception: {!r}'.format(e))
logger.debug(traceback.format_exc())
else: else:
raise raise

View File

@ -13,6 +13,7 @@
# under the License. # under the License.
import sys import sys
import traceback
from proboscis.asserts import assert_true from proboscis.asserts import assert_true
from proboscis import test from proboscis import test
@ -49,9 +50,10 @@ class NeutronVlanCephMongo(TestBasic):
test_group = sys.argv[-1] test_group = sys.argv[-1]
try: try:
self.check_run(snapshot_name=snapshot_name) self.check_run(snapshot_name=snapshot_name)
except SkipTest: except SkipTest as e:
if expected_group in test_group: if expected_group in test_group:
pass logger.warning('Ignoring exception: {!r}'.format(e))
logger.debug(traceback.format_exc())
else: else:
raise raise

View File

@ -15,6 +15,7 @@
from ipaddr import IPAddress from ipaddr import IPAddress
import random import random
import time import time
import traceback
from devops.helpers import helpers from devops.helpers import helpers
from proboscis import asserts from proboscis import asserts
@ -23,6 +24,7 @@ from proboscis import test
from fuelweb_test.helpers.decorators import log_snapshot_after_test from fuelweb_test.helpers.decorators import log_snapshot_after_test
from fuelweb_test.helpers import os_actions from fuelweb_test.helpers import os_actions
from fuelweb_test.helpers import utils from fuelweb_test.helpers import utils
from fuelweb_test import logger
from fuelweb_test import settings from fuelweb_test import settings
from fuelweb_test.tests.base_test_case import SetupEnvironment from fuelweb_test.tests.base_test_case import SetupEnvironment
from fuelweb_test.tests.base_test_case import TestBasic from fuelweb_test.tests.base_test_case import TestBasic
@ -81,7 +83,8 @@ class ServicesReconfiguration(TestBasic):
except Exception as e: except Exception as e:
if e.code != expected_code: if e.code != expected_code:
raise e raise e
pass logger.warning('Ignoring exception: {!r}'.format(e))
logger.debug(traceback.format_exc())
else: else:
raise Exception(err_msg) raise Exception(err_msg)
@ -246,7 +249,8 @@ class ServicesReconfiguration(TestBasic):
except Exception as e: except Exception as e:
if 'No tenant network is available' not in e.message: if 'No tenant network is available' not in e.message:
raise e raise e
pass logger.warning('Ignoring exception: {!r}'.format(e))
logger.debug(traceback.format_exc())
else: else:
raise Exception("New configuration was not applied") raise Exception("New configuration was not applied")
@ -270,7 +274,8 @@ class ServicesReconfiguration(TestBasic):
except Exception as e: except Exception as e:
if 'Quota exceeded for instances' not in e.message: if 'Quota exceeded for instances' not in e.message:
raise e raise e
pass logger.warning('Ignoring exception: {!r}'.format(e))
logger.debug(traceback.format_exc())
else: else:
raise Exception("New configuration was not applied") raise Exception("New configuration was not applied")
@ -289,7 +294,8 @@ class ServicesReconfiguration(TestBasic):
except Exception as e: except Exception as e:
if e.http_status != 404: if e.http_status != 404:
raise e raise e
pass logger.warning('Ignoring exception: {!r}'.format(e))
logger.debug(traceback.format_exc())
else: else:
raise Exception("New configuration was not applied") raise Exception("New configuration was not applied")
@ -524,8 +530,9 @@ class ServicesReconfiguration(TestBasic):
self.show_step(4) self.show_step(4)
try: try:
self.fuel_web.assert_task_success(task, timeout=3600, interval=30) self.fuel_web.assert_task_success(task, timeout=3600, interval=30)
except AssertionError: except AssertionError as e:
pass logger.warning('Ignoring exception: {!r}'.format(e))
logger.debug(traceback.format_exc())
else: else:
raise Exception("New configuration was not applied") raise Exception("New configuration was not applied")