← 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

 

looks like there's still one more http:/1 in the unittest.

Diff comments:

> diff --git a/cloudinit/tests/test_url_helper.py b/cloudinit/tests/test_url_helper.py
> index 113249d..9a665ff 100644
> --- a/cloudinit/tests/test_url_helper.py
> +++ b/cloudinit/tests/test_url_helper.py
> @@ -64,3 +66,25 @@ 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')

There's still a bogus url='http:/1' here too

> +        self.assertTrue(retry_on_url_exc(msg='', exc=myerror))
> +
> +    def test_perform_retries_on_timeout(self):
> +        """When exception is a requests.Timout return True."""
> +        myerror = UrlError(cause=requests.Timeout('something timed out'))
> +        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.