← Back to team overview

cloud-init-dev team mailing list archive

Re: [Merge] ~chad.smith/cloud-init:bug/1800223-retry-imds-on-timeout into cloud-init:master

 

That looks quite nice.  One in-line comment, will approve with a reply.

Diff comments:

> diff --git a/cloudinit/tests/test_url_helper.py b/cloudinit/tests/test_url_helper.py
> index 113249d..16dd37f 100644
> --- a/cloudinit/tests/test_url_helper.py
> +++ b/cloudinit/tests/test_url_helper.py
> @@ -64,3 +66,27 @@ class TestReadFileOrUrl(CiTestCase):
>          result = read_file_or_url(url)
>          self.assertEqual(result.contents, data)
>          self.assertEqual(str(result), data.decode('utf-8'))
> +
> +
> +class TestRetryOnUrlExc(CiTestCase):
> +
> +    def test_do_not_retry_non_urlerror(self):
> +        """When exception is not UrlError return False."""
> +        myerror = IOError('something unexcpected')
> +        self.assertFalse(retry_on_url_exc(msg='', exc=myerror))
> +
> +    def test_perform_retries_on_not_found(self):
> +        """When exception is UrlError with a 404 status code return True."""
> +        e = RuntimeError('something was not found')
> +        myerror = UrlError(
> +            cause=e, code=NOT_FOUND, headers=None, url='http:/1')
> +        self.assertTrue(retry_on_url_exc(msg='', exc=myerror))
> +
> +    def test_perform_retries_on_timeout(self):
> +        """When exception is a requests.Timout return True."""
> +        e = requests.Timeout('something timed out')
> +        myerror = UrlError(
> +            cause=e, code=None, headers=None, url='http:/1')

does the url value matter here?  why is it malformed?

> +        self.assertTrue(retry_on_url_exc(msg='', exc=myerror))
> +
> +# vi: ts=4 expandtab


-- 
https://code.launchpad.net/~chad.smith/cloud-init/+git/cloud-init/+merge/358112
Your team cloud-init commiters is requested to review the proposed merge of ~chad.smith/cloud-init:bug/1800223-retry-imds-on-timeout into cloud-init:master.