cloud-init-dev team mailing list archive
-
cloud-init-dev team
-
Mailing list archive
-
Message #04868
[Merge] ~smoser/cloud-init:fix/opensuse-skip-on-httpretty-ssl-error into cloud-init:master
Scott Moser has proposed merging ~smoser/cloud-init:fix/opensuse-skip-on-httpretty-ssl-error into cloud-init:master.
Commit message:
tests: SkipTest some errors found in httpretty in OpenSuSE 42.3.
In OpenSuSE 42.3, with
python-httpretty=0.8.8-7.1
python-ndg-httpsclient=0.4.0-3.2
python-pyOpenSSL=16.0.0-4.1
We hit what looks like the bug described at
https://github.com/gabrielfalcao/HTTPretty/issues/242
This just skipTest if we hit that scenario.
Requested reviews:
cloud-init commiters (cloud-init-dev)
For more details, see:
https://code.launchpad.net/~smoser/cloud-init/+git/cloud-init/+merge/345630
see commit message
--
Your team cloud-init commiters is requested to review the proposed merge of ~smoser/cloud-init:fix/opensuse-skip-on-httpretty-ssl-error into cloud-init:master.
diff --git a/tests/unittests/test_handler/test_handler_chef.py b/tests/unittests/test_handler/test_handler_chef.py
index 0136a93..1731b99 100644
--- a/tests/unittests/test_handler/test_handler_chef.py
+++ b/tests/unittests/test_handler/test_handler_chef.py
@@ -12,9 +12,10 @@ from cloudinit import distros
from cloudinit import helpers
from cloudinit.sources import DataSourceNone
from cloudinit import util
+from cloudinit.url_helper import UrlError
from cloudinit.tests.helpers import (
- CiTestCase, FilesystemMockingTestCase, mock, skipIf)
+ CiTestCase, FilesystemMockingTestCase, mock, skipIf, SkipTest)
LOG = logging.getLogger(__name__)
@@ -26,6 +27,13 @@ class TestInstallChefOmnibus(CiTestCase):
def setUp(self):
self.new_root = self.tmp_dir()
+ def skip_or_raise_for_httpretty_ssl(self, e):
+ """This happens in opensuse. httpretty bug."""
+ url = "https://github.com/gabrielfalcao/HTTPretty/issues/242"
+ if all([s in str(e) for s in ("bad handshake", "32", "EPIPE")]):
+ raise SkipTest("HTTPretty SSL bug: %s" % url)
+ raise e
+
@httpretty.activate
def test_install_chef_from_omnibus_runs_chef_url_content(self):
"""install_chef_from_omnibus runs downloaded OMNIBUS_URL as script."""
@@ -33,7 +41,10 @@ class TestInstallChefOmnibus(CiTestCase):
response = '#!/bin/bash\necho "Hi Mom" > {0}'.format(chef_outfile)
httpretty.register_uri(
httpretty.GET, cc_chef.OMNIBUS_URL, body=response, status=200)
- cc_chef.install_chef_from_omnibus()
+ try:
+ cc_chef.install_chef_from_omnibus()
+ except UrlError as e:
+ self.skip_or_raise_for_httpretty_ssl(e)
self.assertEqual('Hi Mom\n', util.load_file(chef_outfile))
@mock.patch('cloudinit.config.cc_chef.url_helper.readurl')
@@ -73,7 +84,10 @@ class TestInstallChefOmnibus(CiTestCase):
response = '#!/bin/bash\necho "Hi Mom" > {0}'.format(chef_outfile)
httpretty.register_uri(
httpretty.GET, cc_chef.OMNIBUS_URL, body=response)
- cc_chef.install_chef_from_omnibus(omnibus_version='2.0')
+ try:
+ cc_chef.install_chef_from_omnibus(omnibus_version='2.0')
+ except UrlError as e:
+ self.skip_or_raise_for_httpretty_ssl(e)
called_kwargs = m_subp_blob.call_args_list[0][1]
expected_kwargs = {
Follow ups