Resolve gate job failure

This patch resolves below gate job issues:
* openstack-tox-py27: Failing for double word hacking test, resolved
  by taking reference for nova fixes [1]
* masakari-functional-devstack-multinode: Failing since 'Split
  OpenStackCloud at SDK [1]', resolved by calling proper SDK connection.
* Devstack installation add more than one networks if neutron service is
  enabled [3] and hence server creation fails with error 'ERROR
  (Conflict): Multiple possible networks. Fixed this issue by passing
  the network during server creation.

[1]: f545a25cc4
[2]: 1a4ed826b9 (diff-a948cab0aca56c2f4bf6569f8dc8ac66)
[3]: 8f7216290a

Change-Id: Ie477ddf4516712f8fd145ec78ca2335762972053
This commit is contained in:
Shilpa Devharakar 2019-07-18 09:43:25 +00:00
parent e8a18eee83
commit 204fa9c849
3 changed files with 11 additions and 18 deletions

View File

@ -17,7 +17,6 @@ import logging
import os
import sys
from openstack.cloud.openstackcloud import _OpenStackCloudMixin
import openstack.config
from openstack import connection
@ -64,6 +63,6 @@ class BaseFunctionalTest(base.TestCase):
self.hypervisors = self._hypervisors()
def _hypervisors(self):
hypervisors = _OpenStackCloudMixin.list_hypervisors(
hypervisors = connection.Connection.list_hypervisors(
connection.from_config(cloud_name=TEST_CLOUD_NAME))
return hypervisors

View File

@ -32,13 +32,12 @@ class NotificationVMTestCase(base.NotificationTestBase):
# Get image and flavor to create server
image_uuids = [image.id for image in self.admin_conn.compute.images()]
flavors = [flavor.id for flavor in self.admin_conn.compute.flavors()]
networks = [net.id for net in self.admin_conn.network.networks()]
# Create server
server = self.conn.compute.create_server(name='abc',
flavorRef=flavors[0],
imageRef=image_uuids[0],
metadata={
'HA_Enabled': 'True'})
server = self.admin_conn.compute.create_server(
name='abc', flavorRef=flavors[0], imageRef=image_uuids[0],
networks=[{'uuid': networks[0]}], metadata={'HA_Enabled': 'True'})
self.addCleanup(self.conn.compute.delete_server, server)
self.check_server_status(server, 'ACTIVE')

View File

@ -12,13 +12,11 @@
# License for the specific language governing permissions and limitations
# under the License.
import sys
import textwrap
import ddt
import mock
import pep8
import testtools
from masakari.hacking import checks
from masakari import test
@ -222,7 +220,7 @@ class HackingTestCase(test.NoDBTestCase):
def _run_check(self, code, checker, filename=None):
pep8.register_check(checker)
lines = textwrap.dedent(code).strip().splitlines(True)
lines = textwrap.dedent(code).lstrip().splitlines(True)
checker = pep8.Checker(filename=filename, lines=lines)
checker.check_all()
@ -364,20 +362,17 @@ class HackingTestCase(test.NoDBTestCase):
filename="masakari/cmd/serialproxy.py",
expected_errors=errors)
# TODO(neha-alhat): Remove when
# https://bugs.launchpad.net/masakari/+bug/1804062 is resolved.
@testtools.skipIf(
sys.version_info[0:3] >= (3, 6, 7),
'tokenize has backwards incompatible behavior from 3.6.7')
def test_check_doubled_words(self):
errors = [(1, 0, "M325")]
# Artificial break to stop pep8 detecting the test !
code = "This is the" + " the best comment"
# Explicit addition of line-ending here and below since this isn't a
# block comment and without it we trigger #1804062. Artificial break is
# necessary to stop flake8 detecting the test
code = "'This is the" + " the best comment'\n"
self._assert_has_errors(code, checks.check_doubled_words,
expected_errors=errors)
code = "This is the then best comment"
code = "'This is the then best comment'\n"
self._assert_has_no_errors(code, checks.check_doubled_words)
def test_dict_iteritems(self):