summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJenkins <jenkins@review.openstack.org>2016-09-27 11:18:51 +0000
committerGerrit Code Review <review@openstack.org>2016-09-27 11:18:51 +0000
commit8b417374f7572a32714252e07d95bacc1c232c07 (patch)
treeab5f9638d013050daac4b941070a7a50e2a20843
parentd9c214eb57adb445eb4b19d0b4355188200377a2 (diff)
parenta33ac87de1015ee3756813688224c2886ef14eeb (diff)
Merge "Multiple integration test fixes" into stable/newton
-rw-r--r--horizon/test/firefox_binary.py30
-rw-r--r--openstack_dashboard/test/integration_tests/pages/project/compute/instancespage.py6
2 files changed, 32 insertions, 4 deletions
diff --git a/horizon/test/firefox_binary.py b/horizon/test/firefox_binary.py
index ba67c7d..93cb955 100644
--- a/horizon/test/firefox_binary.py
+++ b/horizon/test/firefox_binary.py
@@ -11,10 +11,13 @@
11# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 11# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12# See the License for the specific language governing permissions and 12# See the License for the specific language governing permissions and
13# limitations under the License. 13# limitations under the License.
14import errno
14import platform 15import platform
15import shutil 16import shutil
17import socket
16import subprocess 18import subprocess
17import tempfile 19import tempfile
20import time
18 21
19from selenium.common import exceptions as selenium_exceptions 22from selenium.common import exceptions as selenium_exceptions
20from selenium.webdriver.common import desired_capabilities as dc 23from selenium.webdriver.common import desired_capabilities as dc
@@ -62,6 +65,9 @@ class WebDriver(firefox.webdriver.WebDriver):
62 """Workarounds selenium firefox issues.""" 65 """Workarounds selenium firefox issues."""
63 TEMPDIR = tempfile.mkdtemp(dir="/tmp") 66 TEMPDIR = tempfile.mkdtemp(dir="/tmp")
64 67
68 CONNREFUSED_RETRY_COUNT = 3
69 CONNREFUSED_RETRY_INTERVAL = 5
70
65 def __init__(self, firefox_profile=None, firefox_binary=None, timeout=30, 71 def __init__(self, firefox_profile=None, firefox_binary=None, timeout=30,
66 desired_capabilities=dc.DesiredCapabilities.FIREFOX, 72 desired_capabilities=dc.DesiredCapabilities.FIREFOX,
67 proxy=None): 73 proxy=None):
@@ -69,9 +75,27 @@ class WebDriver(firefox.webdriver.WebDriver):
69 if firefox_profile is None: 75 if firefox_profile is None:
70 firefox_profile = firefox.webdriver.FirefoxProfile() 76 firefox_profile = firefox.webdriver.FirefoxProfile()
71 self.setup_profile(firefox_profile) 77 self.setup_profile(firefox_profile)
72 super(WebDriver, self).__init__( 78
73 firefox_profile, FirefoxBinary(), timeout, 79 # NOTE(amotoki): workaround for bug 1626643
74 desired_capabilities, proxy) 80 # Connection refused error happens randomly in integration tests.
81 # When a connection refused exception is raised from start_session
82 # called from WebDriver.__init__, retry __init__.
83 for i in range(self.CONNREFUSED_RETRY_COUNT + 1):
84 try:
85 super(WebDriver, self).__init__(
86 firefox_profile, FirefoxBinary(), timeout,
87 desired_capabilities, proxy)
88 if i > 0:
89 # i==0 is normal behavior without connection refused.
90 print('NOTE: Retried %s time(s) due to '
91 'connection refused.' % i)
92 break
93 except socket.error as socket_error:
94 if (socket_error.errno == errno.ECONNREFUSED
95 and i < self.CONNREFUSED_RETRY_COUNT):
96 time.sleep(self.CONNREFUSED_RETRY_INTERVAL)
97 continue
98 raise
75 except selenium_exceptions.WebDriverException: 99 except selenium_exceptions.WebDriverException:
76 # If we can't start, cleanup profile 100 # If we can't start, cleanup profile
77 shutil.rmtree(self.profile.path) 101 shutil.rmtree(self.profile.path)
diff --git a/openstack_dashboard/test/integration_tests/pages/project/compute/instancespage.py b/openstack_dashboard/test/integration_tests/pages/project/compute/instancespage.py
index f231442..5a1ccfb 100644
--- a/openstack_dashboard/test/integration_tests/pages/project/compute/instancespage.py
+++ b/openstack_dashboard/test/integration_tests/pages/project/compute/instancespage.py
@@ -9,6 +9,8 @@
9# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the 9# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
10# License for the specific language governing permissions and limitations 10# License for the specific language governing permissions and limitations
11# under the License. 11# under the License.
12import netaddr
13
12from openstack_dashboard.test.integration_tests.pages import basepage 14from openstack_dashboard.test.integration_tests.pages import basepage
13from openstack_dashboard.test.integration_tests.regions import forms 15from openstack_dashboard.test.integration_tests.regions import forms
14from openstack_dashboard.test.integration_tests.regions import tables 16from openstack_dashboard.test.integration_tests.regions import tables
@@ -156,4 +158,6 @@ class InstancesPage(basepage.BaseNavigationPage):
156 def get_fixed_ipv4(self, name): 158 def get_fixed_ipv4(self, name):
157 row = self._get_row_with_instance_name(name) 159 row = self._get_row_with_instance_name(name)
158 ips = row.cells[self.INSTANCES_TABLE_IP_COLUMN].text 160 ips = row.cells[self.INSTANCES_TABLE_IP_COLUMN].text
159 return ips.split()[0] 161 for ip in ips.split():
162 if netaddr.valid_ipv4(ip):
163 return ip