Start using Hacking
Blacklist those warnings that occur frequently for followup patches. Fixup the rest and enable gating on those. Change-Id: I79f0ff1c16d9cb7f07cc99382c2a383e2fa532fc
This commit is contained in:
parent
7ab80b554d
commit
0ee399a828
2
tox.ini
2
tox.ini
@ -33,6 +33,6 @@ commands = {posargs}
|
|||||||
|
|
||||||
[flake8]
|
[flake8]
|
||||||
show-source = True
|
show-source = True
|
||||||
ignore = E125,F401,F403,F811,F821,F841,H
|
ignore = E125,F401,F403,F811,F821,F841,H102,H103,H201,H23,H301,H306,H401,H402,H403,H404,H702,H703
|
||||||
builtins = _
|
builtins = _
|
||||||
exclude=.venv,.tox,dist,doc,openstack,*egg,rsdns,tools
|
exclude=.venv,.tox,dist,doc,openstack,*egg,rsdns,tools
|
||||||
|
@ -222,7 +222,7 @@ class UserAccessController(wsgi.Controller):
|
|||||||
username, hostname = unquote_user_host(user_id)
|
username, hostname = unquote_user_host(user_id)
|
||||||
access = models.User.access(context, instance_id, username, hostname)
|
access = models.User.access(context, instance_id, username, hostname)
|
||||||
databases = [db.name for db in access.databases]
|
databases = [db.name for db in access.databases]
|
||||||
if not id in databases:
|
if id not in databases:
|
||||||
raise exception.DatabaseNotFound(uuid=id)
|
raise exception.DatabaseNotFound(uuid=id)
|
||||||
models.User.revoke(context, instance_id, username, hostname, id)
|
models.User.revoke(context, instance_id, username, hostname, id)
|
||||||
return wsgi.Result(None, 202)
|
return wsgi.Result(None, 202)
|
||||||
|
@ -105,7 +105,7 @@ class SecurityGroupRuleController(wsgi.Controller):
|
|||||||
|
|
||||||
def _validate_create_body(self, body):
|
def _validate_create_body(self, body):
|
||||||
try:
|
try:
|
||||||
# TODO: Add some better validation here around ports,
|
# TODO(slicknik): Add some better validation here around ports,
|
||||||
# protocol, and cidr values.
|
# protocol, and cidr values.
|
||||||
body['security_group_rule']
|
body['security_group_rule']
|
||||||
body['security_group_rule']['group_id']
|
body['security_group_rule']['group_id']
|
||||||
|
@ -303,12 +303,12 @@ class MySQLDatabase(Base):
|
|||||||
if not value:
|
if not value:
|
||||||
pass
|
pass
|
||||||
elif self._character_set:
|
elif self._character_set:
|
||||||
if not value in self.charset[self._character_set]:
|
if value not in self.charset[self._character_set]:
|
||||||
msg = "'%s' not a valid collation for charset '%s'"
|
msg = "'%s' not a valid collation for charset '%s'"
|
||||||
raise ValueError(msg % (value, self._character_set))
|
raise ValueError(msg % (value, self._character_set))
|
||||||
self._collate = value
|
self._collate = value
|
||||||
else:
|
else:
|
||||||
if not value in self.collation:
|
if value not in self.collation:
|
||||||
raise ValueError("'%s' not a valid collation" % value)
|
raise ValueError("'%s' not a valid collation" % value)
|
||||||
self._collate = value
|
self._collate = value
|
||||||
self._character_set = self.collation[value]
|
self._character_set = self.collation[value]
|
||||||
|
@ -1025,8 +1025,8 @@ class DeleteInstance(object):
|
|||||||
except backend_exception.VolumeNotFound:
|
except backend_exception.VolumeNotFound:
|
||||||
pass
|
pass
|
||||||
|
|
||||||
#TODO: make sure that the actual instance, volume, guest status, and DNS
|
#TODO(tim-simpson): make sure that the actual instance, volume,
|
||||||
# entries are deleted.
|
# guest status, and DNS entries are deleted.
|
||||||
|
|
||||||
|
|
||||||
@test(depends_on=[WaitForGuestInstallationToFinish],
|
@test(depends_on=[WaitForGuestInstallationToFinish],
|
||||||
|
@ -635,7 +635,7 @@ class ResizeInstanceVolume(object):
|
|||||||
for database in databases:
|
for database in databases:
|
||||||
db_list.append(database.name)
|
db_list.append(database.name)
|
||||||
for name in self.expected_dbs:
|
for name in self.expected_dbs:
|
||||||
if not name in db_list:
|
if name not in db_list:
|
||||||
fail("Database %s was not found after the volume resize. "
|
fail("Database %s was not found after the volume resize. "
|
||||||
"Returned list: %s" % (name, databases))
|
"Returned list: %s" % (name, databases))
|
||||||
|
|
||||||
|
@ -106,7 +106,8 @@ def mgmt_instance_get():
|
|||||||
instance.has_field('volume', dict, volume_check)
|
instance.has_field('volume', dict, volume_check)
|
||||||
else:
|
else:
|
||||||
instance.has_field('volume', None)
|
instance.has_field('volume', None)
|
||||||
#TODO: Validate additional fields, assert no extra fields exist.
|
#TODO(tim-simpson): Validate additional fields, assert
|
||||||
|
# no extra fields exist.
|
||||||
with CollectionCheck("server", api_instance.server) as server:
|
with CollectionCheck("server", api_instance.server) as server:
|
||||||
server.has_element("addresses", dict)
|
server.has_element("addresses", dict)
|
||||||
server.has_element("deleted", bool)
|
server.has_element("deleted", bool)
|
||||||
@ -183,7 +184,8 @@ class WhenMgmtInstanceGetIsCalledButServerIsNotReady(object):
|
|||||||
# Can be None if no volume is given on this instance.
|
# Can be None if no volume is given on this instance.
|
||||||
instance.has_field('server', None)
|
instance.has_field('server', None)
|
||||||
instance.has_field('volume', None)
|
instance.has_field('volume', None)
|
||||||
#TODO: Validate additional fields, assert no extra fields exist.
|
#TODO(tim-simpson): Validate additional fields,
|
||||||
|
# assert no extra fields exist.
|
||||||
|
|
||||||
|
|
||||||
@test(depends_on_classes=[CreateInstance], groups=[GROUP])
|
@test(depends_on_classes=[CreateInstance], groups=[GROUP])
|
||||||
|
@ -57,7 +57,7 @@ class ApiTest(testtools.TestCase):
|
|||||||
self.assertTrue(self.api._check_for_hearbeat())
|
self.assertTrue(self.api._check_for_hearbeat())
|
||||||
|
|
||||||
def test_check_for_heartbeat_exception(self):
|
def test_check_for_heartbeat_exception(self):
|
||||||
# TODO (juice) maybe it would be ok to extend the test to validate
|
# TODO(juice): maybe it would be ok to extend the test to validate
|
||||||
# the is_active method on the heartbeat
|
# the is_active method on the heartbeat
|
||||||
when(db_models.DatabaseModelBase).find_by(instance_id=any()).thenRaise(
|
when(db_models.DatabaseModelBase).find_by(instance_id=any()).thenRaise(
|
||||||
exception.ModelNotFoundError)
|
exception.ModelNotFoundError)
|
||||||
@ -68,7 +68,7 @@ class ApiTest(testtools.TestCase):
|
|||||||
verify(agent_models.AgentHeartBeat, times=0).is_active(any())
|
verify(agent_models.AgentHeartBeat, times=0).is_active(any())
|
||||||
|
|
||||||
def test_check_for_heartbeat_negative(self):
|
def test_check_for_heartbeat_negative(self):
|
||||||
# TODO (juice) maybe it would be ok to extend the test to validate
|
# TODO(juice): maybe it would be ok to extend the test to validate
|
||||||
# the is_active method on the heartbeat
|
# the is_active method on the heartbeat
|
||||||
when(db_models.DatabaseModelBase).find_by(
|
when(db_models.DatabaseModelBase).find_by(
|
||||||
instance_id=any()).thenReturn('agent')
|
instance_id=any()).thenReturn('agent')
|
||||||
|
@ -144,7 +144,7 @@ class GuestAgentManagerTest(testtools.TestCase):
|
|||||||
SEC_COUNT = 1 if is_mysql_installed else 0
|
SEC_COUNT = 1 if is_mysql_installed else 0
|
||||||
migrate_count = 1 * COUNT if not backup_id else 0
|
migrate_count = 1 * COUNT if not backup_id else 0
|
||||||
|
|
||||||
# TODO (juice) this should stub an instance of the MySqlAppStatus
|
# TODO(juice): this should stub an instance of the MySqlAppStatus
|
||||||
mock_status = mock()
|
mock_status = mock()
|
||||||
when(dbaas.MySqlAppStatus).get().thenReturn(mock_status)
|
when(dbaas.MySqlAppStatus).get().thenReturn(mock_status)
|
||||||
when(mock_status).begin_mysql_install().thenReturn(None)
|
when(mock_status).begin_mysql_install().thenReturn(None)
|
||||||
|
Loading…
Reference in New Issue
Block a user